1
- import path from "node:path" ;
2
-
3
- import { fileURLToPath } from "node:url" ;
4
-
5
- import { fixupConfigRules } from "@eslint/compat" ;
6
- import { FlatCompat } from "@eslint/eslintrc" ;
7
1
import js from "@eslint/js" ;
8
2
import stylistic from "@stylistic/eslint-plugin-ts" ;
9
3
import tsParser from "@typescript-eslint/parser" ;
10
4
import love from "eslint-config-love" ;
11
- import importPlugin from "eslint-plugin-import-x " ;
5
+ import importPlugin from "eslint-plugin-import" ;
12
6
import nPlugin from "eslint-plugin-n" ;
13
7
import perfectionist from "eslint-plugin-perfectionist" ;
14
8
import prettier from "eslint-plugin-prettier/recommended" ;
@@ -18,28 +12,8 @@ import eslintPluginUnicorn from "eslint-plugin-unicorn";
18
12
import globals from "globals" ;
19
13
import tseslint from "typescript-eslint" ;
20
14
21
- const __filename = fileURLToPath ( import . meta. url ) ;
22
- const __dirname = path . dirname ( __filename ) ;
23
- const compat = new FlatCompat ( {
24
- allConfig : js . configs . all ,
25
- baseDirectory : __dirname ,
26
- recommendedConfig : js . configs . recommended ,
27
- } ) ;
28
-
29
- function fixUpLoveRules ( ) {
30
- const rules = { } ;
31
-
32
- const regex = new RegExp ( / ^ i m p o r t \/ / ) ;
33
-
34
- for ( const [ key , value ] of Object . entries ( love . rules ) ) {
35
- rules [ key . replace ( regex , "import-x/" ) ] = value ;
36
- }
37
-
38
- return rules ;
39
- }
40
-
41
15
export default tseslint . config (
42
- ... fixupConfigRules ( compat . extends ( "eslint: recommended" ) ) ,
16
+ js . configs . recommended ,
43
17
{
44
18
ignores : [ "dist/**" , "reports/**" , "coverage/**" ] ,
45
19
} ,
@@ -55,10 +29,10 @@ export default tseslint.config(
55
29
} ,
56
30
} ,
57
31
plugins : {
58
- " import-x" : importPlugin ,
32
+ import : importPlugin ,
59
33
} ,
60
34
settings : {
61
- "import-x /resolver" : {
35
+ "import/resolver" : {
62
36
node : {
63
37
extensions : [ ".d.ts" , ".ts" ] ,
64
38
} ,
@@ -71,12 +45,12 @@ export default tseslint.config(
71
45
...importPlugin . configs . recommended . rules ,
72
46
...eslintPluginUnicorn . configs . recommended . rules ,
73
47
74
- "import-x /export" : [ "error" ] ,
75
- "import-x /first" : [ "error" ] ,
76
- "import-x /no-absolute-path" : [ "error" , { esmodule : true , commonjs : true , amd : false } ] ,
77
- "import-x /no-duplicates" : [ "error" ] ,
78
- "import-x /no-named-default" : [ "error" ] ,
79
- "import-x /no-webpack-loader-syntax" : [ "error" ] ,
48
+ "import/export" : [ "error" ] ,
49
+ "import/first" : [ "error" ] ,
50
+ "import/no-absolute-path" : [ "error" , { esmodule : true , commonjs : true , amd : false } ] ,
51
+ "import/no-duplicates" : [ "error" ] ,
52
+ "import/no-named-default" : [ "error" ] ,
53
+ "import/no-webpack-loader-syntax" : [ "error" ] ,
80
54
"arrow-body-style" : [ "error" , "always" ] ,
81
55
82
56
curly : [ "error" , "all" ] ,
@@ -122,26 +96,26 @@ export default tseslint.config(
122
96
"unicorn/no-null" : [ "off" ] ,
123
97
"unicorn/prefer-ternary" : [ "off" ] ,
124
98
125
- "import-x /extensions" : [
99
+ "import/extensions" : [
126
100
"error" ,
127
101
"never" ,
128
102
{
129
103
json : "always" ,
130
104
} ,
131
105
] ,
132
- "import-x /newline-after-import" : [ "error" ] ,
133
- "import-x /no-cycle" : [ "off" ] ,
134
- "import-x /no-extraneous-dependencies" : [ "off" ] ,
135
- "import-x /no-relative-packages" : [ "error" ] ,
136
- "import-x /no-unresolved" : [ "error" ] ,
137
- "import-x /order" : [
106
+ "import/newline-after-import" : [ "error" ] ,
107
+ "import/no-cycle" : [ "off" ] ,
108
+ "import/no-extraneous-dependencies" : [ "off" ] ,
109
+ "import/no-relative-packages" : [ "error" ] ,
110
+ "import/no-unresolved" : [ "error" ] ,
111
+ "import/order" : [
138
112
"error" ,
139
113
{
140
114
alphabetize : { caseInsensitive : true , order : "asc" } ,
141
115
"newlines-between" : "always-and-inside-groups" ,
142
116
} ,
143
117
] ,
144
- "import-x /prefer-default-export" : [ "off" ] ,
118
+ "import/prefer-default-export" : [ "off" ] ,
145
119
} ,
146
120
} ,
147
121
...tseslint . configs . strictTypeChecked ,
@@ -160,13 +134,13 @@ export default tseslint.config(
160
134
} ,
161
135
plugins : {
162
136
"@stylistic/ts" : stylistic ,
163
- " import-x" : importPlugin ,
137
+ import : importPlugin ,
164
138
n : nPlugin ,
165
139
promise,
166
140
perfectionist,
167
141
} ,
168
142
settings : {
169
- "import-x /resolver" : {
143
+ "import/resolver" : {
170
144
node : {
171
145
extensions : [ ".ts" ] ,
172
146
} ,
@@ -177,7 +151,7 @@ export default tseslint.config(
177
151
} ,
178
152
rules : {
179
153
...importPlugin . configs . typescript . rules ,
180
- ...fixUpLoveRules ( ) ,
154
+ ...love . rules ,
181
155
182
156
"@stylistic/ts/no-extra-semi" : [ "error" ] ,
183
157
"@typescript-eslint/array-type" : [ "error" , { default : "array" } ] ,
@@ -191,6 +165,8 @@ export default tseslint.config(
191
165
} ,
192
166
] ,
193
167
168
+ "@typescript-eslint/prefer-destructuring" : [ "off" ] ,
169
+
194
170
"@typescript-eslint/explicit-member-accessibility" : [ "error" ] ,
195
171
196
172
"@typescript-eslint/explicit-module-boundary-types" : [ "error" ] ,
@@ -263,7 +239,7 @@ export default tseslint.config(
263
239
264
240
"@typescript-eslint/unified-signatures" : [ "error" ] ,
265
241
266
- "import-x /consistent-type-specifier-style" : [ "error" , "prefer-top-level" ] ,
242
+ "import/consistent-type-specifier-style" : [ "error" , "prefer-top-level" ] ,
267
243
268
244
"n/handle-callback-err" : [ "error" , "^(err|error)$" ] ,
269
245
"n/no-callback-literal" : [ "error" ] ,
0 commit comments