@antfu/eslint-config 1.0.0-beta.13 → 1.0.0-beta.14
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 +6 -7
- package/dist/index.cjs +35 -20
- package/dist/index.d.cts +10 -5
- package/dist/index.d.ts +10 -5
- package/dist/index.js +76 -62
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -52,14 +52,14 @@ For example:
|
|
|
52
52
|
|
|
53
53
|
Install [VS Code ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
|
|
54
54
|
|
|
55
|
-
Add the following settings to your
|
|
55
|
+
Add the following settings to your `.vscode/settings.json`:
|
|
56
56
|
|
|
57
57
|
```jsonc
|
|
58
58
|
{
|
|
59
|
-
// Enable the flat config support
|
|
59
|
+
// Enable the ESlint flat config support
|
|
60
60
|
"eslint.experimental.useFlatConfig": true,
|
|
61
61
|
|
|
62
|
-
// Disable the default formatter
|
|
62
|
+
// Disable the default formatter, use eslint instead
|
|
63
63
|
"prettier.enable": false,
|
|
64
64
|
"editor.formatOnSave": false,
|
|
65
65
|
|
|
@@ -82,10 +82,7 @@ Add the following settings to your `settings.json`:
|
|
|
82
82
|
{ "rule": "*semi", "severity": "off" }
|
|
83
83
|
],
|
|
84
84
|
|
|
85
|
-
//
|
|
86
|
-
// It's better to put under project setting `.vscode/settings.json`
|
|
87
|
-
// to avoid conflicts with working with different eslint configs
|
|
88
|
-
// that does not support all formats.
|
|
85
|
+
// Enable eslint for all supported languages
|
|
89
86
|
"eslint.validate": [
|
|
90
87
|
"javascript",
|
|
91
88
|
"javascriptreact",
|
|
@@ -212,6 +209,8 @@ Since flat config requires us to explicitly provide the plugin names (instead of
|
|
|
212
209
|
| `yaml/*` | `yml/*` | [eslint-plugin-yml](https://github.com/ota-meshi/eslint-plugin-yml) |
|
|
213
210
|
| `ts/*` | `@typescript-eslint/*` | [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint) |
|
|
214
211
|
| `style/*` | `@stylistic/*` | [@stylistic/eslint-plugin](https://github.com/eslint-stylistic/eslint-stylistic) |
|
|
212
|
+
| `test/*` | `vitest/*` | [eslint-plugin-vitest](https://github.com/veritem/eslint-plugin-vitest) |
|
|
213
|
+
| `test/*` | `no-only-tests/*` | [eslint-plugin-no-only-tests](https://github.com/levibuzolic/eslint-plugin-no-only-tests) |
|
|
215
214
|
|
|
216
215
|
When you want to overrides rules, or disable them inline, you need to update to the new prefix:
|
|
217
216
|
|
package/dist/index.cjs
CHANGED
|
@@ -63,14 +63,14 @@ __export(src_exports, {
|
|
|
63
63
|
markdown: () => markdown,
|
|
64
64
|
node: () => node,
|
|
65
65
|
parserJsonc: () => import_jsonc_eslint_parser.default,
|
|
66
|
-
parserTs: () =>
|
|
66
|
+
parserTs: () => parserTs,
|
|
67
67
|
parserVue: () => import_vue_eslint_parser.default,
|
|
68
68
|
parserYaml: () => import_yaml_eslint_parser.default,
|
|
69
69
|
pluginAntfu: () => import_eslint_plugin_antfu.default,
|
|
70
70
|
pluginComments: () => import_eslint_plugin_eslint_comments.default,
|
|
71
|
-
pluginImport: () =>
|
|
71
|
+
pluginImport: () => pluginImport,
|
|
72
72
|
pluginJsdoc: () => import_eslint_plugin_jsdoc.default,
|
|
73
|
-
pluginJsonc: () =>
|
|
73
|
+
pluginJsonc: () => pluginJsonc,
|
|
74
74
|
pluginMarkdown: () => import_eslint_plugin_markdown.default,
|
|
75
75
|
pluginNoOnlyTests: () => import_eslint_plugin_no_only_tests.default,
|
|
76
76
|
pluginNode: () => import_eslint_plugin_n.default,
|
|
@@ -78,8 +78,9 @@ __export(src_exports, {
|
|
|
78
78
|
pluginTs: () => import_eslint_plugin2.default,
|
|
79
79
|
pluginUnicorn: () => import_eslint_plugin_unicorn.default,
|
|
80
80
|
pluginUnusedImports: () => import_eslint_plugin_unused_imports.default,
|
|
81
|
+
pluginVitest: () => import_eslint_plugin_vitest.default,
|
|
81
82
|
pluginVue: () => import_eslint_plugin_vue.default,
|
|
82
|
-
pluginYaml: () =>
|
|
83
|
+
pluginYaml: () => pluginYaml,
|
|
83
84
|
recordRulesState: () => recordRulesState,
|
|
84
85
|
recordRulesStateConfigs: () => recordRulesStateConfigs,
|
|
85
86
|
renameRules: () => renameRules,
|
|
@@ -104,9 +105,9 @@ var import_eslint_config_flat_gitignore = __toESM(require("eslint-config-flat-gi
|
|
|
104
105
|
// src/plugins.ts
|
|
105
106
|
var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
|
|
106
107
|
var import_eslint_plugin_eslint_comments = __toESM(require("eslint-plugin-eslint-comments"), 1);
|
|
107
|
-
var
|
|
108
|
+
var pluginImport = __toESM(require("eslint-plugin-i"), 1);
|
|
108
109
|
var import_eslint_plugin_jsdoc = __toESM(require("eslint-plugin-jsdoc"), 1);
|
|
109
|
-
var
|
|
110
|
+
var pluginJsonc = __toESM(require("eslint-plugin-jsonc"), 1);
|
|
110
111
|
var import_eslint_plugin_markdown = __toESM(require("eslint-plugin-markdown"), 1);
|
|
111
112
|
var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
|
|
112
113
|
var import_eslint_plugin = __toESM(require("@stylistic/eslint-plugin"), 1);
|
|
@@ -114,9 +115,10 @@ var import_eslint_plugin2 = __toESM(require("@typescript-eslint/eslint-plugin"),
|
|
|
114
115
|
var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
|
|
115
116
|
var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
|
|
116
117
|
var import_eslint_plugin_vue = __toESM(require("eslint-plugin-vue"), 1);
|
|
117
|
-
var
|
|
118
|
+
var pluginYaml = __toESM(require("eslint-plugin-yml"), 1);
|
|
118
119
|
var import_eslint_plugin_no_only_tests = __toESM(require("eslint-plugin-no-only-tests"), 1);
|
|
119
|
-
var
|
|
120
|
+
var import_eslint_plugin_vitest = __toESM(require("eslint-plugin-vitest"), 1);
|
|
121
|
+
var parserTs = __toESM(require("@typescript-eslint/parser"), 1);
|
|
120
122
|
var import_vue_eslint_parser = __toESM(require("vue-eslint-parser"), 1);
|
|
121
123
|
var import_yaml_eslint_parser = __toESM(require("yaml-eslint-parser"), 1);
|
|
122
124
|
var import_jsonc_eslint_parser = __toESM(require("jsonc-eslint-parser"), 1);
|
|
@@ -211,9 +213,12 @@ function imports(options = {}) {
|
|
|
211
213
|
return [
|
|
212
214
|
{
|
|
213
215
|
plugins: {
|
|
214
|
-
|
|
216
|
+
antfu: import_eslint_plugin_antfu.default,
|
|
217
|
+
import: pluginImport
|
|
215
218
|
},
|
|
216
219
|
rules: {
|
|
220
|
+
"antfu/import-dedupe": "error",
|
|
221
|
+
"antfu/no-import-node-modules-by-path": "error",
|
|
217
222
|
"import/export": "error",
|
|
218
223
|
"import/first": "error",
|
|
219
224
|
"import/no-duplicates": "error",
|
|
@@ -269,8 +274,6 @@ function javascript(options = {}) {
|
|
|
269
274
|
},
|
|
270
275
|
rules: {
|
|
271
276
|
"accessor-pairs": ["error", { enforceForClassMembers: true, setWithoutGet: true }],
|
|
272
|
-
"antfu/import-dedupe": "error",
|
|
273
|
-
"antfu/no-import-node-modules-by-path": "error",
|
|
274
277
|
"antfu/top-level-function": "error",
|
|
275
278
|
"array-callback-return": "error",
|
|
276
279
|
"arrow-parens": ["error", "as-needed", { requireForBlockBody: true }],
|
|
@@ -511,7 +514,7 @@ function jsonc(options = {}) {
|
|
|
511
514
|
return [
|
|
512
515
|
{
|
|
513
516
|
plugins: {
|
|
514
|
-
jsonc:
|
|
517
|
+
jsonc: pluginJsonc
|
|
515
518
|
}
|
|
516
519
|
},
|
|
517
520
|
{
|
|
@@ -1051,7 +1054,7 @@ function typescript(options) {
|
|
|
1051
1054
|
// Install the plugins without globs, so they can be configured separately.
|
|
1052
1055
|
plugins: {
|
|
1053
1056
|
antfu: import_eslint_plugin_antfu.default,
|
|
1054
|
-
import:
|
|
1057
|
+
import: pluginImport,
|
|
1055
1058
|
ts: import_eslint_plugin2.default
|
|
1056
1059
|
}
|
|
1057
1060
|
},
|
|
@@ -1062,7 +1065,7 @@ function typescript(options) {
|
|
|
1062
1065
|
...componentExts.map((ext) => `**/*.${ext}`)
|
|
1063
1066
|
],
|
|
1064
1067
|
languageOptions: {
|
|
1065
|
-
parser:
|
|
1068
|
+
parser: parserTs,
|
|
1066
1069
|
parserOptions: {
|
|
1067
1070
|
sourceType: "module",
|
|
1068
1071
|
...tsconfigPath ? {
|
|
@@ -1202,7 +1205,7 @@ function vue(options = {}) {
|
|
|
1202
1205
|
jsx: true
|
|
1203
1206
|
},
|
|
1204
1207
|
extraFileExtensions: [".vue"],
|
|
1205
|
-
parser: options.typescript ?
|
|
1208
|
+
parser: options.typescript ? parserTs : null,
|
|
1206
1209
|
sourceType: "module"
|
|
1207
1210
|
}
|
|
1208
1211
|
},
|
|
@@ -1299,7 +1302,7 @@ function yaml(options = {}) {
|
|
|
1299
1302
|
return [
|
|
1300
1303
|
{
|
|
1301
1304
|
plugins: {
|
|
1302
|
-
yaml:
|
|
1305
|
+
yaml: pluginYaml
|
|
1303
1306
|
}
|
|
1304
1307
|
},
|
|
1305
1308
|
{
|
|
@@ -1344,13 +1347,24 @@ function test(options = {}) {
|
|
|
1344
1347
|
return [
|
|
1345
1348
|
{
|
|
1346
1349
|
plugins: {
|
|
1347
|
-
|
|
1350
|
+
test: {
|
|
1351
|
+
...import_eslint_plugin_vitest.default,
|
|
1352
|
+
rules: {
|
|
1353
|
+
...import_eslint_plugin_vitest.default.rules,
|
|
1354
|
+
// extend `test/no-only-tests` rule
|
|
1355
|
+
...import_eslint_plugin_no_only_tests.default.rules
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1348
1358
|
}
|
|
1349
1359
|
},
|
|
1350
1360
|
{
|
|
1351
1361
|
files: GLOB_TESTS,
|
|
1352
1362
|
rules: {
|
|
1353
|
-
"
|
|
1363
|
+
"test/consistent-test-it": ["error", { fn: "it", withinDescribe: "it" }],
|
|
1364
|
+
"test/no-identical-title": "error",
|
|
1365
|
+
"test/no-only-tests": isInEditor ? OFF : "error",
|
|
1366
|
+
"test/prefer-hooks-in-order": "error",
|
|
1367
|
+
"test/prefer-lowercase-title": "error",
|
|
1354
1368
|
...overrides
|
|
1355
1369
|
}
|
|
1356
1370
|
}
|
|
@@ -1381,7 +1395,8 @@ function antfu(options = {}, ...userConfigs) {
|
|
|
1381
1395
|
typescript: enableTypeScript = (0, import_local_pkg.isPackageExists)("typescript"),
|
|
1382
1396
|
stylistic: enableStylistic = true,
|
|
1383
1397
|
gitignore: enableGitignore = true,
|
|
1384
|
-
overrides = {}
|
|
1398
|
+
overrides = {},
|
|
1399
|
+
componentExts = []
|
|
1385
1400
|
} = options;
|
|
1386
1401
|
const configs = [];
|
|
1387
1402
|
if (enableGitignore) {
|
|
@@ -1408,7 +1423,6 @@ function antfu(options = {}, ...userConfigs) {
|
|
|
1408
1423
|
}),
|
|
1409
1424
|
unicorn()
|
|
1410
1425
|
);
|
|
1411
|
-
const componentExts = [];
|
|
1412
1426
|
if (enableVue)
|
|
1413
1427
|
componentExts.push("vue");
|
|
1414
1428
|
if (enableTypeScript) {
|
|
@@ -1520,6 +1534,7 @@ var src_default = antfu;
|
|
|
1520
1534
|
pluginTs,
|
|
1521
1535
|
pluginUnicorn,
|
|
1522
1536
|
pluginUnusedImports,
|
|
1537
|
+
pluginVitest,
|
|
1523
1538
|
pluginVue,
|
|
1524
1539
|
pluginYaml,
|
|
1525
1540
|
recordRulesState,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { FlatESLintConfigItem } from 'eslint-define-config';
|
|
2
2
|
import { FlatGitignoreOptions } from 'eslint-config-flat-gitignore';
|
|
3
3
|
import { ParserOptions } from '@typescript-eslint/parser';
|
|
4
|
-
|
|
4
|
+
import * as parser from '@typescript-eslint/parser';
|
|
5
|
+
export { parser as parserTs };
|
|
5
6
|
export { default as pluginAntfu } from 'eslint-plugin-antfu';
|
|
6
7
|
export { default as pluginComments } from 'eslint-plugin-eslint-comments';
|
|
7
|
-
|
|
8
|
+
import * as eslintPluginI from 'eslint-plugin-i';
|
|
9
|
+
export { eslintPluginI as pluginImport };
|
|
8
10
|
export { default as pluginJsdoc } from 'eslint-plugin-jsdoc';
|
|
9
|
-
|
|
11
|
+
import * as eslintPluginJsonc from 'eslint-plugin-jsonc';
|
|
12
|
+
export { eslintPluginJsonc as pluginJsonc };
|
|
10
13
|
export { default as pluginMarkdown } from 'eslint-plugin-markdown';
|
|
11
14
|
export { default as pluginNode } from 'eslint-plugin-n';
|
|
12
15
|
export { default as pluginStylistic } from '@stylistic/eslint-plugin';
|
|
@@ -14,8 +17,10 @@ export { default as pluginTs } from '@typescript-eslint/eslint-plugin';
|
|
|
14
17
|
export { default as pluginUnicorn } from 'eslint-plugin-unicorn';
|
|
15
18
|
export { default as pluginUnusedImports } from 'eslint-plugin-unused-imports';
|
|
16
19
|
export { default as pluginVue } from 'eslint-plugin-vue';
|
|
17
|
-
|
|
20
|
+
import * as eslintPluginYml from 'eslint-plugin-yml';
|
|
21
|
+
export { eslintPluginYml as pluginYaml };
|
|
18
22
|
export { default as pluginNoOnlyTests } from 'eslint-plugin-no-only-tests';
|
|
23
|
+
export { default as pluginVitest } from 'eslint-plugin-vitest';
|
|
19
24
|
export { default as parserVue } from 'vue-eslint-parser';
|
|
20
25
|
export { default as parserYaml } from 'yaml-eslint-parser';
|
|
21
26
|
export { default as parserJsonc } from 'jsonc-eslint-parser';
|
|
@@ -54,7 +59,7 @@ interface OptionsOverrides {
|
|
|
54
59
|
interface OptionsIsInEditor {
|
|
55
60
|
isInEditor?: boolean;
|
|
56
61
|
}
|
|
57
|
-
interface OptionsConfig {
|
|
62
|
+
interface OptionsConfig extends OptionsComponentExts {
|
|
58
63
|
/**
|
|
59
64
|
* Enable gitignore support.
|
|
60
65
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { FlatESLintConfigItem } from 'eslint-define-config';
|
|
2
2
|
import { FlatGitignoreOptions } from 'eslint-config-flat-gitignore';
|
|
3
3
|
import { ParserOptions } from '@typescript-eslint/parser';
|
|
4
|
-
|
|
4
|
+
import * as parser from '@typescript-eslint/parser';
|
|
5
|
+
export { parser as parserTs };
|
|
5
6
|
export { default as pluginAntfu } from 'eslint-plugin-antfu';
|
|
6
7
|
export { default as pluginComments } from 'eslint-plugin-eslint-comments';
|
|
7
|
-
|
|
8
|
+
import * as eslintPluginI from 'eslint-plugin-i';
|
|
9
|
+
export { eslintPluginI as pluginImport };
|
|
8
10
|
export { default as pluginJsdoc } from 'eslint-plugin-jsdoc';
|
|
9
|
-
|
|
11
|
+
import * as eslintPluginJsonc from 'eslint-plugin-jsonc';
|
|
12
|
+
export { eslintPluginJsonc as pluginJsonc };
|
|
10
13
|
export { default as pluginMarkdown } from 'eslint-plugin-markdown';
|
|
11
14
|
export { default as pluginNode } from 'eslint-plugin-n';
|
|
12
15
|
export { default as pluginStylistic } from '@stylistic/eslint-plugin';
|
|
@@ -14,8 +17,10 @@ export { default as pluginTs } from '@typescript-eslint/eslint-plugin';
|
|
|
14
17
|
export { default as pluginUnicorn } from 'eslint-plugin-unicorn';
|
|
15
18
|
export { default as pluginUnusedImports } from 'eslint-plugin-unused-imports';
|
|
16
19
|
export { default as pluginVue } from 'eslint-plugin-vue';
|
|
17
|
-
|
|
20
|
+
import * as eslintPluginYml from 'eslint-plugin-yml';
|
|
21
|
+
export { eslintPluginYml as pluginYaml };
|
|
18
22
|
export { default as pluginNoOnlyTests } from 'eslint-plugin-no-only-tests';
|
|
23
|
+
export { default as pluginVitest } from 'eslint-plugin-vitest';
|
|
19
24
|
export { default as parserVue } from 'vue-eslint-parser';
|
|
20
25
|
export { default as parserYaml } from 'yaml-eslint-parser';
|
|
21
26
|
export { default as parserJsonc } from 'jsonc-eslint-parser';
|
|
@@ -54,7 +59,7 @@ interface OptionsOverrides {
|
|
|
54
59
|
interface OptionsIsInEditor {
|
|
55
60
|
isInEditor?: boolean;
|
|
56
61
|
}
|
|
57
|
-
interface OptionsConfig {
|
|
62
|
+
interface OptionsConfig extends OptionsComponentExts {
|
|
58
63
|
/**
|
|
59
64
|
* Enable gitignore support.
|
|
60
65
|
*
|
package/dist/index.js
CHANGED
|
@@ -7,22 +7,23 @@ import gitignore from "eslint-config-flat-gitignore";
|
|
|
7
7
|
// src/plugins.ts
|
|
8
8
|
import { default as default2 } from "eslint-plugin-antfu";
|
|
9
9
|
import { default as default3 } from "eslint-plugin-eslint-comments";
|
|
10
|
-
import
|
|
11
|
-
import { default as
|
|
12
|
-
import
|
|
13
|
-
import { default as
|
|
14
|
-
import { default as
|
|
15
|
-
import { default as
|
|
16
|
-
import { default as
|
|
17
|
-
import { default as
|
|
18
|
-
import { default as
|
|
19
|
-
import { default as
|
|
20
|
-
import
|
|
21
|
-
import { default as
|
|
22
|
-
import { default as
|
|
23
|
-
import
|
|
24
|
-
import { default as
|
|
25
|
-
import { default as
|
|
10
|
+
import * as pluginImport from "eslint-plugin-i";
|
|
11
|
+
import { default as default4 } from "eslint-plugin-jsdoc";
|
|
12
|
+
import * as pluginJsonc from "eslint-plugin-jsonc";
|
|
13
|
+
import { default as default5 } from "eslint-plugin-markdown";
|
|
14
|
+
import { default as default6 } from "eslint-plugin-n";
|
|
15
|
+
import { default as default7 } from "@stylistic/eslint-plugin";
|
|
16
|
+
import { default as default8 } from "@typescript-eslint/eslint-plugin";
|
|
17
|
+
import { default as default9 } from "eslint-plugin-unicorn";
|
|
18
|
+
import { default as default10 } from "eslint-plugin-unused-imports";
|
|
19
|
+
import { default as default11 } from "eslint-plugin-vue";
|
|
20
|
+
import * as pluginYaml from "eslint-plugin-yml";
|
|
21
|
+
import { default as default12 } from "eslint-plugin-no-only-tests";
|
|
22
|
+
import { default as default13 } from "eslint-plugin-vitest";
|
|
23
|
+
import * as parserTs from "@typescript-eslint/parser";
|
|
24
|
+
import { default as default14 } from "vue-eslint-parser";
|
|
25
|
+
import { default as default15 } from "yaml-eslint-parser";
|
|
26
|
+
import { default as default16 } from "jsonc-eslint-parser";
|
|
26
27
|
|
|
27
28
|
// src/configs/comments.ts
|
|
28
29
|
function comments() {
|
|
@@ -114,9 +115,12 @@ function imports(options = {}) {
|
|
|
114
115
|
return [
|
|
115
116
|
{
|
|
116
117
|
plugins: {
|
|
117
|
-
|
|
118
|
+
antfu: default2,
|
|
119
|
+
import: pluginImport
|
|
118
120
|
},
|
|
119
121
|
rules: {
|
|
122
|
+
"antfu/import-dedupe": "error",
|
|
123
|
+
"antfu/no-import-node-modules-by-path": "error",
|
|
120
124
|
"import/export": "error",
|
|
121
125
|
"import/first": "error",
|
|
122
126
|
"import/no-duplicates": "error",
|
|
@@ -168,12 +172,10 @@ function javascript(options = {}) {
|
|
|
168
172
|
},
|
|
169
173
|
plugins: {
|
|
170
174
|
"antfu": default2,
|
|
171
|
-
"unused-imports":
|
|
175
|
+
"unused-imports": default10
|
|
172
176
|
},
|
|
173
177
|
rules: {
|
|
174
178
|
"accessor-pairs": ["error", { enforceForClassMembers: true, setWithoutGet: true }],
|
|
175
|
-
"antfu/import-dedupe": "error",
|
|
176
|
-
"antfu/no-import-node-modules-by-path": "error",
|
|
177
179
|
"antfu/top-level-function": "error",
|
|
178
180
|
"array-callback-return": "error",
|
|
179
181
|
"arrow-parens": ["error", "as-needed", { requireForBlockBody: true }],
|
|
@@ -377,7 +379,7 @@ function jsdoc(options = {}) {
|
|
|
377
379
|
return [
|
|
378
380
|
{
|
|
379
381
|
plugins: {
|
|
380
|
-
jsdoc:
|
|
382
|
+
jsdoc: default4
|
|
381
383
|
},
|
|
382
384
|
rules: {
|
|
383
385
|
"jsdoc/check-access": "warn",
|
|
@@ -414,13 +416,13 @@ function jsonc(options = {}) {
|
|
|
414
416
|
return [
|
|
415
417
|
{
|
|
416
418
|
plugins: {
|
|
417
|
-
jsonc:
|
|
419
|
+
jsonc: pluginJsonc
|
|
418
420
|
}
|
|
419
421
|
},
|
|
420
422
|
{
|
|
421
423
|
files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
|
|
422
424
|
languageOptions: {
|
|
423
|
-
parser:
|
|
425
|
+
parser: default16
|
|
424
426
|
},
|
|
425
427
|
rules: {
|
|
426
428
|
"jsonc/no-bigint-literals": "error",
|
|
@@ -476,7 +478,7 @@ function markdown(options = {}) {
|
|
|
476
478
|
return [
|
|
477
479
|
{
|
|
478
480
|
plugins: {
|
|
479
|
-
markdown:
|
|
481
|
+
markdown: default5
|
|
480
482
|
}
|
|
481
483
|
},
|
|
482
484
|
{
|
|
@@ -546,7 +548,7 @@ function node() {
|
|
|
546
548
|
return [
|
|
547
549
|
{
|
|
548
550
|
plugins: {
|
|
549
|
-
node:
|
|
551
|
+
node: default6
|
|
550
552
|
},
|
|
551
553
|
rules: {
|
|
552
554
|
"node/handle-callback-err": ["error", "^(err|error)$"],
|
|
@@ -782,7 +784,7 @@ function stylistic() {
|
|
|
782
784
|
{
|
|
783
785
|
plugins: {
|
|
784
786
|
antfu: default2,
|
|
785
|
-
style:
|
|
787
|
+
style: default7
|
|
786
788
|
},
|
|
787
789
|
rules: {
|
|
788
790
|
"antfu/consistent-list-newline": "error",
|
|
@@ -954,8 +956,8 @@ function typescript(options) {
|
|
|
954
956
|
// Install the plugins without globs, so they can be configured separately.
|
|
955
957
|
plugins: {
|
|
956
958
|
antfu: default2,
|
|
957
|
-
import:
|
|
958
|
-
ts:
|
|
959
|
+
import: pluginImport,
|
|
960
|
+
ts: default8
|
|
959
961
|
}
|
|
960
962
|
},
|
|
961
963
|
{
|
|
@@ -965,7 +967,7 @@ function typescript(options) {
|
|
|
965
967
|
...componentExts.map((ext) => `**/*.${ext}`)
|
|
966
968
|
],
|
|
967
969
|
languageOptions: {
|
|
968
|
-
parser:
|
|
970
|
+
parser: parserTs,
|
|
969
971
|
parserOptions: {
|
|
970
972
|
sourceType: "module",
|
|
971
973
|
...tsconfigPath ? {
|
|
@@ -977,12 +979,12 @@ function typescript(options) {
|
|
|
977
979
|
},
|
|
978
980
|
rules: {
|
|
979
981
|
...renameRules(
|
|
980
|
-
|
|
982
|
+
default8.configs["eslint-recommended"].overrides[0].rules,
|
|
981
983
|
"@typescript-eslint/",
|
|
982
984
|
"ts/"
|
|
983
985
|
),
|
|
984
986
|
...renameRules(
|
|
985
|
-
|
|
987
|
+
default8.configs.strict.rules,
|
|
986
988
|
"@typescript-eslint/",
|
|
987
989
|
"ts/"
|
|
988
990
|
),
|
|
@@ -1048,7 +1050,7 @@ function unicorn() {
|
|
|
1048
1050
|
return [
|
|
1049
1051
|
{
|
|
1050
1052
|
plugins: {
|
|
1051
|
-
unicorn:
|
|
1053
|
+
unicorn: default9
|
|
1052
1054
|
},
|
|
1053
1055
|
rules: {
|
|
1054
1056
|
// Pass error message when throwing errors
|
|
@@ -1093,28 +1095,28 @@ function vue(options = {}) {
|
|
|
1093
1095
|
return [
|
|
1094
1096
|
{
|
|
1095
1097
|
plugins: {
|
|
1096
|
-
vue:
|
|
1098
|
+
vue: default11
|
|
1097
1099
|
}
|
|
1098
1100
|
},
|
|
1099
1101
|
{
|
|
1100
1102
|
files: [GLOB_VUE],
|
|
1101
1103
|
languageOptions: {
|
|
1102
|
-
parser:
|
|
1104
|
+
parser: default14,
|
|
1103
1105
|
parserOptions: {
|
|
1104
1106
|
ecmaFeatures: {
|
|
1105
1107
|
jsx: true
|
|
1106
1108
|
},
|
|
1107
1109
|
extraFileExtensions: [".vue"],
|
|
1108
|
-
parser: options.typescript ?
|
|
1110
|
+
parser: options.typescript ? parserTs : null,
|
|
1109
1111
|
sourceType: "module"
|
|
1110
1112
|
}
|
|
1111
1113
|
},
|
|
1112
|
-
processor:
|
|
1114
|
+
processor: default11.processors[".vue"],
|
|
1113
1115
|
rules: {
|
|
1114
|
-
...
|
|
1115
|
-
...
|
|
1116
|
-
...
|
|
1117
|
-
...
|
|
1116
|
+
...default11.configs.base.rules,
|
|
1117
|
+
...default11.configs["vue3-essential"].rules,
|
|
1118
|
+
...default11.configs["vue3-strongly-recommended"].rules,
|
|
1119
|
+
...default11.configs["vue3-recommended"].rules,
|
|
1118
1120
|
"node/prefer-global/process": OFF,
|
|
1119
1121
|
"vue/block-order": ["error", {
|
|
1120
1122
|
order: ["script", "template", "style"]
|
|
@@ -1202,13 +1204,13 @@ function yaml(options = {}) {
|
|
|
1202
1204
|
return [
|
|
1203
1205
|
{
|
|
1204
1206
|
plugins: {
|
|
1205
|
-
yaml:
|
|
1207
|
+
yaml: pluginYaml
|
|
1206
1208
|
}
|
|
1207
1209
|
},
|
|
1208
1210
|
{
|
|
1209
1211
|
files: [GLOB_YAML],
|
|
1210
1212
|
languageOptions: {
|
|
1211
|
-
parser:
|
|
1213
|
+
parser: default15
|
|
1212
1214
|
},
|
|
1213
1215
|
rules: {
|
|
1214
1216
|
"style/spaced-comment": OFF,
|
|
@@ -1247,13 +1249,24 @@ function test(options = {}) {
|
|
|
1247
1249
|
return [
|
|
1248
1250
|
{
|
|
1249
1251
|
plugins: {
|
|
1250
|
-
|
|
1252
|
+
test: {
|
|
1253
|
+
...default13,
|
|
1254
|
+
rules: {
|
|
1255
|
+
...default13.rules,
|
|
1256
|
+
// extend `test/no-only-tests` rule
|
|
1257
|
+
...default12.rules
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1251
1260
|
}
|
|
1252
1261
|
},
|
|
1253
1262
|
{
|
|
1254
1263
|
files: GLOB_TESTS,
|
|
1255
1264
|
rules: {
|
|
1256
|
-
"
|
|
1265
|
+
"test/consistent-test-it": ["error", { fn: "it", withinDescribe: "it" }],
|
|
1266
|
+
"test/no-identical-title": "error",
|
|
1267
|
+
"test/no-only-tests": isInEditor ? OFF : "error",
|
|
1268
|
+
"test/prefer-hooks-in-order": "error",
|
|
1269
|
+
"test/prefer-lowercase-title": "error",
|
|
1257
1270
|
...overrides
|
|
1258
1271
|
}
|
|
1259
1272
|
}
|
|
@@ -1284,7 +1297,8 @@ function antfu(options = {}, ...userConfigs) {
|
|
|
1284
1297
|
typescript: enableTypeScript = isPackageExists("typescript"),
|
|
1285
1298
|
stylistic: enableStylistic = true,
|
|
1286
1299
|
gitignore: enableGitignore = true,
|
|
1287
|
-
overrides = {}
|
|
1300
|
+
overrides = {},
|
|
1301
|
+
componentExts = []
|
|
1288
1302
|
} = options;
|
|
1289
1303
|
const configs = [];
|
|
1290
1304
|
if (enableGitignore) {
|
|
@@ -1311,7 +1325,6 @@ function antfu(options = {}, ...userConfigs) {
|
|
|
1311
1325
|
}),
|
|
1312
1326
|
unicorn()
|
|
1313
1327
|
);
|
|
1314
|
-
const componentExts = [];
|
|
1315
1328
|
if (enableVue)
|
|
1316
1329
|
componentExts.push("vue");
|
|
1317
1330
|
if (enableTypeScript) {
|
|
@@ -1407,24 +1420,25 @@ export {
|
|
|
1407
1420
|
jsonc,
|
|
1408
1421
|
markdown,
|
|
1409
1422
|
node,
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1423
|
+
default16 as parserJsonc,
|
|
1424
|
+
parserTs,
|
|
1425
|
+
default14 as parserVue,
|
|
1426
|
+
default15 as parserYaml,
|
|
1414
1427
|
default2 as pluginAntfu,
|
|
1415
1428
|
default3 as pluginComments,
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
default13 as
|
|
1427
|
-
|
|
1429
|
+
pluginImport,
|
|
1430
|
+
default4 as pluginJsdoc,
|
|
1431
|
+
pluginJsonc,
|
|
1432
|
+
default5 as pluginMarkdown,
|
|
1433
|
+
default12 as pluginNoOnlyTests,
|
|
1434
|
+
default6 as pluginNode,
|
|
1435
|
+
default7 as pluginStylistic,
|
|
1436
|
+
default8 as pluginTs,
|
|
1437
|
+
default9 as pluginUnicorn,
|
|
1438
|
+
default10 as pluginUnusedImports,
|
|
1439
|
+
default13 as pluginVitest,
|
|
1440
|
+
default11 as pluginVue,
|
|
1441
|
+
pluginYaml,
|
|
1428
1442
|
recordRulesState,
|
|
1429
1443
|
recordRulesStateConfigs,
|
|
1430
1444
|
renameRules,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antfu/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.0-beta.
|
|
4
|
+
"version": "1.0.0-beta.14",
|
|
5
5
|
"packageManager": "pnpm@8.8.0",
|
|
6
6
|
"description": "Anthony's ESLint config",
|
|
7
7
|
"author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"eslint-plugin-no-only-tests": "^3.1.0",
|
|
42
42
|
"eslint-plugin-unicorn": "^48.0.1",
|
|
43
43
|
"eslint-plugin-unused-imports": "^3.0.0",
|
|
44
|
+
"eslint-plugin-vitest": "^0.3.1",
|
|
44
45
|
"eslint-plugin-vue": "^9.17.0",
|
|
45
46
|
"eslint-plugin-yml": "^1.9.0",
|
|
46
47
|
"globals": "^13.22.0",
|
|
@@ -55,6 +56,7 @@
|
|
|
55
56
|
"@types/node": "^20.7.1",
|
|
56
57
|
"bumpp": "^9.2.0",
|
|
57
58
|
"eslint": "^8.50.0",
|
|
59
|
+
"eslint-flat-config-viewer": "^0.0.1",
|
|
58
60
|
"eslint-plugin-sort-keys": "^2.3.5",
|
|
59
61
|
"esno": "^0.17.0",
|
|
60
62
|
"fast-glob": "^3.3.1",
|
|
@@ -67,11 +69,12 @@
|
|
|
67
69
|
"typescript": "^5.2.2",
|
|
68
70
|
"unbuild": "^2.0.0",
|
|
69
71
|
"vitest": "^0.34.5",
|
|
70
|
-
"@antfu/eslint-config": "1.0.0-beta.
|
|
72
|
+
"@antfu/eslint-config": "1.0.0-beta.14"
|
|
71
73
|
},
|
|
72
74
|
"scripts": {
|
|
73
75
|
"build": "tsup src/index.ts --format esm,cjs --clean --dts",
|
|
74
76
|
"stub": "tsup src/index.ts --format esm",
|
|
77
|
+
"dev": "tsup src/index.ts --format esm,cjs --watch & eslint-flat-config-viewer",
|
|
75
78
|
"lint": "pnpm run stub && eslint .",
|
|
76
79
|
"release": "bumpp && pnpm publish",
|
|
77
80
|
"test": "vitest",
|