@antfu/eslint-config 2.2.0 → 2.2.2
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 +2 -35
- package/dist/cli.cjs +6 -5
- package/dist/cli.js +6 -5
- package/dist/index.cjs +1 -4
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +1 -4
- package/package.json +11 -11
package/README.md
CHANGED
|
@@ -313,7 +313,7 @@ export default antfu(
|
|
|
313
313
|
)
|
|
314
314
|
```
|
|
315
315
|
|
|
316
|
-
We also provided
|
|
316
|
+
We also provided an `overrides` options to make it easier:
|
|
317
317
|
|
|
318
318
|
```js
|
|
319
319
|
// eslint.config.js
|
|
@@ -337,33 +337,6 @@ export default antfu({
|
|
|
337
337
|
|
|
338
338
|
We provide some optional configs for specific use cases, that we don't include their dependencies by default.
|
|
339
339
|
|
|
340
|
-
#### Prettier
|
|
341
|
-
|
|
342
|
-
ESLint is mainly forced on JavaScript. It can support other languages with custom parsers, but that requires a lot of effort to rule parsers and rules to build ecosystems around them. For example, ESLint does not handle CSS and HTML at this moment. It has been a shame for a long time. But since Prettier supports wider range of languages, why don't we use Prettier for them?
|
|
343
|
-
|
|
344
|
-
> [!WARNING]
|
|
345
|
-
> This is experiemental :)
|
|
346
|
-
|
|
347
|
-
To enable Prettier support, you need to explicitly turn it on and specify the languages you want to handle:
|
|
348
|
-
|
|
349
|
-
```js
|
|
350
|
-
// eslint.config.js
|
|
351
|
-
import antfu from '@antfu/eslint-config'
|
|
352
|
-
|
|
353
|
-
export default antfu({
|
|
354
|
-
prettier: {
|
|
355
|
-
css: true, // Let Prettier handles CSS, LESS, SCSS, etc
|
|
356
|
-
html: true, // Let Prettier handles HTML
|
|
357
|
-
}
|
|
358
|
-
})
|
|
359
|
-
```
|
|
360
|
-
|
|
361
|
-
Running `npx eslint` should prompt you to install the required dependencies, otherwise, you can install them manually:
|
|
362
|
-
|
|
363
|
-
```bash
|
|
364
|
-
npm i -D eslint-plugin-prettier prettier
|
|
365
|
-
```
|
|
366
|
-
|
|
367
340
|
#### React
|
|
368
341
|
|
|
369
342
|
To enable React support you need to explicitly turn it on:
|
|
@@ -503,15 +476,9 @@ If you enjoy this code style, and would like to mention it in your project, here
|
|
|
503
476
|
|
|
504
477
|
[Why I don't use Prettier](https://antfu.me/posts/why-not-prettier)
|
|
505
478
|
|
|
506
|
-
Well, on the other hand, you can [use still Prettier to handle CSS and HTML formatting](#prettier), which is not yet supported by ESLint.
|
|
507
|
-
|
|
508
479
|
### How to format CSS?
|
|
509
480
|
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
Yes, we do now! See [Prettier](#prettier) section for more details.
|
|
513
|
-
|
|
514
|
-
For better linting, we recommend trying [stylelint](https://stylelint.io/).
|
|
481
|
+
This config does NOT lint CSS. I personally use [UnoCSS](https://github.com/unocss/unocss) so I don't write CSS. For better linting, we recommend trying [stylelint](https://stylelint.io/).
|
|
515
482
|
|
|
516
483
|
### I prefer XXX...
|
|
517
484
|
|
package/dist/cli.cjs
CHANGED
|
@@ -46,7 +46,7 @@ var import_parse_gitignore = __toESM(require("parse-gitignore"), 1);
|
|
|
46
46
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
47
47
|
|
|
48
48
|
// package.json
|
|
49
|
-
var version = "2.2.
|
|
49
|
+
var version = "2.2.2";
|
|
50
50
|
var devDependencies = {
|
|
51
51
|
"@antfu/eslint-config": "workspace:*",
|
|
52
52
|
"@antfu/eslint-plugin-prettier": "^5.0.1-1",
|
|
@@ -54,16 +54,16 @@ var devDependencies = {
|
|
|
54
54
|
"@stylistic/eslint-plugin-migrate": "^1.4.1",
|
|
55
55
|
"@types/eslint": "^8.44.8",
|
|
56
56
|
"@types/fs-extra": "^11.0.4",
|
|
57
|
-
"@types/node": "^20.10.
|
|
57
|
+
"@types/node": "^20.10.2",
|
|
58
58
|
"@types/prompts": "^2.4.9",
|
|
59
59
|
"@types/yargs": "^17.0.32",
|
|
60
|
-
"@unocss/eslint-plugin": "^0.
|
|
60
|
+
"@unocss/eslint-plugin": "^0.58.0",
|
|
61
61
|
bumpp: "^9.2.0",
|
|
62
|
-
eslint: "^8.
|
|
62
|
+
eslint: "^8.55.0",
|
|
63
63
|
"eslint-flat-config-viewer": "^0.1.3",
|
|
64
64
|
"eslint-plugin-react": "^7.33.2",
|
|
65
65
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
66
|
-
"eslint-plugin-react-refresh": "^0.4.
|
|
66
|
+
"eslint-plugin-react-refresh": "^0.4.5",
|
|
67
67
|
esno: "^4.0.0",
|
|
68
68
|
execa: "^8.0.1",
|
|
69
69
|
"fast-glob": "^3.3.2",
|
|
@@ -99,6 +99,7 @@ var vscodeSettingsString = `
|
|
|
99
99
|
// Silent the stylistic rules in you IDE, but still auto fix them
|
|
100
100
|
"eslint.rules.customizations": [
|
|
101
101
|
{ "rule": "style/*", "severity": "off" },
|
|
102
|
+
{ "rule": "prettier/*", "severity": "off" },
|
|
102
103
|
{ "rule": "*-indent", "severity": "off" },
|
|
103
104
|
{ "rule": "*-spacing", "severity": "off" },
|
|
104
105
|
{ "rule": "*-spaces", "severity": "off" },
|
package/dist/cli.js
CHANGED
|
@@ -17,7 +17,7 @@ import parse from "parse-gitignore";
|
|
|
17
17
|
import c from "picocolors";
|
|
18
18
|
|
|
19
19
|
// package.json
|
|
20
|
-
var version = "2.2.
|
|
20
|
+
var version = "2.2.2";
|
|
21
21
|
var devDependencies = {
|
|
22
22
|
"@antfu/eslint-config": "workspace:*",
|
|
23
23
|
"@antfu/eslint-plugin-prettier": "^5.0.1-1",
|
|
@@ -25,16 +25,16 @@ var devDependencies = {
|
|
|
25
25
|
"@stylistic/eslint-plugin-migrate": "^1.4.1",
|
|
26
26
|
"@types/eslint": "^8.44.8",
|
|
27
27
|
"@types/fs-extra": "^11.0.4",
|
|
28
|
-
"@types/node": "^20.10.
|
|
28
|
+
"@types/node": "^20.10.2",
|
|
29
29
|
"@types/prompts": "^2.4.9",
|
|
30
30
|
"@types/yargs": "^17.0.32",
|
|
31
|
-
"@unocss/eslint-plugin": "^0.
|
|
31
|
+
"@unocss/eslint-plugin": "^0.58.0",
|
|
32
32
|
bumpp: "^9.2.0",
|
|
33
|
-
eslint: "^8.
|
|
33
|
+
eslint: "^8.55.0",
|
|
34
34
|
"eslint-flat-config-viewer": "^0.1.3",
|
|
35
35
|
"eslint-plugin-react": "^7.33.2",
|
|
36
36
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
37
|
-
"eslint-plugin-react-refresh": "^0.4.
|
|
37
|
+
"eslint-plugin-react-refresh": "^0.4.5",
|
|
38
38
|
esno: "^4.0.0",
|
|
39
39
|
execa: "^8.0.1",
|
|
40
40
|
"fast-glob": "^3.3.2",
|
|
@@ -70,6 +70,7 @@ var vscodeSettingsString = `
|
|
|
70
70
|
// Silent the stylistic rules in you IDE, but still auto fix them
|
|
71
71
|
"eslint.rules.customizations": [
|
|
72
72
|
{ "rule": "style/*", "severity": "off" },
|
|
73
|
+
{ "rule": "prettier/*", "severity": "off" },
|
|
73
74
|
{ "rule": "*-indent", "severity": "off" },
|
|
74
75
|
{ "rule": "*-spacing", "severity": "off" },
|
|
75
76
|
{ "rule": "*-spaces", "severity": "off" },
|
package/dist/index.cjs
CHANGED
|
@@ -629,7 +629,6 @@ async function markdown(options = {}) {
|
|
|
629
629
|
},
|
|
630
630
|
name: "antfu:markdown:disables",
|
|
631
631
|
rules: {
|
|
632
|
-
"antfu/no-ts-export-equal": "off",
|
|
633
632
|
"import/newline-after-import": "off",
|
|
634
633
|
"no-alert": "off",
|
|
635
634
|
"no-console": "off",
|
|
@@ -749,7 +748,6 @@ async function stylistic(options = {}) {
|
|
|
749
748
|
...config.rules,
|
|
750
749
|
"antfu/consistent-list-newline": "error",
|
|
751
750
|
"antfu/if-newline": "error",
|
|
752
|
-
"antfu/indent-binary-ops": ["error", { indent }],
|
|
753
751
|
"antfu/top-level-function": "error",
|
|
754
752
|
"curly": ["error", "multi-or-nest", "consistent"]
|
|
755
753
|
}
|
|
@@ -759,6 +757,7 @@ async function stylistic(options = {}) {
|
|
|
759
757
|
|
|
760
758
|
// src/configs/prettier.ts
|
|
761
759
|
async function prettier(options = {}, stylistic2 = {}) {
|
|
760
|
+
console.warn("@antfu/eslint-config: `prettier` option is deprecated, please do not use it anymore. We will find better formatters to support that in the future.");
|
|
762
761
|
await ensurePackages([
|
|
763
762
|
"@antfu/eslint-plugin-prettier"
|
|
764
763
|
]);
|
|
@@ -1262,8 +1261,6 @@ async function typescript(options = {}) {
|
|
|
1262
1261
|
"@typescript-eslint/",
|
|
1263
1262
|
"ts/"
|
|
1264
1263
|
),
|
|
1265
|
-
"antfu/generic-spacing": "error",
|
|
1266
|
-
"antfu/named-tuple-spacing": "error",
|
|
1267
1264
|
"no-dupe-class-members": "off",
|
|
1268
1265
|
"no-loss-of-precision": "off",
|
|
1269
1266
|
"no-redeclare": "off",
|
package/dist/index.d.cts
CHANGED
|
@@ -349,6 +349,9 @@ declare function node(): Promise<FlatConfigItem[]>;
|
|
|
349
349
|
*/
|
|
350
350
|
declare function perfectionist(): Promise<FlatConfigItem[]>;
|
|
351
351
|
|
|
352
|
+
/**
|
|
353
|
+
* @deprecated
|
|
354
|
+
*/
|
|
352
355
|
declare function prettier(options?: OptionsPrettier, stylistic?: StylisticConfig): Promise<FlatConfigItem[]>;
|
|
353
356
|
|
|
354
357
|
declare function react(options?: OptionsHasTypeScript & OptionsOverrides & OptionsFiles): Promise<FlatConfigItem[]>;
|
package/dist/index.d.ts
CHANGED
|
@@ -349,6 +349,9 @@ declare function node(): Promise<FlatConfigItem[]>;
|
|
|
349
349
|
*/
|
|
350
350
|
declare function perfectionist(): Promise<FlatConfigItem[]>;
|
|
351
351
|
|
|
352
|
+
/**
|
|
353
|
+
* @deprecated
|
|
354
|
+
*/
|
|
352
355
|
declare function prettier(options?: OptionsPrettier, stylistic?: StylisticConfig): Promise<FlatConfigItem[]>;
|
|
353
356
|
|
|
354
357
|
declare function react(options?: OptionsHasTypeScript & OptionsOverrides & OptionsFiles): Promise<FlatConfigItem[]>;
|
package/dist/index.js
CHANGED
|
@@ -543,7 +543,6 @@ async function markdown(options = {}) {
|
|
|
543
543
|
},
|
|
544
544
|
name: "antfu:markdown:disables",
|
|
545
545
|
rules: {
|
|
546
|
-
"antfu/no-ts-export-equal": "off",
|
|
547
546
|
"import/newline-after-import": "off",
|
|
548
547
|
"no-alert": "off",
|
|
549
548
|
"no-console": "off",
|
|
@@ -663,7 +662,6 @@ async function stylistic(options = {}) {
|
|
|
663
662
|
...config.rules,
|
|
664
663
|
"antfu/consistent-list-newline": "error",
|
|
665
664
|
"antfu/if-newline": "error",
|
|
666
|
-
"antfu/indent-binary-ops": ["error", { indent }],
|
|
667
665
|
"antfu/top-level-function": "error",
|
|
668
666
|
"curly": ["error", "multi-or-nest", "consistent"]
|
|
669
667
|
}
|
|
@@ -673,6 +671,7 @@ async function stylistic(options = {}) {
|
|
|
673
671
|
|
|
674
672
|
// src/configs/prettier.ts
|
|
675
673
|
async function prettier(options = {}, stylistic2 = {}) {
|
|
674
|
+
console.warn("@antfu/eslint-config: `prettier` option is deprecated, please do not use it anymore. We will find better formatters to support that in the future.");
|
|
676
675
|
await ensurePackages([
|
|
677
676
|
"@antfu/eslint-plugin-prettier"
|
|
678
677
|
]);
|
|
@@ -1176,8 +1175,6 @@ async function typescript(options = {}) {
|
|
|
1176
1175
|
"@typescript-eslint/",
|
|
1177
1176
|
"ts/"
|
|
1178
1177
|
),
|
|
1179
|
-
"antfu/generic-spacing": "error",
|
|
1180
|
-
"antfu/named-tuple-spacing": "error",
|
|
1181
1178
|
"no-dupe-class-members": "off",
|
|
1182
1179
|
"no-loss-of-precision": "off",
|
|
1183
1180
|
"no-redeclare": "off",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antfu/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.2.
|
|
4
|
+
"version": "2.2.2",
|
|
5
5
|
"packageManager": "pnpm@8.11.0",
|
|
6
6
|
"description": "Anthony's ESLint config",
|
|
7
7
|
"author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
|
|
@@ -51,16 +51,16 @@
|
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@antfu/eslint-define-config": "^1.23.0-2",
|
|
54
|
-
"@antfu/install-pkg": "^0.3.
|
|
54
|
+
"@antfu/install-pkg": "^0.3.1",
|
|
55
55
|
"@eslint-types/jsdoc": "46.8.2-1",
|
|
56
56
|
"@eslint-types/typescript-eslint": "^6.12.0",
|
|
57
57
|
"@eslint-types/unicorn": "^49.0.0",
|
|
58
|
-
"@stylistic/eslint-plugin": "^1.
|
|
58
|
+
"@stylistic/eslint-plugin": "^1.5.0-beta.0",
|
|
59
59
|
"@typescript-eslint/eslint-plugin": "^6.13.1",
|
|
60
60
|
"@typescript-eslint/parser": "^6.13.1",
|
|
61
|
-
"eslint-config-flat-gitignore": "^0.1.
|
|
61
|
+
"eslint-config-flat-gitignore": "^0.1.2",
|
|
62
62
|
"eslint-parser-plain": "^0.1.0",
|
|
63
|
-
"eslint-plugin-antfu": "^1.0.
|
|
63
|
+
"eslint-plugin-antfu": "^1.0.13",
|
|
64
64
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
65
65
|
"eslint-plugin-i": "^2.29.0",
|
|
66
66
|
"eslint-plugin-jsdoc": "^46.9.0",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"eslint-plugin-unicorn": "^49.0.0",
|
|
73
73
|
"eslint-plugin-unused-imports": "^3.0.0",
|
|
74
74
|
"eslint-plugin-vitest": "^0.3.10",
|
|
75
|
-
"eslint-plugin-vue": "^9.19.
|
|
75
|
+
"eslint-plugin-vue": "^9.19.2",
|
|
76
76
|
"eslint-plugin-yml": "^1.10.0",
|
|
77
77
|
"globals": "^13.23.0",
|
|
78
78
|
"jsonc-eslint-parser": "^2.4.0",
|
|
@@ -90,16 +90,16 @@
|
|
|
90
90
|
"@stylistic/eslint-plugin-migrate": "^1.4.1",
|
|
91
91
|
"@types/eslint": "^8.44.8",
|
|
92
92
|
"@types/fs-extra": "^11.0.4",
|
|
93
|
-
"@types/node": "^20.10.
|
|
93
|
+
"@types/node": "^20.10.2",
|
|
94
94
|
"@types/prompts": "^2.4.9",
|
|
95
95
|
"@types/yargs": "^17.0.32",
|
|
96
|
-
"@unocss/eslint-plugin": "^0.
|
|
96
|
+
"@unocss/eslint-plugin": "^0.58.0",
|
|
97
97
|
"bumpp": "^9.2.0",
|
|
98
|
-
"eslint": "^8.
|
|
98
|
+
"eslint": "^8.55.0",
|
|
99
99
|
"eslint-flat-config-viewer": "^0.1.3",
|
|
100
100
|
"eslint-plugin-react": "^7.33.2",
|
|
101
101
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
102
|
-
"eslint-plugin-react-refresh": "^0.4.
|
|
102
|
+
"eslint-plugin-react-refresh": "^0.4.5",
|
|
103
103
|
"esno": "^4.0.0",
|
|
104
104
|
"execa": "^8.0.1",
|
|
105
105
|
"fast-glob": "^3.3.2",
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"tsup": "^8.0.1",
|
|
111
111
|
"typescript": "^5.3.2",
|
|
112
112
|
"vitest": "^0.34.6",
|
|
113
|
-
"@antfu/eslint-config": "2.2.
|
|
113
|
+
"@antfu/eslint-config": "2.2.2"
|
|
114
114
|
},
|
|
115
115
|
"simple-git-hooks": {
|
|
116
116
|
"pre-commit": "pnpm lint-staged"
|