@antfu/eslint-config 1.0.0-beta.13 → 1.0.0-beta.15

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 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 `settings.json`:
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
- // The following is optional.
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: () => import_parser.default,
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: () => import_eslint_plugin_i.default,
71
+ pluginImport: () => pluginImport,
72
72
  pluginJsdoc: () => import_eslint_plugin_jsdoc.default,
73
- pluginJsonc: () => import_eslint_plugin_jsonc.default,
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: () => import_eslint_plugin_yml.default,
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 import_eslint_plugin_i = __toESM(require("eslint-plugin-i"), 1);
108
+ var pluginImport = __toESM(require("eslint-plugin-i"), 1);
108
109
  var import_eslint_plugin_jsdoc = __toESM(require("eslint-plugin-jsdoc"), 1);
109
- var import_eslint_plugin_jsonc = __toESM(require("eslint-plugin-jsonc"), 1);
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 import_eslint_plugin_yml = __toESM(require("eslint-plugin-yml"), 1);
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 import_parser = __toESM(require("@typescript-eslint/parser"), 1);
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,10 +213,12 @@ function imports(options = {}) {
211
213
  return [
212
214
  {
213
215
  plugins: {
214
- import: import_eslint_plugin_i.default
216
+ antfu: import_eslint_plugin_antfu.default,
217
+ import: pluginImport
215
218
  },
216
219
  rules: {
217
- "import/export": "error",
220
+ "antfu/import-dedupe": "error",
221
+ "antfu/no-import-node-modules-by-path": "error",
218
222
  "import/first": "error",
219
223
  "import/no-duplicates": "error",
220
224
  "import/no-mutable-exports": "error",
@@ -269,8 +273,6 @@ function javascript(options = {}) {
269
273
  },
270
274
  rules: {
271
275
  "accessor-pairs": ["error", { enforceForClassMembers: true, setWithoutGet: true }],
272
- "antfu/import-dedupe": "error",
273
- "antfu/no-import-node-modules-by-path": "error",
274
276
  "antfu/top-level-function": "error",
275
277
  "array-callback-return": "error",
276
278
  "arrow-parens": ["error", "as-needed", { requireForBlockBody: true }],
@@ -492,7 +494,6 @@ function jsdoc(options = {}) {
492
494
  "jsdoc/require-returns-check": "warn",
493
495
  "jsdoc/require-returns-description": "warn",
494
496
  "jsdoc/require-yields-check": "warn",
495
- "jsdoc/valid-types": "warn",
496
497
  ...stylistic2 ? {
497
498
  "jsdoc/check-alignment": "warn",
498
499
  "jsdoc/multiline-blocks": "warn"
@@ -511,7 +512,7 @@ function jsonc(options = {}) {
511
512
  return [
512
513
  {
513
514
  plugins: {
514
- jsonc: import_eslint_plugin_jsonc.default
515
+ jsonc: pluginJsonc
515
516
  }
516
517
  },
517
518
  {
@@ -947,7 +948,7 @@ function stylistic() {
947
948
  "style/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
948
949
  "style/operator-linebreak": ["error", "before"],
949
950
  "style/padded-blocks": ["error", { blocks: "never", classes: "never", switches: "never" }],
950
- "style/quotes": ["error", "single"],
951
+ "style/quotes": ["error", "single", { allowTemplateLiterals: true, avoidEscape: true }],
951
952
  "style/rest-spread-spacing": ["error", "never"],
952
953
  "style/semi": ["error", "never"],
953
954
  "style/semi-spacing": ["error", { after: true, before: false }],
@@ -1051,18 +1052,17 @@ function typescript(options) {
1051
1052
  // Install the plugins without globs, so they can be configured separately.
1052
1053
  plugins: {
1053
1054
  antfu: import_eslint_plugin_antfu.default,
1054
- import: import_eslint_plugin_i.default,
1055
+ import: pluginImport,
1055
1056
  ts: import_eslint_plugin2.default
1056
1057
  }
1057
1058
  },
1058
1059
  {
1059
1060
  files: [
1060
- GLOB_TS,
1061
- GLOB_TSX,
1061
+ GLOB_SRC,
1062
1062
  ...componentExts.map((ext) => `**/*.${ext}`)
1063
1063
  ],
1064
1064
  languageOptions: {
1065
- parser: import_parser.default,
1065
+ parser: parserTs,
1066
1066
  parserOptions: {
1067
1067
  sourceType: "module",
1068
1068
  ...tsconfigPath ? {
@@ -1096,12 +1096,14 @@ function typescript(options) {
1096
1096
  "no-use-before-define": OFF,
1097
1097
  "no-useless-constructor": OFF,
1098
1098
  "ts/ban-ts-comment": ["error", { "ts-ignore": "allow-with-description" }],
1099
+ "ts/ban-types": ["error", { types: { Function: false } }],
1099
1100
  "ts/consistent-type-definitions": ["error", "interface"],
1100
1101
  "ts/consistent-type-imports": ["error", { disallowTypeAnnotations: false, prefer: "type-imports" }],
1101
1102
  "ts/no-dupe-class-members": "error",
1102
1103
  "ts/no-dynamic-delete": OFF,
1103
1104
  "ts/no-explicit-any": OFF,
1104
1105
  "ts/no-extra-parens": ["error", "functions"],
1106
+ "ts/no-extraneous-class": OFF,
1105
1107
  "ts/no-invalid-this": "error",
1106
1108
  "ts/no-invalid-void-type": OFF,
1107
1109
  "ts/no-loss-of-precision": "error",
@@ -1110,8 +1112,10 @@ function typescript(options) {
1110
1112
  "ts/no-require-imports": "error",
1111
1113
  "ts/no-unused-vars": OFF,
1112
1114
  "ts/no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
1115
+ "ts/no-useless-constructor": OFF,
1113
1116
  "ts/prefer-ts-expect-error": "error",
1114
1117
  "ts/triple-slash-reference": OFF,
1118
+ "ts/unified-signatures": OFF,
1115
1119
  ...tsconfigPath ? typeAwareRules : {},
1116
1120
  ...overrides
1117
1121
  }
@@ -1202,7 +1206,7 @@ function vue(options = {}) {
1202
1206
  jsx: true
1203
1207
  },
1204
1208
  extraFileExtensions: [".vue"],
1205
- parser: options.typescript ? import_parser.default : null,
1209
+ parser: options.typescript ? parserTs : null,
1206
1210
  sourceType: "module"
1207
1211
  }
1208
1212
  },
@@ -1299,7 +1303,7 @@ function yaml(options = {}) {
1299
1303
  return [
1300
1304
  {
1301
1305
  plugins: {
1302
- yaml: import_eslint_plugin_yml.default
1306
+ yaml: pluginYaml
1303
1307
  }
1304
1308
  },
1305
1309
  {
@@ -1344,13 +1348,24 @@ function test(options = {}) {
1344
1348
  return [
1345
1349
  {
1346
1350
  plugins: {
1347
- "no-only-tests": import_eslint_plugin_no_only_tests.default
1351
+ test: {
1352
+ ...import_eslint_plugin_vitest.default,
1353
+ rules: {
1354
+ ...import_eslint_plugin_vitest.default.rules,
1355
+ // extend `test/no-only-tests` rule
1356
+ ...import_eslint_plugin_no_only_tests.default.rules
1357
+ }
1358
+ }
1348
1359
  }
1349
1360
  },
1350
1361
  {
1351
1362
  files: GLOB_TESTS,
1352
1363
  rules: {
1353
- "no-only-tests/no-only-tests": isInEditor ? OFF : "error",
1364
+ "test/consistent-test-it": ["error", { fn: "it", withinDescribe: "it" }],
1365
+ "test/no-identical-title": "error",
1366
+ "test/no-only-tests": isInEditor ? OFF : "error",
1367
+ "test/prefer-hooks-in-order": "error",
1368
+ "test/prefer-lowercase-title": "error",
1354
1369
  ...overrides
1355
1370
  }
1356
1371
  }
@@ -1381,7 +1396,8 @@ function antfu(options = {}, ...userConfigs) {
1381
1396
  typescript: enableTypeScript = (0, import_local_pkg.isPackageExists)("typescript"),
1382
1397
  stylistic: enableStylistic = true,
1383
1398
  gitignore: enableGitignore = true,
1384
- overrides = {}
1399
+ overrides = {},
1400
+ componentExts = []
1385
1401
  } = options;
1386
1402
  const configs = [];
1387
1403
  if (enableGitignore) {
@@ -1408,7 +1424,6 @@ function antfu(options = {}, ...userConfigs) {
1408
1424
  }),
1409
1425
  unicorn()
1410
1426
  );
1411
- const componentExts = [];
1412
1427
  if (enableVue)
1413
1428
  componentExts.push("vue");
1414
1429
  if (enableTypeScript) {
@@ -1520,6 +1535,7 @@ var src_default = antfu;
1520
1535
  pluginTs,
1521
1536
  pluginUnicorn,
1522
1537
  pluginUnusedImports,
1538
+ pluginVitest,
1523
1539
  pluginVue,
1524
1540
  pluginYaml,
1525
1541
  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
- export { default as parserTs } from '@typescript-eslint/parser';
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
- export { default as pluginImport } from 'eslint-plugin-i';
8
+ import * as eslintPluginI from 'eslint-plugin-i';
9
+ export { eslintPluginI as pluginImport };
8
10
  export { default as pluginJsdoc } from 'eslint-plugin-jsdoc';
9
- export { default as pluginJsonc } from 'eslint-plugin-jsonc';
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
- export { default as pluginYaml } from 'eslint-plugin-yml';
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
- export { default as parserTs } from '@typescript-eslint/parser';
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
- export { default as pluginImport } from 'eslint-plugin-i';
8
+ import * as eslintPluginI from 'eslint-plugin-i';
9
+ export { eslintPluginI as pluginImport };
8
10
  export { default as pluginJsdoc } from 'eslint-plugin-jsdoc';
9
- export { default as pluginJsonc } from 'eslint-plugin-jsonc';
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
- export { default as pluginYaml } from 'eslint-plugin-yml';
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 { default as default4 } from "eslint-plugin-i";
11
- import { default as default5 } from "eslint-plugin-jsdoc";
12
- import { default as default6 } from "eslint-plugin-jsonc";
13
- import { default as default7 } from "eslint-plugin-markdown";
14
- import { default as default8 } from "eslint-plugin-n";
15
- import { default as default9 } from "@stylistic/eslint-plugin";
16
- import { default as default10 } from "@typescript-eslint/eslint-plugin";
17
- import { default as default11 } from "eslint-plugin-unicorn";
18
- import { default as default12 } from "eslint-plugin-unused-imports";
19
- import { default as default13 } from "eslint-plugin-vue";
20
- import { default as default14 } from "eslint-plugin-yml";
21
- import { default as default15 } from "eslint-plugin-no-only-tests";
22
- import { default as default16 } from "@typescript-eslint/parser";
23
- import { default as default17 } from "vue-eslint-parser";
24
- import { default as default18 } from "yaml-eslint-parser";
25
- import { default as default19 } from "jsonc-eslint-parser";
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,10 +115,12 @@ function imports(options = {}) {
114
115
  return [
115
116
  {
116
117
  plugins: {
117
- import: default4
118
+ antfu: default2,
119
+ import: pluginImport
118
120
  },
119
121
  rules: {
120
- "import/export": "error",
122
+ "antfu/import-dedupe": "error",
123
+ "antfu/no-import-node-modules-by-path": "error",
121
124
  "import/first": "error",
122
125
  "import/no-duplicates": "error",
123
126
  "import/no-mutable-exports": "error",
@@ -168,12 +171,10 @@ function javascript(options = {}) {
168
171
  },
169
172
  plugins: {
170
173
  "antfu": default2,
171
- "unused-imports": default12
174
+ "unused-imports": default10
172
175
  },
173
176
  rules: {
174
177
  "accessor-pairs": ["error", { enforceForClassMembers: true, setWithoutGet: true }],
175
- "antfu/import-dedupe": "error",
176
- "antfu/no-import-node-modules-by-path": "error",
177
178
  "antfu/top-level-function": "error",
178
179
  "array-callback-return": "error",
179
180
  "arrow-parens": ["error", "as-needed", { requireForBlockBody: true }],
@@ -377,7 +378,7 @@ function jsdoc(options = {}) {
377
378
  return [
378
379
  {
379
380
  plugins: {
380
- jsdoc: default5
381
+ jsdoc: default4
381
382
  },
382
383
  rules: {
383
384
  "jsdoc/check-access": "warn",
@@ -395,7 +396,6 @@ function jsdoc(options = {}) {
395
396
  "jsdoc/require-returns-check": "warn",
396
397
  "jsdoc/require-returns-description": "warn",
397
398
  "jsdoc/require-yields-check": "warn",
398
- "jsdoc/valid-types": "warn",
399
399
  ...stylistic2 ? {
400
400
  "jsdoc/check-alignment": "warn",
401
401
  "jsdoc/multiline-blocks": "warn"
@@ -414,13 +414,13 @@ function jsonc(options = {}) {
414
414
  return [
415
415
  {
416
416
  plugins: {
417
- jsonc: default6
417
+ jsonc: pluginJsonc
418
418
  }
419
419
  },
420
420
  {
421
421
  files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
422
422
  languageOptions: {
423
- parser: default19
423
+ parser: default16
424
424
  },
425
425
  rules: {
426
426
  "jsonc/no-bigint-literals": "error",
@@ -476,7 +476,7 @@ function markdown(options = {}) {
476
476
  return [
477
477
  {
478
478
  plugins: {
479
- markdown: default7
479
+ markdown: default5
480
480
  }
481
481
  },
482
482
  {
@@ -546,7 +546,7 @@ function node() {
546
546
  return [
547
547
  {
548
548
  plugins: {
549
- node: default8
549
+ node: default6
550
550
  },
551
551
  rules: {
552
552
  "node/handle-callback-err": ["error", "^(err|error)$"],
@@ -782,7 +782,7 @@ function stylistic() {
782
782
  {
783
783
  plugins: {
784
784
  antfu: default2,
785
- style: default9
785
+ style: default7
786
786
  },
787
787
  rules: {
788
788
  "antfu/consistent-list-newline": "error",
@@ -850,7 +850,7 @@ function stylistic() {
850
850
  "style/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
851
851
  "style/operator-linebreak": ["error", "before"],
852
852
  "style/padded-blocks": ["error", { blocks: "never", classes: "never", switches: "never" }],
853
- "style/quotes": ["error", "single"],
853
+ "style/quotes": ["error", "single", { allowTemplateLiterals: true, avoidEscape: true }],
854
854
  "style/rest-spread-spacing": ["error", "never"],
855
855
  "style/semi": ["error", "never"],
856
856
  "style/semi-spacing": ["error", { after: true, before: false }],
@@ -954,18 +954,17 @@ function typescript(options) {
954
954
  // Install the plugins without globs, so they can be configured separately.
955
955
  plugins: {
956
956
  antfu: default2,
957
- import: default4,
958
- ts: default10
957
+ import: pluginImport,
958
+ ts: default8
959
959
  }
960
960
  },
961
961
  {
962
962
  files: [
963
- GLOB_TS,
964
- GLOB_TSX,
963
+ GLOB_SRC,
965
964
  ...componentExts.map((ext) => `**/*.${ext}`)
966
965
  ],
967
966
  languageOptions: {
968
- parser: default16,
967
+ parser: parserTs,
969
968
  parserOptions: {
970
969
  sourceType: "module",
971
970
  ...tsconfigPath ? {
@@ -977,12 +976,12 @@ function typescript(options) {
977
976
  },
978
977
  rules: {
979
978
  ...renameRules(
980
- default10.configs["eslint-recommended"].overrides[0].rules,
979
+ default8.configs["eslint-recommended"].overrides[0].rules,
981
980
  "@typescript-eslint/",
982
981
  "ts/"
983
982
  ),
984
983
  ...renameRules(
985
- default10.configs.strict.rules,
984
+ default8.configs.strict.rules,
986
985
  "@typescript-eslint/",
987
986
  "ts/"
988
987
  ),
@@ -999,12 +998,14 @@ function typescript(options) {
999
998
  "no-use-before-define": OFF,
1000
999
  "no-useless-constructor": OFF,
1001
1000
  "ts/ban-ts-comment": ["error", { "ts-ignore": "allow-with-description" }],
1001
+ "ts/ban-types": ["error", { types: { Function: false } }],
1002
1002
  "ts/consistent-type-definitions": ["error", "interface"],
1003
1003
  "ts/consistent-type-imports": ["error", { disallowTypeAnnotations: false, prefer: "type-imports" }],
1004
1004
  "ts/no-dupe-class-members": "error",
1005
1005
  "ts/no-dynamic-delete": OFF,
1006
1006
  "ts/no-explicit-any": OFF,
1007
1007
  "ts/no-extra-parens": ["error", "functions"],
1008
+ "ts/no-extraneous-class": OFF,
1008
1009
  "ts/no-invalid-this": "error",
1009
1010
  "ts/no-invalid-void-type": OFF,
1010
1011
  "ts/no-loss-of-precision": "error",
@@ -1013,8 +1014,10 @@ function typescript(options) {
1013
1014
  "ts/no-require-imports": "error",
1014
1015
  "ts/no-unused-vars": OFF,
1015
1016
  "ts/no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
1017
+ "ts/no-useless-constructor": OFF,
1016
1018
  "ts/prefer-ts-expect-error": "error",
1017
1019
  "ts/triple-slash-reference": OFF,
1020
+ "ts/unified-signatures": OFF,
1018
1021
  ...tsconfigPath ? typeAwareRules : {},
1019
1022
  ...overrides
1020
1023
  }
@@ -1048,7 +1051,7 @@ function unicorn() {
1048
1051
  return [
1049
1052
  {
1050
1053
  plugins: {
1051
- unicorn: default11
1054
+ unicorn: default9
1052
1055
  },
1053
1056
  rules: {
1054
1057
  // Pass error message when throwing errors
@@ -1093,28 +1096,28 @@ function vue(options = {}) {
1093
1096
  return [
1094
1097
  {
1095
1098
  plugins: {
1096
- vue: default13
1099
+ vue: default11
1097
1100
  }
1098
1101
  },
1099
1102
  {
1100
1103
  files: [GLOB_VUE],
1101
1104
  languageOptions: {
1102
- parser: default17,
1105
+ parser: default14,
1103
1106
  parserOptions: {
1104
1107
  ecmaFeatures: {
1105
1108
  jsx: true
1106
1109
  },
1107
1110
  extraFileExtensions: [".vue"],
1108
- parser: options.typescript ? default16 : null,
1111
+ parser: options.typescript ? parserTs : null,
1109
1112
  sourceType: "module"
1110
1113
  }
1111
1114
  },
1112
- processor: default13.processors[".vue"],
1115
+ processor: default11.processors[".vue"],
1113
1116
  rules: {
1114
- ...default13.configs.base.rules,
1115
- ...default13.configs["vue3-essential"].rules,
1116
- ...default13.configs["vue3-strongly-recommended"].rules,
1117
- ...default13.configs["vue3-recommended"].rules,
1117
+ ...default11.configs.base.rules,
1118
+ ...default11.configs["vue3-essential"].rules,
1119
+ ...default11.configs["vue3-strongly-recommended"].rules,
1120
+ ...default11.configs["vue3-recommended"].rules,
1118
1121
  "node/prefer-global/process": OFF,
1119
1122
  "vue/block-order": ["error", {
1120
1123
  order: ["script", "template", "style"]
@@ -1202,13 +1205,13 @@ function yaml(options = {}) {
1202
1205
  return [
1203
1206
  {
1204
1207
  plugins: {
1205
- yaml: default14
1208
+ yaml: pluginYaml
1206
1209
  }
1207
1210
  },
1208
1211
  {
1209
1212
  files: [GLOB_YAML],
1210
1213
  languageOptions: {
1211
- parser: default18
1214
+ parser: default15
1212
1215
  },
1213
1216
  rules: {
1214
1217
  "style/spaced-comment": OFF,
@@ -1247,13 +1250,24 @@ function test(options = {}) {
1247
1250
  return [
1248
1251
  {
1249
1252
  plugins: {
1250
- "no-only-tests": default15
1253
+ test: {
1254
+ ...default13,
1255
+ rules: {
1256
+ ...default13.rules,
1257
+ // extend `test/no-only-tests` rule
1258
+ ...default12.rules
1259
+ }
1260
+ }
1251
1261
  }
1252
1262
  },
1253
1263
  {
1254
1264
  files: GLOB_TESTS,
1255
1265
  rules: {
1256
- "no-only-tests/no-only-tests": isInEditor ? OFF : "error",
1266
+ "test/consistent-test-it": ["error", { fn: "it", withinDescribe: "it" }],
1267
+ "test/no-identical-title": "error",
1268
+ "test/no-only-tests": isInEditor ? OFF : "error",
1269
+ "test/prefer-hooks-in-order": "error",
1270
+ "test/prefer-lowercase-title": "error",
1257
1271
  ...overrides
1258
1272
  }
1259
1273
  }
@@ -1284,7 +1298,8 @@ function antfu(options = {}, ...userConfigs) {
1284
1298
  typescript: enableTypeScript = isPackageExists("typescript"),
1285
1299
  stylistic: enableStylistic = true,
1286
1300
  gitignore: enableGitignore = true,
1287
- overrides = {}
1301
+ overrides = {},
1302
+ componentExts = []
1288
1303
  } = options;
1289
1304
  const configs = [];
1290
1305
  if (enableGitignore) {
@@ -1311,7 +1326,6 @@ function antfu(options = {}, ...userConfigs) {
1311
1326
  }),
1312
1327
  unicorn()
1313
1328
  );
1314
- const componentExts = [];
1315
1329
  if (enableVue)
1316
1330
  componentExts.push("vue");
1317
1331
  if (enableTypeScript) {
@@ -1407,24 +1421,25 @@ export {
1407
1421
  jsonc,
1408
1422
  markdown,
1409
1423
  node,
1410
- default19 as parserJsonc,
1411
- default16 as parserTs,
1412
- default17 as parserVue,
1413
- default18 as parserYaml,
1424
+ default16 as parserJsonc,
1425
+ parserTs,
1426
+ default14 as parserVue,
1427
+ default15 as parserYaml,
1414
1428
  default2 as pluginAntfu,
1415
1429
  default3 as pluginComments,
1416
- default4 as pluginImport,
1417
- default5 as pluginJsdoc,
1418
- default6 as pluginJsonc,
1419
- default7 as pluginMarkdown,
1420
- default15 as pluginNoOnlyTests,
1421
- default8 as pluginNode,
1422
- default9 as pluginStylistic,
1423
- default10 as pluginTs,
1424
- default11 as pluginUnicorn,
1425
- default12 as pluginUnusedImports,
1426
- default13 as pluginVue,
1427
- default14 as pluginYaml,
1430
+ pluginImport,
1431
+ default4 as pluginJsdoc,
1432
+ pluginJsonc,
1433
+ default5 as pluginMarkdown,
1434
+ default12 as pluginNoOnlyTests,
1435
+ default6 as pluginNode,
1436
+ default7 as pluginStylistic,
1437
+ default8 as pluginTs,
1438
+ default9 as pluginUnicorn,
1439
+ default10 as pluginUnusedImports,
1440
+ default13 as pluginVitest,
1441
+ default11 as pluginVue,
1442
+ pluginYaml,
1428
1443
  recordRulesState,
1429
1444
  recordRulesStateConfigs,
1430
1445
  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.13",
4
+ "version": "1.0.0-beta.15",
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.13"
72
+ "@antfu/eslint-config": "1.0.0-beta.15"
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",