@antfu/eslint-config 2.15.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 +27 -10
- package/dist/cli.cjs +19 -18
- package/dist/cli.js +19 -18
- package/dist/index.cjs +1012 -970
- package/dist/index.d.cts +13 -11
- package/dist/index.d.ts +13 -11
- package/dist/index.js +1011 -970
- package/package.json +19 -18
package/README.md
CHANGED
|
@@ -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@9.0.
|
|
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",
|
|
@@ -142,24 +142,25 @@ var package_default = {
|
|
|
142
142
|
"@antfu/install-pkg": "^0.3.2",
|
|
143
143
|
"@clack/prompts": "^0.7.0",
|
|
144
144
|
"@stylistic/eslint-plugin": "^1.7.2",
|
|
145
|
-
"@typescript-eslint/eslint-plugin": "^7.7.
|
|
146
|
-
"@typescript-eslint/parser": "^7.7.
|
|
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
166
|
"eslint-processor-vue-blocks": "^0.1.2",
|
|
@@ -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-react/eslint-plugin": "^1.5.
|
|
181
|
-
"@eslint/config-inspector": "^0.4.
|
|
181
|
+
"@eslint-react/eslint-plugin": "^1.5.9",
|
|
182
|
+
"@eslint/config-inspector": "^0.4.7",
|
|
182
183
|
"@stylistic/eslint-plugin-migrate": "^1.7.2",
|
|
183
|
-
"@types/eslint": "^8.56.
|
|
184
|
+
"@types/eslint": "^8.56.10",
|
|
184
185
|
"@types/fs-extra": "^11.0.4",
|
|
185
186
|
"@types/node": "^20.12.7",
|
|
186
187
|
"@types/prompts": "^2.4.9",
|
|
187
188
|
"@types/yargs": "^17.0.32",
|
|
188
|
-
"@unocss/eslint-plugin": "^0.59.
|
|
189
|
+
"@unocss/eslint-plugin": "^0.59.4",
|
|
189
190
|
"astro-eslint-parser": "^0.17.0",
|
|
190
191
|
bumpp: "^9.4.0",
|
|
191
|
-
"bundle-require": "^4.0.
|
|
192
|
-
eslint: "^9.
|
|
192
|
+
"bundle-require": "^4.0.3",
|
|
193
|
+
eslint: "^9.1.1",
|
|
193
194
|
"eslint-plugin-astro": "^0.34.0",
|
|
194
195
|
"eslint-plugin-format": "^0.1.1",
|
|
195
|
-
"eslint-plugin-react-hooks": "^4.6.
|
|
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",
|
|
@@ -207,11 +208,11 @@ var package_default = {
|
|
|
207
208
|
rimraf: "^5.0.5",
|
|
208
209
|
"simple-git-hooks": "^2.11.1",
|
|
209
210
|
svelte: "^4.2.15",
|
|
210
|
-
"svelte-eslint-parser": "^0.
|
|
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"
|
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@9.0.
|
|
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",
|
|
@@ -113,24 +113,25 @@ var package_default = {
|
|
|
113
113
|
"@antfu/install-pkg": "^0.3.2",
|
|
114
114
|
"@clack/prompts": "^0.7.0",
|
|
115
115
|
"@stylistic/eslint-plugin": "^1.7.2",
|
|
116
|
-
"@typescript-eslint/eslint-plugin": "^7.7.
|
|
117
|
-
"@typescript-eslint/parser": "^7.7.
|
|
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
137
|
"eslint-processor-vue-blocks": "^0.1.2",
|
|
@@ -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-react/eslint-plugin": "^1.5.
|
|
152
|
-
"@eslint/config-inspector": "^0.4.
|
|
152
|
+
"@eslint-react/eslint-plugin": "^1.5.9",
|
|
153
|
+
"@eslint/config-inspector": "^0.4.7",
|
|
153
154
|
"@stylistic/eslint-plugin-migrate": "^1.7.2",
|
|
154
|
-
"@types/eslint": "^8.56.
|
|
155
|
+
"@types/eslint": "^8.56.10",
|
|
155
156
|
"@types/fs-extra": "^11.0.4",
|
|
156
157
|
"@types/node": "^20.12.7",
|
|
157
158
|
"@types/prompts": "^2.4.9",
|
|
158
159
|
"@types/yargs": "^17.0.32",
|
|
159
|
-
"@unocss/eslint-plugin": "^0.59.
|
|
160
|
+
"@unocss/eslint-plugin": "^0.59.4",
|
|
160
161
|
"astro-eslint-parser": "^0.17.0",
|
|
161
162
|
bumpp: "^9.4.0",
|
|
162
|
-
"bundle-require": "^4.0.
|
|
163
|
-
eslint: "^9.
|
|
163
|
+
"bundle-require": "^4.0.3",
|
|
164
|
+
eslint: "^9.1.1",
|
|
164
165
|
"eslint-plugin-astro": "^0.34.0",
|
|
165
166
|
"eslint-plugin-format": "^0.1.1",
|
|
166
|
-
"eslint-plugin-react-hooks": "^4.6.
|
|
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",
|
|
@@ -178,11 +179,11 @@ var package_default = {
|
|
|
178
179
|
rimraf: "^5.0.5",
|
|
179
180
|
"simple-git-hooks": "^2.11.1",
|
|
180
181
|
svelte: "^4.2.15",
|
|
181
|
-
"svelte-eslint-parser": "^0.
|
|
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"
|