@@ -4,6 +4,7 @@ import eslint from '@eslint/js';
44import tseslint from 'typescript-eslint' ;
55import eslintConfigPrettier from 'eslint-config-prettier/flat' ;
66import nodePlugin from 'eslint-plugin-n' ;
7+ import importPlugin from 'eslint-plugin-import' ;
78import { fileURLToPath } from 'node:url' ;
89import path from 'node:path' ;
910
@@ -12,6 +13,8 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
1213export default tseslint . config (
1314 eslint . configs . recommended ,
1415 ...tseslint . configs . recommended ,
16+ importPlugin . flatConfigs . recommended ,
17+ importPlugin . flatConfigs . typescript ,
1518 {
1619 languageOptions : {
1720 parserOptions : {
@@ -25,9 +28,21 @@ export default tseslint.config(
2528 plugins : {
2629 n : nodePlugin
2730 } ,
31+ settings : {
32+ 'import/resolver' : {
33+ typescript : {
34+ // Let the TS resolver handle NodeNext-style imports like "./foo.js"
35+ // while the actual file is "./foo.ts"
36+ extensions : [ '.js' , '.jsx' , '.ts' , '.tsx' , '.d.ts' ] ,
37+ // Use the tsconfig in each package root (when running ESLint from that package)
38+ project : 'tsconfig.json' ,
39+ } ,
40+ } ,
41+ } ,
2842 rules : {
2943 '@typescript-eslint/no-unused-vars' : [ 'error' , { argsIgnorePattern : '^_' } ] ,
30- 'n/prefer-node-protocol' : 'error'
44+ 'n/prefer-node-protocol' : 'error' ,
45+ '@typescript-eslint/consistent-type-imports' : [ 'error' , { disallowTypeAnnotations : false } ] ,
3146 }
3247 } ,
3348 {
0 commit comments