@@ -25,8 +25,12 @@ This means you can:
25
25
26
26
- [ Notice] ( #notice )
27
27
- [ Installation] ( #installation )
28
+ - [ ` eslint-plugin-import ` ] ( #eslint-plugin-import )
29
+ - [ ` eslint-plugin-import-x ` ] ( #eslint-plugin-import-x )
28
30
- [ Configuration] ( #configuration )
29
- - [ Options from ` enhanced-resolve ` ] ( #options-from-enhanced-resolve )
31
+ - [ ` eslint.config.js ` ] ( #eslintconfigjs )
32
+ - [ ` .eslintrc ` ] ( #eslintrc )
33
+ - [ Options from ` rspack-resolver ` ] ( #options-from-rspack-resolver )
30
34
- [ ` conditionNames ` ] ( #conditionnames )
31
35
- [ ` extensions ` ] ( #extensions )
32
36
- [ ` extensionAlias ` ] ( #extensionalias )
@@ -47,6 +51,8 @@ If you're facing some problems on rules `import/default` or `import/named` from
47
51
48
52
## Installation
49
53
54
+ ### ` eslint-plugin-import `
55
+
50
56
``` sh
51
57
# npm
52
58
npm i -D eslint-plugin-import eslint-import-resolver-typescript
@@ -58,7 +64,18 @@ pnpm i -D eslint-plugin-import eslint-import-resolver-typescript
58
64
yarn add -D eslint-plugin-import eslint-import-resolver-typescript
59
65
```
60
66
61
- ** Important when using ` eslint-plugin-import-x ` and ` npm ` ** : Use ` npm i -D eslint-plugin-import@eslint-plugin-import-x@latest eslint-import-resolver-typescript ` , or you will end up with both ` eslint-plugin-import ` and ` eslint-plugin-import-x ` in your node_modules.
67
+ ### ` eslint-plugin-import-x `
68
+
69
+ ``` sh
70
+ # npm
71
+ npm i -D eslint-plugin-import-x eslint-import-resolver-typescript
72
+
73
+ # pnpm
74
+ pnpm i -D eslint-plugin-import-x eslint-import-resolver-typescript
75
+
76
+ # yarn
77
+ yarn add -D eslint-plugin-import-x eslint-import-resolver-typescript
78
+ ```
62
79
63
80
## Configuration
64
81
@@ -67,12 +84,10 @@ yarn add -D eslint-plugin-import eslint-import-resolver-typescript
67
84
If you are using ` eslint-plugin-import-x@>=4.5.0 ` , you can use import/require to reference ` eslint-import-resolver-typescript ` directly in your ESLint flat config:
68
85
69
86
``` js
70
- // eslint.config.js
71
- const {
72
- createTypeScriptImportResolver ,
73
- } = require (' eslint-import-resolver-typescript' )
87
+ // eslint.config.js, CommonJS is also supported
88
+ import { createTypeScriptImportResolver } from ' eslint-import-resolver-typescript'
74
89
75
- module . exports = [
90
+ export default [
76
91
{
77
92
settings: {
78
93
' import-x/resolver-next' : [
@@ -100,6 +115,9 @@ module.exports = [
100
115
' packages/*/tsconfig.json' ,
101
116
' other-packages/*/tsconfig.json' ,
102
117
],
118
+
119
+ // use <root>/jsconfig.json
120
+ project: ' jsconfig.json' ,
103
121
}),
104
122
],
105
123
},
@@ -110,8 +128,8 @@ module.exports = [
110
128
But if you are using ` eslint-plugin-import ` or the older version of ` eslint-plugin-import-x ` , you can't use require/import:
111
129
112
130
``` js
113
- // eslint.config.js
114
- module . exports = [
131
+ // eslint.config.js, CommonJS is also supported
132
+ export default [
115
133
{
116
134
settings: {
117
135
' import/resolver' : {
@@ -139,6 +157,9 @@ module.exports = [
139
157
' packages/*/tsconfig.json' ,
140
158
' other-packages/*/tsconfig.json' ,
141
159
],
160
+
161
+ // use <root>/jsconfig.json
162
+ project: ' jsconfig.json' ,
142
163
},
143
164
},
144
165
},
@@ -186,13 +207,16 @@ Add the following to your `.eslintrc` config:
186
207
" packages/*/tsconfig.json" ,
187
208
" other-packages/*/tsconfig.json" ,
188
209
],
210
+
211
+ // use <root>/jsconfig.json
212
+ " project" : " jsconfig.json" ,
189
213
},
190
214
},
191
215
},
192
216
}
193
217
```
194
218
195
- ## Options from [ ` enhanced-resolve ` ] [ ]
219
+ ## Options from [ ` rspack-resolver ` ] [ ]
196
220
197
221
### ` conditionNames `
198
222
@@ -276,7 +300,7 @@ Default:
276
300
277
301
### Other options
278
302
279
- You can pass through other options of [ ` enhanced-resolve ` ] [ ] directly
303
+ You can pass through other options of [ ` rspack-resolver ` ] [ ] directly
280
304
281
305
### Default options
282
306
@@ -293,6 +317,8 @@ We have [GitHub Actions](https://github.com/import-js/eslint-import-resolver-typ
293
317
294
318
If either fails, we won't be able to merge your PR until it's fixed.
295
319
320
+ [ ![ Sponsors] ( https://raw.githubusercontent.com/1stG/static/master/sponsors.svg )] ( https://github.com/sponsors/JounQin )
321
+
296
322
## Sponsors
297
323
298
324
| 1stG | RxTS | UnTS |
@@ -315,6 +341,6 @@ Detailed changes for each release are documented in [CHANGELOG.md](./CHANGELOG.m
315
341
316
342
[ `eslint-plugin-import` ] : https://github.com/import-js/eslint-plugin-import
317
343
[ `eslint-plugin-import-x` ] : https://github.com/un-ts/eslint-plugin-import-x
318
- [ `enhanced-resolve ` ] : https://github.com/webpack/enhanced-resolve
344
+ [ `rspack-resolver ` ] : https://github.com/unrs/rspack-resolver
319
345
[ `typescript` ] : https://www.typescriptlang.org
320
346
[ isc ] : https://opensource.org/licenses/ISC
0 commit comments