1
1
// @ts -check
2
2
3
+ import { dirname } from 'node:path' ;
4
+ import { fileURLToPath } from 'node:url' ;
5
+
3
6
import js from '@eslint/js' ;
4
7
import { defineConfig , globalIgnores } from 'eslint/config' ;
5
8
import prettierConfig from 'eslint-config-prettier/flat' ;
6
9
import { importX } from 'eslint-plugin-import-x' ;
7
10
import jest from 'eslint-plugin-jest' ;
8
11
import * as jestFormatting from 'eslint-plugin-jest-formatting' ;
12
+ import nodePlugin from 'eslint-plugin-n' ;
9
13
import globals from 'globals' ;
10
14
import tseslint from 'typescript-eslint' ;
11
15
16
+ const __dirname = dirname ( fileURLToPath ( import . meta. url ) ) ;
17
+
12
18
const config = defineConfig (
13
19
js . configs . recommended ,
14
20
tseslint . configs . recommendedTypeChecked ,
15
21
importX . flatConfigs . recommended ,
16
22
importX . flatConfigs . typescript ,
23
+ nodePlugin . configs [ 'flat/recommended-module' ] ,
17
24
{
18
25
name : 'Language options' ,
19
26
files : [ '**/*.{js,mjs,cjs,ts,mts}' ] ,
@@ -26,12 +33,12 @@ const config = defineConfig(
26
33
parser : tseslint . parser ,
27
34
parserOptions : {
28
35
projectService : true ,
29
- tsconfigRootDir : import . meta . dirname ,
36
+ tsconfigRootDir : __dirname ,
30
37
} ,
31
38
} ,
32
39
} ,
33
40
{
34
- name : 'Rules overrides for all files' ,
41
+ name : 'Overrides for all files' ,
35
42
rules : {
36
43
// Base
37
44
'max-lines-per-function' : 'off' ,
@@ -74,6 +81,10 @@ const config = defineConfig(
74
81
'import-x/no-mutable-exports' : 'error' ,
75
82
'import-x/no-named-default' : 'error' ,
76
83
'import-x/no-relative-packages' : 'warn' ,
84
+
85
+ // Node
86
+ 'n/no-missing-import' : 'off' , // handled by import-x and TS
87
+ 'n/no-missing-require' : 'off' , // handled by import-x and TS
77
88
} ,
78
89
} ,
79
90
{
0 commit comments