You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The markup was misleading, as it put several alternatives into one block of code while not making it clear where the alternatives begin and end, forcing the reader to think hard about it.
Also converted most yaml examples to jsonc.
Co-authored-by: jwbth <[email protected]>
Co-authored-by: Jordan Harband <[email protected]>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,6 +30,7 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
All rules are off by default. However, you may configure them manually
139
-
in your `eslint.config.(js|cjs|mjs)`, or extend one of the canned configs:
141
+
All rules are off by default. However, you may configure them manually in your `eslint.config.(js|cjs|mjs)`, or extend one of the preset configs:
140
142
141
143
```js
142
144
importimportPluginfrom'eslint-plugin-import';
@@ -166,18 +168,23 @@ You may use the following snippet or assemble your own config using the granular
166
168
167
169
Make sure you have installed [`@typescript-eslint/parser`] and [`eslint-import-resolver-typescript`] which are used in the following configuration.
168
170
169
-
```yaml
170
-
extends:
171
-
- eslint:recommended
172
-
- plugin:import/recommended
173
-
# the following lines do the trick
174
-
- plugin:import/typescript
175
-
settings:
176
-
import/resolver:
177
-
# You will also need to install and configure the TypeScript resolver
178
-
# See also https://github.com/import-js/eslint-import-resolver-typescript#configuration
179
-
typescript: true
180
-
node: true
171
+
```jsonc
172
+
{
173
+
"extends": [
174
+
"eslint:recommended",
175
+
"plugin:import/recommended",
176
+
// the following lines do the trick
177
+
"plugin:import/typescript",
178
+
],
179
+
"settings": {
180
+
"import/resolver": {
181
+
// You will also need to install and configure the TypeScript resolver
182
+
// See also https://github.com/import-js/eslint-import-resolver-typescript#configuration
@@ -206,6 +213,16 @@ You can reference resolvers in several ways (in order of precedence):
206
213
207
214
- as a conventional `eslint-import-resolver` name, like `eslint-import-resolver-foo`:
208
215
216
+
```jsonc
217
+
// .eslintrc
218
+
{
219
+
"settings": {
220
+
// uses 'eslint-import-resolver-foo':
221
+
"import/resolver":"foo",
222
+
},
223
+
}
224
+
```
225
+
209
226
```yaml
210
227
# .eslintrc.yml
211
228
settings:
@@ -226,6 +243,15 @@ module.exports = {
226
243
227
244
- with a full npm module name, like `my-awesome-npm-module`:
228
245
246
+
```jsonc
247
+
// .eslintrc
248
+
{
249
+
"settings": {
250
+
"import/resolver":"my-awesome-npm-module",
251
+
},
252
+
}
253
+
```
254
+
229
255
```yaml
230
256
# .eslintrc.yml
231
257
settings:
@@ -321,11 +347,15 @@ In practice, this means rules other than [`no-unresolved`](./docs/rules/no-unres
321
347
322
348
`no-unresolved` has its own [`ignore`](./docs/rules/no-unresolved.md#ignore) setting.
323
349
324
-
```yaml
325
-
settings:
326
-
import/ignore:
327
-
- \.coffee$ # fraught with parse errors
328
-
- \.(scss|less|css)$ # can't parse unprocessed CSS modules, either
350
+
```jsonc
351
+
{
352
+
"settings": {
353
+
"import/ignore": [
354
+
"\.coffee$", // fraught with parse errors
355
+
"\.(scss|less|css)$", // can't parse unprocessed CSS modules, either
356
+
],
357
+
},
358
+
}
329
359
```
330
360
331
361
### `import/core-modules`
@@ -344,10 +374,13 @@ import 'electron' // without extra config, will be flagged as unresolved!
344
374
that would otherwise be unresolved. To avoid this, you may provide `electron` as a
345
375
core module:
346
376
347
-
```yaml
348
-
# .eslintrc.yml
349
-
settings:
350
-
import/core-modules: [ electron ]
377
+
```jsonc
378
+
// .eslintrc
379
+
{
380
+
"settings": {
381
+
"import/core-modules": ["electron"],
382
+
},
383
+
}
351
384
```
352
385
353
386
In Electron's specific case, there is a shared config named `electron`
@@ -380,11 +413,15 @@ dependency parser will require and use the map key as the parser instead of the
380
413
configured ESLint parser. This is useful if you're inter-op-ing with TypeScript
381
414
directly using webpack, for example:
382
415
383
-
```yaml
384
-
# .eslintrc.yml
385
-
settings:
386
-
import/parsers:
387
-
"@typescript-eslint/parser": [ .ts, .tsx ]
416
+
```jsonc
417
+
// .eslintrc
418
+
{
419
+
"settings": {
420
+
"import/parsers": {
421
+
"@typescript-eslint/parser": [".ts", ".tsx"],
422
+
},
423
+
},
424
+
}
388
425
```
389
426
390
427
In this case, [`@typescript-eslint/parser`](https://www.npmjs.com/package/@typescript-eslint/parser)
@@ -414,20 +451,28 @@ For long-lasting processes, like [`eslint_d`] or [`eslint-loader`], however, it'
414
451
415
452
If you never use [`eslint_d`] or [`eslint-loader`], you may set the cache lifetime to `Infinity` and everything should be fine:
416
453
417
-
```yaml
418
-
# .eslintrc.yml
419
-
settings:
420
-
import/cache:
421
-
lifetime: ∞ # or Infinity
454
+
```jsonc
455
+
// .eslintrc
456
+
{
457
+
"settings": {
458
+
"import/cache": {
459
+
"lifetime":"∞", // or Infinity, in a JS config
460
+
},
461
+
},
462
+
}
422
463
```
423
464
424
465
Otherwise, set some integer, and cache entries will be evicted after that many seconds have elapsed:
0 commit comments