Skip to content

Commit

Permalink
[Fix] no-unresolved: ignore type-only imports
Browse files Browse the repository at this point in the history
  • Loading branch information
jablko committed Sep 11, 2021
1 parent e4298bb commit 4ada28b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 1 addition & 2 deletions config/typescript.js
Expand Up @@ -2,7 +2,7 @@
* Adds `.jsx`, `.ts` and `.tsx` as an extension, and enables JSX/TSX parsing.
*/

const allExtensions = ['.ts', '.tsx', '.d.ts', '.js', '.jsx'];
const allExtensions = ['.ts', '.tsx', '.js', '.jsx'];

module.exports = {

Expand All @@ -24,6 +24,5 @@ module.exports = {

// TypeScript compilation already ensures that named imports exist in the referenced module
'import/named': 'off',
'import/no-unresolved': 'off',
},
};
5 changes: 5 additions & 0 deletions src/rules/no-unresolved.js
Expand Up @@ -24,6 +24,11 @@ module.exports = {

create(context) {
function checkSourceValue(source) {
// ignore type-only imports
if (source.parent.importKind === 'type') {
return;
}

const shouldCheckCase = !CASE_SENSITIVE_FS
&& (!context.options[0] || context.options[0].caseSensitive !== false);

Expand Down

0 comments on commit 4ada28b

Please sign in to comment.