@luxass/eslint-config 4.5.0 → 4.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -49
- package/dist/index.cjs +122 -324
- package/dist/index.d.cts +54 -733
- package/dist/index.d.ts +54 -733
- package/dist/index.js +121 -322
- package/package.json +14 -30
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
- [ESLint Flat config](https://eslint.org/docs/latest/use/configure/configuration-files-new), compose easily!
|
|
16
16
|
- Using [ESLint Stylistic](https://github.com/eslint-stylistic/eslint-stylistic)
|
|
17
17
|
- Respects `.gitignore` by default
|
|
18
|
-
- Optional [React](#react), [
|
|
18
|
+
- Optional [React](#react), [UnoCSS](#unocss), [Astro](#astro) support
|
|
19
19
|
- Optional [formatters](#formatters) support for CSS, HTML, etc.
|
|
20
20
|
|
|
21
21
|
## Usage
|
|
@@ -28,9 +28,9 @@ And create a `eslint.config.mjs` in your project root:
|
|
|
28
28
|
|
|
29
29
|
```js
|
|
30
30
|
// eslint.config.mjs
|
|
31
|
-
import luxass from
|
|
31
|
+
import luxass from "@luxass/eslint-config";
|
|
32
32
|
|
|
33
|
-
export default luxass()
|
|
33
|
+
export default luxass();
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
<details>
|
|
@@ -42,10 +42,10 @@ If you still use some configs from the legacy ESLint RC format, you can use the
|
|
|
42
42
|
|
|
43
43
|
```js
|
|
44
44
|
// eslint.config.mjs
|
|
45
|
-
import luxass from
|
|
46
|
-
import { FlatCompat } from
|
|
45
|
+
import luxass from "@luxass/eslint-config";
|
|
46
|
+
import { FlatCompat } from "@eslint/eslintrc";
|
|
47
47
|
|
|
48
|
-
const compat = new FlatCompat()
|
|
48
|
+
const compat = new FlatCompat();
|
|
49
49
|
|
|
50
50
|
export default luxass(
|
|
51
51
|
{
|
|
@@ -55,13 +55,13 @@ export default luxass(
|
|
|
55
55
|
// Legacy config
|
|
56
56
|
...compat.config({
|
|
57
57
|
extends: [
|
|
58
|
-
|
|
58
|
+
"eslint:recommended",
|
|
59
59
|
// Other extends...
|
|
60
60
|
],
|
|
61
61
|
})
|
|
62
62
|
|
|
63
63
|
// Other flat configs...
|
|
64
|
-
)
|
|
64
|
+
);
|
|
65
65
|
```
|
|
66
66
|
|
|
67
67
|
> Note that `.eslintignore` no longer works in Flat config, see [customization](#customization) for more details.
|
|
@@ -145,16 +145,16 @@ Normally you would only need to import the config and export it:
|
|
|
145
145
|
|
|
146
146
|
```js
|
|
147
147
|
// eslint.config.js
|
|
148
|
-
import luxass from
|
|
148
|
+
import luxass from "@luxass/eslint-config";
|
|
149
149
|
|
|
150
|
-
export default luxass()
|
|
150
|
+
export default luxass();
|
|
151
151
|
```
|
|
152
152
|
|
|
153
153
|
And that's it! Or you can configure each integration individually, for example:
|
|
154
154
|
|
|
155
155
|
```js
|
|
156
156
|
// eslint.config.js
|
|
157
|
-
import luxass from
|
|
157
|
+
import luxass from "@luxass/eslint-config";
|
|
158
158
|
|
|
159
159
|
export default luxass({
|
|
160
160
|
// Enable stylistic formatting rules
|
|
@@ -163,7 +163,7 @@ export default luxass({
|
|
|
163
163
|
// Or customize the stylistic rules
|
|
164
164
|
stylistic: {
|
|
165
165
|
indent: 2, // 4, or 'tab'
|
|
166
|
-
quotes:
|
|
166
|
+
quotes: "single", // or 'double'
|
|
167
167
|
},
|
|
168
168
|
|
|
169
169
|
// TypeScript and Vue are auto-detected, you can also explicitly enable them:
|
|
@@ -176,17 +176,17 @@ export default luxass({
|
|
|
176
176
|
|
|
177
177
|
// `.eslintignore` is no longer supported in Flat config, use `ignores` instead
|
|
178
178
|
ignores: [
|
|
179
|
-
|
|
179
|
+
"**/fixtures",
|
|
180
180
|
// ...globs
|
|
181
181
|
]
|
|
182
|
-
})
|
|
182
|
+
});
|
|
183
183
|
```
|
|
184
184
|
|
|
185
185
|
The `luxass` factory function also accepts any number of arbitrary custom config overrides:
|
|
186
186
|
|
|
187
187
|
```js
|
|
188
188
|
// eslint.config.js
|
|
189
|
-
import luxass from
|
|
189
|
+
import luxass from "@luxass/eslint-config";
|
|
190
190
|
|
|
191
191
|
export default luxass(
|
|
192
192
|
{
|
|
@@ -196,13 +196,13 @@ export default luxass(
|
|
|
196
196
|
// From the second arguments they are ESLint Flat Configs
|
|
197
197
|
// you can have multiple configs
|
|
198
198
|
{
|
|
199
|
-
files: [
|
|
199
|
+
files: ["**/*.ts"],
|
|
200
200
|
rules: {},
|
|
201
201
|
},
|
|
202
202
|
{
|
|
203
203
|
rules: {},
|
|
204
204
|
},
|
|
205
|
-
)
|
|
205
|
+
);
|
|
206
206
|
```
|
|
207
207
|
|
|
208
208
|
Going more advanced, you can also import fine-grained configs and compose them as you wish:
|
|
@@ -231,7 +231,7 @@ import {
|
|
|
231
231
|
unicorn,
|
|
232
232
|
vue,
|
|
233
233
|
yaml
|
|
234
|
-
} from
|
|
234
|
+
} from "@luxass/eslint-config";
|
|
235
235
|
|
|
236
236
|
export default combine(
|
|
237
237
|
ignores(),
|
|
@@ -247,7 +247,7 @@ export default combine(
|
|
|
247
247
|
jsonc(),
|
|
248
248
|
yaml(),
|
|
249
249
|
markdown(),
|
|
250
|
-
)
|
|
250
|
+
);
|
|
251
251
|
```
|
|
252
252
|
|
|
253
253
|
</details>
|
|
@@ -298,7 +298,7 @@ Certain rules would only be enabled in specific files, for example, `ts/*` rules
|
|
|
298
298
|
|
|
299
299
|
```js
|
|
300
300
|
// eslint.config.js
|
|
301
|
-
import luxass from
|
|
301
|
+
import luxass from "@luxass/eslint-config";
|
|
302
302
|
|
|
303
303
|
export default luxass(
|
|
304
304
|
{
|
|
@@ -307,35 +307,35 @@ export default luxass(
|
|
|
307
307
|
},
|
|
308
308
|
{
|
|
309
309
|
// Remember to specify the file glob here, otherwise it might cause the vue plugin to handle non-vue files
|
|
310
|
-
files: [
|
|
310
|
+
files: ["**/*.vue"],
|
|
311
311
|
rules: {
|
|
312
|
-
|
|
312
|
+
"vue/operator-linebreak": ["error", "before"],
|
|
313
313
|
},
|
|
314
314
|
},
|
|
315
315
|
{
|
|
316
316
|
// Without `files`, they are general rules for all files
|
|
317
317
|
rules: {
|
|
318
|
-
|
|
318
|
+
"style/semi": ["error", "never"],
|
|
319
319
|
},
|
|
320
320
|
}
|
|
321
|
-
)
|
|
321
|
+
);
|
|
322
322
|
```
|
|
323
323
|
|
|
324
324
|
We also provided a `overrides` options in each integration to make it easier:
|
|
325
325
|
|
|
326
326
|
```js
|
|
327
327
|
// eslint.config.js
|
|
328
|
-
import luxass from
|
|
328
|
+
import luxass from "@luxass/eslint-config";
|
|
329
329
|
|
|
330
330
|
export default luxass({
|
|
331
331
|
vue: {
|
|
332
332
|
overrides: {
|
|
333
|
-
|
|
333
|
+
"vue/operator-linebreak": ["error", "before"],
|
|
334
334
|
},
|
|
335
335
|
},
|
|
336
336
|
typescript: {
|
|
337
337
|
overrides: {
|
|
338
|
-
|
|
338
|
+
"ts/consistent-type-definitions": ["error", "interface"],
|
|
339
339
|
},
|
|
340
340
|
},
|
|
341
341
|
yaml: {
|
|
@@ -343,7 +343,7 @@ export default luxass({
|
|
|
343
343
|
// ...
|
|
344
344
|
},
|
|
345
345
|
},
|
|
346
|
-
})
|
|
346
|
+
});
|
|
347
347
|
```
|
|
348
348
|
|
|
349
349
|
### Config Composer
|
|
@@ -352,7 +352,7 @@ Since v4.3.0, the factory function `luxass()` returns a [`FlatConfigComposer` ob
|
|
|
352
352
|
|
|
353
353
|
```js
|
|
354
354
|
// eslint.config.js
|
|
355
|
-
import luxass from
|
|
355
|
+
import luxass from "@luxass/eslint-config";
|
|
356
356
|
|
|
357
357
|
export default luxass()
|
|
358
358
|
.prepend(
|
|
@@ -360,18 +360,18 @@ export default luxass()
|
|
|
360
360
|
)
|
|
361
361
|
// overrides any named configs
|
|
362
362
|
.override(
|
|
363
|
-
|
|
363
|
+
"luxass/imports",
|
|
364
364
|
{
|
|
365
365
|
rules: {
|
|
366
|
-
|
|
366
|
+
"import/order": ["error", { "newlines-between": "always" }],
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
369
|
)
|
|
370
370
|
// rename plugin prefixes
|
|
371
371
|
.renamePlugins({
|
|
372
|
-
|
|
372
|
+
"old-prefix": "new-prefix",
|
|
373
373
|
// ...
|
|
374
|
-
})
|
|
374
|
+
});
|
|
375
375
|
// ...
|
|
376
376
|
```
|
|
377
377
|
|
|
@@ -385,7 +385,7 @@ Use external formatters to format files that ESLint cannot handle yet (`.css`, `
|
|
|
385
385
|
|
|
386
386
|
```js
|
|
387
387
|
// eslint.config.js
|
|
388
|
-
import luxass from
|
|
388
|
+
import luxass from "@luxass/eslint-config";
|
|
389
389
|
|
|
390
390
|
export default luxass({
|
|
391
391
|
formatters: {
|
|
@@ -404,9 +404,9 @@ export default luxass({
|
|
|
404
404
|
* Supports Prettier and dprint
|
|
405
405
|
* By default uses Prettier
|
|
406
406
|
*/
|
|
407
|
-
markdown:
|
|
407
|
+
markdown: "prettier"
|
|
408
408
|
}
|
|
409
|
-
})
|
|
409
|
+
});
|
|
410
410
|
```
|
|
411
411
|
|
|
412
412
|
Running `npx eslint` should prompt you to install the required dependencies, otherwise, you can install them manually:
|
|
@@ -421,11 +421,11 @@ To enable React support, you need to explicitly turn it on:
|
|
|
421
421
|
|
|
422
422
|
```js
|
|
423
423
|
// eslint.config.js
|
|
424
|
-
import luxass from
|
|
424
|
+
import luxass from "@luxass/eslint-config";
|
|
425
425
|
|
|
426
426
|
export default luxass({
|
|
427
427
|
react: true,
|
|
428
|
-
})
|
|
428
|
+
});
|
|
429
429
|
```
|
|
430
430
|
|
|
431
431
|
Running `npx eslint` should prompt you to install the required dependencies, otherwise, you can install them manually:
|
|
@@ -440,11 +440,11 @@ To enable Astro support, you need to explicitly turn it on:
|
|
|
440
440
|
|
|
441
441
|
```js
|
|
442
442
|
// eslint.config.js
|
|
443
|
-
import luxass from
|
|
443
|
+
import luxass from "@luxass/eslint-config";
|
|
444
444
|
|
|
445
445
|
export default luxass({
|
|
446
446
|
astro: true,
|
|
447
|
-
})
|
|
447
|
+
});
|
|
448
448
|
```
|
|
449
449
|
|
|
450
450
|
Running `npx eslint` should prompt you to install the required dependencies, otherwise, you can install them manually:
|
|
@@ -459,11 +459,11 @@ To enable UnoCSS support, you need to explicitly turn it on:
|
|
|
459
459
|
|
|
460
460
|
```js
|
|
461
461
|
// eslint.config.js
|
|
462
|
-
import luxass from
|
|
462
|
+
import luxass from "@luxass/eslint-config";
|
|
463
463
|
|
|
464
464
|
export default luxass({
|
|
465
465
|
unocss: true,
|
|
466
|
-
})
|
|
466
|
+
});
|
|
467
467
|
```
|
|
468
468
|
|
|
469
469
|
Running `npx eslint` should prompt you to install the required dependencies, otherwise, you can install them manually:
|
|
@@ -478,11 +478,11 @@ To enable TailwindCSS support, need to explicitly turn it on:
|
|
|
478
478
|
|
|
479
479
|
```js
|
|
480
480
|
// eslint.config.js
|
|
481
|
-
import luxass from
|
|
481
|
+
import luxass from "@luxass/eslint-config";
|
|
482
482
|
|
|
483
483
|
export default luxass({
|
|
484
484
|
tailwindcss: true,
|
|
485
|
-
})
|
|
485
|
+
});
|
|
486
486
|
```
|
|
487
487
|
|
|
488
488
|
Running `npx eslint` should prompt you to install the required dependencies, otherwise, you can install them manually:
|
|
@@ -501,13 +501,13 @@ You can optionally enable the [type aware rules](https://typescript-eslint.io/li
|
|
|
501
501
|
|
|
502
502
|
```js
|
|
503
503
|
// eslint.config.js
|
|
504
|
-
import luxass from
|
|
504
|
+
import luxass from "@luxass/eslint-config";
|
|
505
505
|
|
|
506
506
|
export default luxass({
|
|
507
507
|
typescript: {
|
|
508
|
-
tsconfigPath:
|
|
508
|
+
tsconfigPath: "tsconfig.json",
|
|
509
509
|
},
|
|
510
|
-
})
|
|
510
|
+
});
|
|
511
511
|
```
|
|
512
512
|
|
|
513
513
|
### Editor Specific Disables
|
|
@@ -518,11 +518,11 @@ This is to prevent unused imports from getting removed by the IDE during refacto
|
|
|
518
518
|
|
|
519
519
|
```js
|
|
520
520
|
// eslint.config.js
|
|
521
|
-
import luxass from
|
|
521
|
+
import luxass from "@luxass/eslint-config";
|
|
522
522
|
|
|
523
523
|
export default luxass({
|
|
524
524
|
editor: false
|
|
525
|
-
})
|
|
525
|
+
});
|
|
526
526
|
```
|
|
527
527
|
|
|
528
528
|
### Lint Staged
|