Skip to content

Commit 4ada28b

Browse files
committed
[Fix] no-unresolved: ignore type-only imports
1 parent e4298bb commit 4ada28b

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

config/typescript.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Adds `.jsx`, `.ts` and `.tsx` as an extension, and enables JSX/TSX parsing.
33
*/
44

5-
const allExtensions = ['.ts', '.tsx', '.d.ts', '.js', '.jsx'];
5+
const allExtensions = ['.ts', '.tsx', '.js', '.jsx'];
66

77
module.exports = {
88

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

2525
// TypeScript compilation already ensures that named imports exist in the referenced module
2626
'import/named': 'off',
27-
'import/no-unresolved': 'off',
2827
},
2928
};

src/rules/no-unresolved.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ module.exports = {
2424

2525
create(context) {
2626
function checkSourceValue(source) {
27+
// ignore type-only imports
28+
if (source.parent.importKind === 'type') {
29+
return;
30+
}
31+
2732
const shouldCheckCase = !CASE_SENSITIVE_FS
2833
&& (!context.options[0] || context.options[0].caseSensitive !== false);
2934

0 commit comments

Comments
 (0)