@antfu/eslint-config 8.2.0 → 9.0.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 +29 -10
- package/dist/cli.mjs +6 -6
- package/dist/index.d.mts +419 -164
- package/dist/index.mjs +27 -56
- package/dist/{lib-UO5evvxw.mjs → lib-C1Uxp5ZW.mjs} +320 -287
- package/package.json +44 -42
package/README.md
CHANGED
|
@@ -176,11 +176,11 @@ Add the following settings to your `.zed/settings.json`:
|
|
|
176
176
|
|
|
177
177
|
```jsonc
|
|
178
178
|
{
|
|
179
|
-
|
|
180
|
-
"
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
],
|
|
179
|
+
// Use ESLint's --fix:
|
|
180
|
+
"code_actions_on_format": {
|
|
181
|
+
"source.fixAll.eslint": true
|
|
182
|
+
},
|
|
183
|
+
"formatter": [],
|
|
184
184
|
// Enable eslint for all supported languages
|
|
185
185
|
// Defaults only include https://github.com/search?q=repo%3Azed-industries%2Fzed%20eslint_languages&type=code
|
|
186
186
|
"languages": {
|
|
@@ -190,6 +190,9 @@ Add the following settings to your `.zed/settings.json`:
|
|
|
190
190
|
"Markdown": {
|
|
191
191
|
"language_servers": ["...", "eslint"]
|
|
192
192
|
},
|
|
193
|
+
"Markdown-Inline": {
|
|
194
|
+
"language_servers": ["...", "eslint"]
|
|
195
|
+
},
|
|
193
196
|
"JSON": {
|
|
194
197
|
"language_servers": ["...", "eslint"]
|
|
195
198
|
},
|
|
@@ -207,10 +210,7 @@ Add the following settings to your `.zed/settings.json`:
|
|
|
207
210
|
"lsp": {
|
|
208
211
|
"eslint": {
|
|
209
212
|
"settings": {
|
|
210
|
-
|
|
211
|
-
"experimental": {
|
|
212
|
-
"useFlatConfig": false
|
|
213
|
-
},
|
|
213
|
+
"workingDirectories": ["./"],
|
|
214
214
|
|
|
215
215
|
// Silent the stylistic rules in your IDE, but still auto fix them
|
|
216
216
|
"rulesCustomizations": [
|
|
@@ -357,6 +357,7 @@ export default antfu({
|
|
|
357
357
|
stylistic: {
|
|
358
358
|
indent: 2, // 4, or 'tab'
|
|
359
359
|
quotes: 'single', // or 'double'
|
|
360
|
+
braceStyle: 'stroustrup', // '1tbs', or 'allman'
|
|
360
361
|
},
|
|
361
362
|
|
|
362
363
|
// TypeScript and Vue are autodetected, you can also explicitly enable them:
|
|
@@ -519,7 +520,7 @@ export default antfu(
|
|
|
519
520
|
},
|
|
520
521
|
},
|
|
521
522
|
{
|
|
522
|
-
// Without `files`, they are general rules for all files
|
|
523
|
+
// Without `files`, they are general rules for all files (Markdown excluded — see note below)
|
|
523
524
|
rules: {
|
|
524
525
|
'style/semi': ['error', 'never'],
|
|
525
526
|
},
|
|
@@ -527,6 +528,9 @@ export default antfu(
|
|
|
527
528
|
)
|
|
528
529
|
```
|
|
529
530
|
|
|
531
|
+
> [!NOTE]
|
|
532
|
+
> Rule overrides without an explicit `files` constraint are automatically excluded from Markdown files, via [`composer.setDefaultIgnores`](https://github.com/antfu/eslint-flat-config-utils#composersetdefaultignores). This prevents JS-only rules (e.g. `no-irregular-whitespace`, `perfectionist/sort-imports`) from crashing on `@eslint/markdown`'s `SourceCode`, which doesn't expose JS-specific methods like `getAllComments()`. If you want a rule to apply to Markdown, scope it explicitly with `files: ['**/*.md']`.
|
|
533
|
+
|
|
530
534
|
We also provided the `overrides` options in each integration to make it easier:
|
|
531
535
|
|
|
532
536
|
```js
|
|
@@ -858,6 +862,21 @@ export default antfu({
|
|
|
858
862
|
})
|
|
859
863
|
```
|
|
860
864
|
|
|
865
|
+
### Prettier
|
|
866
|
+
|
|
867
|
+
If you're using prettier outside eslint, you can disable the config via etc:
|
|
868
|
+
|
|
869
|
+
```js
|
|
870
|
+
import antfu from '@antfu/eslint-config'
|
|
871
|
+
import prettierConflicts from 'eslint-config-prettier'
|
|
872
|
+
|
|
873
|
+
export default antfu({
|
|
874
|
+
rules: {
|
|
875
|
+
'some-rule': 'off'
|
|
876
|
+
}
|
|
877
|
+
}, prettierConflicts)
|
|
878
|
+
```
|
|
879
|
+
|
|
861
880
|
### Editor Specific Disables
|
|
862
881
|
|
|
863
882
|
Auto-fixing for the following rules are disabled when ESLint is running in a code editor:
|
package/dist/cli.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { cac } from "cac";
|
|
|
8
8
|
import parse from "parse-gitignore";
|
|
9
9
|
import { execSync } from "node:child_process";
|
|
10
10
|
//#region package.json
|
|
11
|
-
var version = "
|
|
11
|
+
var version = "9.0.0";
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region src/cli/constants.ts
|
|
14
14
|
const vscodeSettingsString = `
|
|
@@ -165,19 +165,19 @@ async function updateEslintFiles(result) {
|
|
|
165
165
|
//#endregion
|
|
166
166
|
//#region src/cli/constants-generated.ts
|
|
167
167
|
const versionsMap = {
|
|
168
|
-
"@eslint-react/eslint-plugin": "^
|
|
169
|
-
"@next/eslint-plugin-next": "^16.2.
|
|
168
|
+
"@eslint-react/eslint-plugin": "^5.6.0",
|
|
169
|
+
"@next/eslint-plugin-next": "^16.2.6",
|
|
170
170
|
"@unocss/eslint-plugin": "^66.6.8",
|
|
171
171
|
"astro-eslint-parser": "^1.4.0",
|
|
172
|
-
"eslint": "^10.
|
|
172
|
+
"eslint": "^10.3.0",
|
|
173
173
|
"eslint-plugin-astro": "^1.7.0",
|
|
174
174
|
"eslint-plugin-format": "^2.0.1",
|
|
175
175
|
"eslint-plugin-react-refresh": "^0.5.2",
|
|
176
176
|
"eslint-plugin-solid": "^0.14.5",
|
|
177
|
-
"eslint-plugin-svelte": "^3.17.
|
|
177
|
+
"eslint-plugin-svelte": "^3.17.1",
|
|
178
178
|
"prettier-plugin-astro": "^0.14.1",
|
|
179
179
|
"prettier-plugin-slidev": "^1.0.5",
|
|
180
|
-
"svelte-eslint-parser": "^1.6.
|
|
180
|
+
"svelte-eslint-parser": "^1.6.1"
|
|
181
181
|
};
|
|
182
182
|
//#endregion
|
|
183
183
|
//#region src/cli/stages/update-package-json.ts
|