@antfu/eslint-config 2.14.0 → 2.16.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 +28 -11
- package/dist/cli.cjs +29 -28
- package/dist/cli.js +29 -28
- package/dist/index.cjs +923 -847
- package/dist/index.d.cts +215 -836
- package/dist/index.d.ts +215 -836
- package/dist/index.js +922 -847
- package/package.json +28 -28
package/README.md
CHANGED
|
@@ -471,7 +471,7 @@ export default antfu({
|
|
|
471
471
|
Running `npx eslint` should prompt you to install the required dependencies, otherwise, you can install them manually:
|
|
472
472
|
|
|
473
473
|
```bash
|
|
474
|
-
npm i -D eslint-plugin
|
|
474
|
+
npm i -D @eslint-react/eslint-plugin eslint-plugin-react-hooks eslint-plugin-react-refresh
|
|
475
475
|
```
|
|
476
476
|
|
|
477
477
|
#### Svelte
|
|
@@ -554,23 +554,40 @@ npm i -D @unocss/eslint-plugin
|
|
|
554
554
|
|
|
555
555
|
This config also provides some optional plugins/rules for extended usage.
|
|
556
556
|
|
|
557
|
-
#### `
|
|
557
|
+
#### `command`
|
|
558
558
|
|
|
559
|
-
|
|
559
|
+
Powered by [`eslint-plugin-command`](https://github.com/antfu/eslint-plugin-command). It is not a typical rule for linting, but an on-demand micro-codemod tool that triggers by specific comments.
|
|
560
560
|
|
|
561
|
-
|
|
561
|
+
For a few triggers, for example:
|
|
562
562
|
|
|
563
|
-
|
|
563
|
+
- `/// to-function` - converts an arrow function to a normal function
|
|
564
|
+
- `/// to-arrow` - converts a normal function to an arrow function
|
|
565
|
+
- `/// to-for-each` - converts a for-in/for-of loop to `.forEach()`
|
|
566
|
+
- `/// to-for-of` - converts a `.forEach()` to a for-of loop
|
|
567
|
+
- `/// keep-sorted` - sorts an object/array/interface
|
|
568
|
+
- ... etc. - refer to the [documentation](https://github.com/antfu/eslint-plugin-command#built-in-commands)
|
|
564
569
|
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
570
|
+
You can add the trigger comment one line above the code you want to transform, for example (note the triple slash):
|
|
571
|
+
|
|
572
|
+
<!-- eslint-skip -->
|
|
573
|
+
|
|
574
|
+
```ts
|
|
575
|
+
/// to-function
|
|
576
|
+
const foo = async (msg: string): void => {
|
|
577
|
+
console.log(msg)
|
|
578
|
+
}
|
|
579
|
+
```
|
|
580
|
+
|
|
581
|
+
Will be transformed to this when you hit save with your editor or run `eslint . --fix`:
|
|
582
|
+
|
|
583
|
+
```ts
|
|
584
|
+
async function foo(msg: string): void {
|
|
585
|
+
console.log(msg)
|
|
571
586
|
}
|
|
572
587
|
```
|
|
573
588
|
|
|
589
|
+
The command comments are usually one-off and will be removed along with the transformation.
|
|
590
|
+
|
|
574
591
|
### Type Aware Rules
|
|
575
592
|
|
|
576
593
|
You can optionally enable the [type aware rules](https://typescript-eslint.io/linting/typed-linting/) by passing the options object to the `typescript` config:
|
package/dist/cli.cjs
CHANGED
|
@@ -48,8 +48,8 @@ var import_picocolors = __toESM(require("picocolors"), 1);
|
|
|
48
48
|
var package_default = {
|
|
49
49
|
name: "@antfu/eslint-config",
|
|
50
50
|
type: "module",
|
|
51
|
-
version: "2.
|
|
52
|
-
packageManager: "pnpm@
|
|
51
|
+
version: "2.16.0",
|
|
52
|
+
packageManager: "pnpm@9.0.6",
|
|
53
53
|
description: "Anthony's ESLint config",
|
|
54
54
|
author: "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
|
|
55
55
|
license: "MIT",
|
|
@@ -86,12 +86,12 @@ var package_default = {
|
|
|
86
86
|
prepare: "simple-git-hooks"
|
|
87
87
|
},
|
|
88
88
|
peerDependencies: {
|
|
89
|
+
"@eslint-react/eslint-plugin": "^1.5.8",
|
|
89
90
|
"@unocss/eslint-plugin": ">=0.50.0",
|
|
90
91
|
"astro-eslint-parser": "^0.16.3",
|
|
91
92
|
eslint: ">=8.40.0",
|
|
92
93
|
"eslint-plugin-astro": "^0.31.4",
|
|
93
94
|
"eslint-plugin-format": ">=0.1.0",
|
|
94
|
-
"eslint-plugin-react": "^7.33.2",
|
|
95
95
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
96
96
|
"eslint-plugin-react-refresh": "^0.4.4",
|
|
97
97
|
"eslint-plugin-solid": "^0.13.2",
|
|
@@ -101,6 +101,9 @@ var package_default = {
|
|
|
101
101
|
"svelte-eslint-parser": "^0.33.1"
|
|
102
102
|
},
|
|
103
103
|
peerDependenciesMeta: {
|
|
104
|
+
"@eslint-react/eslint-plugin": {
|
|
105
|
+
optional: true
|
|
106
|
+
},
|
|
104
107
|
"@unocss/eslint-plugin": {
|
|
105
108
|
optional: true
|
|
106
109
|
},
|
|
@@ -113,9 +116,6 @@ var package_default = {
|
|
|
113
116
|
"eslint-plugin-format": {
|
|
114
117
|
optional: true
|
|
115
118
|
},
|
|
116
|
-
"eslint-plugin-react": {
|
|
117
|
-
optional: true
|
|
118
|
-
},
|
|
119
119
|
"eslint-plugin-react-hooks": {
|
|
120
120
|
optional: true
|
|
121
121
|
},
|
|
@@ -141,28 +141,29 @@ var package_default = {
|
|
|
141
141
|
dependencies: {
|
|
142
142
|
"@antfu/install-pkg": "^0.3.2",
|
|
143
143
|
"@clack/prompts": "^0.7.0",
|
|
144
|
-
"@stylistic/eslint-plugin": "^1.7.
|
|
145
|
-
"@typescript-eslint/eslint-plugin": "^7.
|
|
146
|
-
"@typescript-eslint/parser": "^7.
|
|
144
|
+
"@stylistic/eslint-plugin": "^1.7.2",
|
|
145
|
+
"@typescript-eslint/eslint-plugin": "^7.7.1",
|
|
146
|
+
"@typescript-eslint/parser": "^7.7.1",
|
|
147
147
|
"eslint-config-flat-gitignore": "^0.1.5",
|
|
148
148
|
"eslint-flat-config-utils": "^0.2.3",
|
|
149
149
|
"eslint-merge-processors": "^0.1.0",
|
|
150
150
|
"eslint-plugin-antfu": "^2.1.2",
|
|
151
|
+
"eslint-plugin-command": "^0.1.2",
|
|
151
152
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
152
153
|
"eslint-plugin-import-x": "^0.5.0",
|
|
153
154
|
"eslint-plugin-jsdoc": "^48.2.3",
|
|
154
155
|
"eslint-plugin-jsonc": "^2.15.1",
|
|
155
156
|
"eslint-plugin-markdown": "^4.0.1",
|
|
156
|
-
"eslint-plugin-n": "^17.
|
|
157
|
+
"eslint-plugin-n": "^17.3.1",
|
|
157
158
|
"eslint-plugin-no-only-tests": "^3.1.0",
|
|
158
|
-
"eslint-plugin-perfectionist": "^2.
|
|
159
|
+
"eslint-plugin-perfectionist": "^2.10.0",
|
|
159
160
|
"eslint-plugin-toml": "^0.11.0",
|
|
160
161
|
"eslint-plugin-unicorn": "^52.0.0",
|
|
161
162
|
"eslint-plugin-unused-imports": "^3.1.0",
|
|
162
|
-
"eslint-plugin-vitest": "^0.5.
|
|
163
|
+
"eslint-plugin-vitest": "^0.5.4",
|
|
163
164
|
"eslint-plugin-vue": "^9.25.0",
|
|
164
165
|
"eslint-plugin-yml": "^1.14.0",
|
|
165
|
-
"eslint-processor-vue-blocks": "^0.1.
|
|
166
|
+
"eslint-processor-vue-blocks": "^0.1.2",
|
|
166
167
|
globals: "^15.0.0",
|
|
167
168
|
"jsonc-eslint-parser": "^2.4.0",
|
|
168
169
|
"local-pkg": "^0.5.0",
|
|
@@ -177,26 +178,26 @@ var package_default = {
|
|
|
177
178
|
"@antfu/eslint-config": "workspace:*",
|
|
178
179
|
"@antfu/eslint-plugin-prettier": "^5.0.1-1",
|
|
179
180
|
"@antfu/ni": "^0.21.12",
|
|
180
|
-
"@eslint/
|
|
181
|
-
"@
|
|
182
|
-
"@
|
|
181
|
+
"@eslint-react/eslint-plugin": "^1.5.9",
|
|
182
|
+
"@eslint/config-inspector": "^0.4.7",
|
|
183
|
+
"@stylistic/eslint-plugin-migrate": "^1.7.2",
|
|
184
|
+
"@types/eslint": "^8.56.10",
|
|
183
185
|
"@types/fs-extra": "^11.0.4",
|
|
184
186
|
"@types/node": "^20.12.7",
|
|
185
187
|
"@types/prompts": "^2.4.9",
|
|
186
188
|
"@types/yargs": "^17.0.32",
|
|
187
|
-
"@unocss/eslint-plugin": "^0.59.
|
|
189
|
+
"@unocss/eslint-plugin": "^0.59.4",
|
|
188
190
|
"astro-eslint-parser": "^0.17.0",
|
|
189
191
|
bumpp: "^9.4.0",
|
|
190
|
-
"bundle-require": "^4.0.
|
|
191
|
-
eslint: "^9.
|
|
192
|
+
"bundle-require": "^4.0.3",
|
|
193
|
+
eslint: "^9.1.1",
|
|
192
194
|
"eslint-plugin-astro": "^0.34.0",
|
|
193
|
-
"eslint-plugin-format": "^0.1.
|
|
194
|
-
"eslint-plugin-react": "^
|
|
195
|
-
"eslint-plugin-react-hooks": "^4.6.0",
|
|
195
|
+
"eslint-plugin-format": "^0.1.1",
|
|
196
|
+
"eslint-plugin-react-hooks": "^4.6.1",
|
|
196
197
|
"eslint-plugin-react-refresh": "^0.4.6",
|
|
197
198
|
"eslint-plugin-solid": "^0.13.2",
|
|
198
199
|
"eslint-plugin-svelte": "2.36.0-next.13",
|
|
199
|
-
"eslint-typegen": "^0.2.
|
|
200
|
+
"eslint-typegen": "^0.2.4",
|
|
200
201
|
esno: "^4.7.0",
|
|
201
202
|
execa: "^8.0.1",
|
|
202
203
|
"fast-glob": "^3.3.2",
|
|
@@ -206,12 +207,12 @@ var package_default = {
|
|
|
206
207
|
"prettier-plugin-slidev": "^1.0.5",
|
|
207
208
|
rimraf: "^5.0.5",
|
|
208
209
|
"simple-git-hooks": "^2.11.1",
|
|
209
|
-
svelte: "^4.2.
|
|
210
|
-
"svelte-eslint-parser": "^0.
|
|
210
|
+
svelte: "^4.2.15",
|
|
211
|
+
"svelte-eslint-parser": "^0.35.0",
|
|
211
212
|
tsup: "^8.0.2",
|
|
212
213
|
typescript: "^5.4.5",
|
|
213
|
-
vitest: "^1.5.
|
|
214
|
-
vue: "^3.4.
|
|
214
|
+
vitest: "^1.5.2",
|
|
215
|
+
vue: "^3.4.25"
|
|
215
216
|
},
|
|
216
217
|
"simple-git-hooks": {
|
|
217
218
|
"pre-commit": "pnpm lint-staged"
|
|
@@ -311,7 +312,7 @@ var dependenciesMap = {
|
|
|
311
312
|
"astro-eslint-parser"
|
|
312
313
|
],
|
|
313
314
|
react: [
|
|
314
|
-
"eslint-plugin
|
|
315
|
+
"@eslint-react/eslint-plugin",
|
|
315
316
|
"eslint-plugin-react-hooks",
|
|
316
317
|
"eslint-plugin-react-refresh"
|
|
317
318
|
],
|
package/dist/cli.js
CHANGED
|
@@ -19,8 +19,8 @@ import c from "picocolors";
|
|
|
19
19
|
var package_default = {
|
|
20
20
|
name: "@antfu/eslint-config",
|
|
21
21
|
type: "module",
|
|
22
|
-
version: "2.
|
|
23
|
-
packageManager: "pnpm@
|
|
22
|
+
version: "2.16.0",
|
|
23
|
+
packageManager: "pnpm@9.0.6",
|
|
24
24
|
description: "Anthony's ESLint config",
|
|
25
25
|
author: "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
|
|
26
26
|
license: "MIT",
|
|
@@ -57,12 +57,12 @@ var package_default = {
|
|
|
57
57
|
prepare: "simple-git-hooks"
|
|
58
58
|
},
|
|
59
59
|
peerDependencies: {
|
|
60
|
+
"@eslint-react/eslint-plugin": "^1.5.8",
|
|
60
61
|
"@unocss/eslint-plugin": ">=0.50.0",
|
|
61
62
|
"astro-eslint-parser": "^0.16.3",
|
|
62
63
|
eslint: ">=8.40.0",
|
|
63
64
|
"eslint-plugin-astro": "^0.31.4",
|
|
64
65
|
"eslint-plugin-format": ">=0.1.0",
|
|
65
|
-
"eslint-plugin-react": "^7.33.2",
|
|
66
66
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
67
67
|
"eslint-plugin-react-refresh": "^0.4.4",
|
|
68
68
|
"eslint-plugin-solid": "^0.13.2",
|
|
@@ -72,6 +72,9 @@ var package_default = {
|
|
|
72
72
|
"svelte-eslint-parser": "^0.33.1"
|
|
73
73
|
},
|
|
74
74
|
peerDependenciesMeta: {
|
|
75
|
+
"@eslint-react/eslint-plugin": {
|
|
76
|
+
optional: true
|
|
77
|
+
},
|
|
75
78
|
"@unocss/eslint-plugin": {
|
|
76
79
|
optional: true
|
|
77
80
|
},
|
|
@@ -84,9 +87,6 @@ var package_default = {
|
|
|
84
87
|
"eslint-plugin-format": {
|
|
85
88
|
optional: true
|
|
86
89
|
},
|
|
87
|
-
"eslint-plugin-react": {
|
|
88
|
-
optional: true
|
|
89
|
-
},
|
|
90
90
|
"eslint-plugin-react-hooks": {
|
|
91
91
|
optional: true
|
|
92
92
|
},
|
|
@@ -112,28 +112,29 @@ var package_default = {
|
|
|
112
112
|
dependencies: {
|
|
113
113
|
"@antfu/install-pkg": "^0.3.2",
|
|
114
114
|
"@clack/prompts": "^0.7.0",
|
|
115
|
-
"@stylistic/eslint-plugin": "^1.7.
|
|
116
|
-
"@typescript-eslint/eslint-plugin": "^7.
|
|
117
|
-
"@typescript-eslint/parser": "^7.
|
|
115
|
+
"@stylistic/eslint-plugin": "^1.7.2",
|
|
116
|
+
"@typescript-eslint/eslint-plugin": "^7.7.1",
|
|
117
|
+
"@typescript-eslint/parser": "^7.7.1",
|
|
118
118
|
"eslint-config-flat-gitignore": "^0.1.5",
|
|
119
119
|
"eslint-flat-config-utils": "^0.2.3",
|
|
120
120
|
"eslint-merge-processors": "^0.1.0",
|
|
121
121
|
"eslint-plugin-antfu": "^2.1.2",
|
|
122
|
+
"eslint-plugin-command": "^0.1.2",
|
|
122
123
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
123
124
|
"eslint-plugin-import-x": "^0.5.0",
|
|
124
125
|
"eslint-plugin-jsdoc": "^48.2.3",
|
|
125
126
|
"eslint-plugin-jsonc": "^2.15.1",
|
|
126
127
|
"eslint-plugin-markdown": "^4.0.1",
|
|
127
|
-
"eslint-plugin-n": "^17.
|
|
128
|
+
"eslint-plugin-n": "^17.3.1",
|
|
128
129
|
"eslint-plugin-no-only-tests": "^3.1.0",
|
|
129
|
-
"eslint-plugin-perfectionist": "^2.
|
|
130
|
+
"eslint-plugin-perfectionist": "^2.10.0",
|
|
130
131
|
"eslint-plugin-toml": "^0.11.0",
|
|
131
132
|
"eslint-plugin-unicorn": "^52.0.0",
|
|
132
133
|
"eslint-plugin-unused-imports": "^3.1.0",
|
|
133
|
-
"eslint-plugin-vitest": "^0.5.
|
|
134
|
+
"eslint-plugin-vitest": "^0.5.4",
|
|
134
135
|
"eslint-plugin-vue": "^9.25.0",
|
|
135
136
|
"eslint-plugin-yml": "^1.14.0",
|
|
136
|
-
"eslint-processor-vue-blocks": "^0.1.
|
|
137
|
+
"eslint-processor-vue-blocks": "^0.1.2",
|
|
137
138
|
globals: "^15.0.0",
|
|
138
139
|
"jsonc-eslint-parser": "^2.4.0",
|
|
139
140
|
"local-pkg": "^0.5.0",
|
|
@@ -148,26 +149,26 @@ var package_default = {
|
|
|
148
149
|
"@antfu/eslint-config": "workspace:*",
|
|
149
150
|
"@antfu/eslint-plugin-prettier": "^5.0.1-1",
|
|
150
151
|
"@antfu/ni": "^0.21.12",
|
|
151
|
-
"@eslint/
|
|
152
|
-
"@
|
|
153
|
-
"@
|
|
152
|
+
"@eslint-react/eslint-plugin": "^1.5.9",
|
|
153
|
+
"@eslint/config-inspector": "^0.4.7",
|
|
154
|
+
"@stylistic/eslint-plugin-migrate": "^1.7.2",
|
|
155
|
+
"@types/eslint": "^8.56.10",
|
|
154
156
|
"@types/fs-extra": "^11.0.4",
|
|
155
157
|
"@types/node": "^20.12.7",
|
|
156
158
|
"@types/prompts": "^2.4.9",
|
|
157
159
|
"@types/yargs": "^17.0.32",
|
|
158
|
-
"@unocss/eslint-plugin": "^0.59.
|
|
160
|
+
"@unocss/eslint-plugin": "^0.59.4",
|
|
159
161
|
"astro-eslint-parser": "^0.17.0",
|
|
160
162
|
bumpp: "^9.4.0",
|
|
161
|
-
"bundle-require": "^4.0.
|
|
162
|
-
eslint: "^9.
|
|
163
|
+
"bundle-require": "^4.0.3",
|
|
164
|
+
eslint: "^9.1.1",
|
|
163
165
|
"eslint-plugin-astro": "^0.34.0",
|
|
164
|
-
"eslint-plugin-format": "^0.1.
|
|
165
|
-
"eslint-plugin-react": "^
|
|
166
|
-
"eslint-plugin-react-hooks": "^4.6.0",
|
|
166
|
+
"eslint-plugin-format": "^0.1.1",
|
|
167
|
+
"eslint-plugin-react-hooks": "^4.6.1",
|
|
167
168
|
"eslint-plugin-react-refresh": "^0.4.6",
|
|
168
169
|
"eslint-plugin-solid": "^0.13.2",
|
|
169
170
|
"eslint-plugin-svelte": "2.36.0-next.13",
|
|
170
|
-
"eslint-typegen": "^0.2.
|
|
171
|
+
"eslint-typegen": "^0.2.4",
|
|
171
172
|
esno: "^4.7.0",
|
|
172
173
|
execa: "^8.0.1",
|
|
173
174
|
"fast-glob": "^3.3.2",
|
|
@@ -177,12 +178,12 @@ var package_default = {
|
|
|
177
178
|
"prettier-plugin-slidev": "^1.0.5",
|
|
178
179
|
rimraf: "^5.0.5",
|
|
179
180
|
"simple-git-hooks": "^2.11.1",
|
|
180
|
-
svelte: "^4.2.
|
|
181
|
-
"svelte-eslint-parser": "^0.
|
|
181
|
+
svelte: "^4.2.15",
|
|
182
|
+
"svelte-eslint-parser": "^0.35.0",
|
|
182
183
|
tsup: "^8.0.2",
|
|
183
184
|
typescript: "^5.4.5",
|
|
184
|
-
vitest: "^1.5.
|
|
185
|
-
vue: "^3.4.
|
|
185
|
+
vitest: "^1.5.2",
|
|
186
|
+
vue: "^3.4.25"
|
|
186
187
|
},
|
|
187
188
|
"simple-git-hooks": {
|
|
188
189
|
"pre-commit": "pnpm lint-staged"
|
|
@@ -282,7 +283,7 @@ var dependenciesMap = {
|
|
|
282
283
|
"astro-eslint-parser"
|
|
283
284
|
],
|
|
284
285
|
react: [
|
|
285
|
-
"eslint-plugin
|
|
286
|
+
"@eslint-react/eslint-plugin",
|
|
286
287
|
"eslint-plugin-react-hooks",
|
|
287
288
|
"eslint-plugin-react-refresh"
|
|
288
289
|
],
|