@ntnyq/eslint-config 3.0.0-beta.14 → 3.0.0-beta.16

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
@@ -156,7 +156,7 @@ export interface ConfigOptions {
156
156
 
157
157
  vue?: boolean | ConfigVueOptions
158
158
 
159
- vitest?: boolean | ConfigVitestOptions
159
+ test?: boolean | ConfigVitestOptions
160
160
  }
161
161
  ```
162
162
 
package/dist/index.cjs CHANGED
@@ -60,7 +60,6 @@ __export(src_exports, {
60
60
  antfu: () => antfu,
61
61
  command: () => command,
62
62
  comments: () => comments,
63
- disables: () => disables,
64
63
  getOverrides: () => getOverrides,
65
64
  gitignore: () => gitignore,
66
65
  hasTypeScript: () => hasTypeScript,
@@ -106,6 +105,8 @@ __export(src_exports, {
106
105
  sortI18nLocale: () => sortI18nLocale,
107
106
  sortPackageJson: () => sortPackageJson,
108
107
  sortTsConfig: () => sortTsConfig,
108
+ specials: () => specials,
109
+ test: () => test,
109
110
  toArray: () => toArray,
110
111
  toml: () => toml,
111
112
  tseslint: () => import_typescript_eslint.default,
@@ -127,11 +128,16 @@ var import_eslint_flat_config_utils = require("eslint-flat-config-utils");
127
128
  var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
128
129
  var GLOB_SRC = `**/*.${GLOB_SRC_EXT}`;
129
130
  var GLOB_JS = "**/*.?([cm])js";
130
- var GLOB_JSX = "**/*.?([cm])jsx";
131
+ var GLOB_JSX = `${GLOB_JS}x`;
131
132
  var GLOB_TS = "**/*.?([cm])ts";
132
- var GLOB_TSX = "**/*.?([cm])tsx";
133
+ var GLOB_TSX = `${GLOB_TS}x`;
133
134
  var GLOB_DTS = "**/*.d.?([cm])ts";
134
- var GLOB_TEST = `**/*.{test,spec,bench,benchmark}.${GLOB_SRC_EXT}`;
135
+ var GLOB_TEST = [
136
+ `**/*.test.${GLOB_SRC_EXT}`,
137
+ `**/*.spec.${GLOB_SRC_EXT}`,
138
+ `**/*.bench.${GLOB_SRC_EXT}`,
139
+ `**/*.benchmark.${GLOB_SRC_EXT}`
140
+ ];
135
141
  var GLOB_STYLE = "**/*.{c,le,sc}ss";
136
142
  var GLOB_CSS = "**/*.css";
137
143
  var GLOB_LESS = "**/*.less";
@@ -258,6 +264,8 @@ var typescriptCore = (options = {}) => {
258
264
  rules: {
259
265
  // Disabled in favor of ts rules
260
266
  "no-redeclare": "off",
267
+ "no-use-before-define": "off",
268
+ "no-unused-vars": "off",
261
269
  "@typescript-eslint/no-redeclare": [
262
270
  "error",
263
271
  {
@@ -265,6 +273,18 @@ var typescriptCore = (options = {}) => {
265
273
  ignoreDeclarationMerge: true
266
274
  }
267
275
  ],
276
+ "@typescript-eslint/no-use-before-define": [
277
+ "error",
278
+ {
279
+ functions: false,
280
+ classes: false,
281
+ variables: true,
282
+ allowNamedExports: false,
283
+ enums: true,
284
+ typedefs: false,
285
+ ignoreTypeReferences: false
286
+ }
287
+ ],
268
288
  "@typescript-eslint/no-unused-vars": [
269
289
  "error",
270
290
  {
@@ -324,7 +344,7 @@ var typescriptCore = (options = {}) => {
324
344
  "@typescript-eslint/explicit-function-return-type": "off",
325
345
  "@typescript-eslint/explicit-module-boundary-types": "off",
326
346
  "@typescript-eslint/consistent-indexed-object-style": "off",
327
- // Overrides built-in rules
347
+ // Overrides rules
328
348
  ...options.overrides
329
349
  }
330
350
  });
@@ -333,21 +353,14 @@ var typescriptCore = (options = {}) => {
333
353
  var typescript = (options = {}) => [
334
354
  ...typescriptCore(options),
335
355
  {
336
- name: "ntnyq/ts/dts",
356
+ name: "ntnyq/ts/types",
337
357
  files: [GLOB_DTS, "**/types/**/*.ts"],
338
358
  rules: {
339
359
  "no-use-before-define": "off",
340
360
  "no-restricted-syntax": "off",
341
361
  "import/no-duplicates": "off",
342
- "import/newline-after-import": "off"
343
- }
344
- },
345
- {
346
- name: "ntnyq/ts/test",
347
- files: ["**/*.{spec,test}.ts?(x)"],
348
- rules: {
349
- "no-unused-expressions": "off",
350
- "max-lines-per-function": "off"
362
+ "import/newline-after-import": "off",
363
+ "@typescript-eslint/no-use-before-define": "off"
351
364
  }
352
365
  }
353
366
  ];
@@ -620,7 +633,7 @@ var vue = (options = {}) => {
620
633
  multiline: 1
621
634
  }
622
635
  ],
623
- // Overrides built-in rules
636
+ // Overrides rules
624
637
  ...options.overrides
625
638
  }
626
639
  }
@@ -643,7 +656,7 @@ var yml = (options = {}) => [
643
656
  ...import_eslint_plugin_yml.default.configs.prettier.rules,
644
657
  "yml/no-empty-mapping-value": "off",
645
658
  "yml/quotes": ["error", { avoidEscape: false, prefer: "single" }],
646
- // Overrides built-in rules
659
+ // Overrides rules
647
660
  ...options.overrides
648
661
  }
649
662
  }
@@ -665,7 +678,7 @@ var node = (options = {}) => [
665
678
  "node/prefer-global/buffer": ["error", "never"],
666
679
  "node/prefer-global/process": ["error", "never"],
667
680
  "node/process-exit-as-throw": "error",
668
- // Overrides built-in rules
681
+ // Overrides rules
669
682
  ...options.overrides
670
683
  }
671
684
  }
@@ -935,12 +948,40 @@ var toml = (options = {}) => [
935
948
  "toml/quoted-keys": "error",
936
949
  "toml/spaced-comment": "error",
937
950
  "toml/table-bracket-spacing": "error",
938
- // Overrides built-in rules
951
+ // Overrides rules
939
952
  ...options.overrides
940
953
  }
941
954
  }
942
955
  ];
943
956
 
957
+ // src/configs/test.ts
958
+ var test = (options = {}) => [
959
+ {
960
+ name: "ntnyq/test",
961
+ files: [...GLOB_TEST],
962
+ rules: {
963
+ "no-unused-expressions": "off",
964
+ "max-lines-per-function": "off",
965
+ // Overrides rules
966
+ ...options.overrides
967
+ }
968
+ }
969
+ ];
970
+ var vitest = (options = {}) => [
971
+ {
972
+ name: "ntnyq/vitest",
973
+ plugins: {
974
+ vitest: import_eslint_plugin2.default
975
+ },
976
+ files: [...GLOB_TEST],
977
+ rules: {
978
+ ...import_eslint_plugin2.default.configs.recommended.rules,
979
+ // Overrides rules
980
+ ...options.overridesVitestRules
981
+ }
982
+ }
983
+ ];
984
+
944
985
  // src/configs/antfu.ts
945
986
  var antfu = (options = {}) => [
946
987
  {
@@ -983,7 +1024,7 @@ var jsdoc = (options = {}) => [
983
1024
  "jsdoc/require-yields-check": "warn",
984
1025
  "jsdoc/check-alignment": "warn",
985
1026
  "jsdoc/multiline-blocks": "warn",
986
- // Overrides built-in rules
1027
+ // Overrides rules
987
1028
  ...options.overrides
988
1029
  }
989
1030
  }
@@ -1028,7 +1069,7 @@ var jsonc = (options = {}) => [
1028
1069
  allowMultiplePropertiesPerLine: true
1029
1070
  }
1030
1071
  ],
1031
- // Overrides built-in rules
1072
+ // Overrides rules
1032
1073
  ...options.overrides
1033
1074
  }
1034
1075
  }
@@ -1042,7 +1083,7 @@ var regexp = (options = {}) => [
1042
1083
  {
1043
1084
  name: "ntnyq/regexp",
1044
1085
  ...pluginRegexp.configs["flat/recommended"],
1045
- // Overrides built-in rules
1086
+ // Overrides rules
1046
1087
  ...options.overrides
1047
1088
  }
1048
1089
  ];
@@ -1058,23 +1099,7 @@ var unocss = (options = {}) => [
1058
1099
  "unocss/order": "error",
1059
1100
  // We don't use this
1060
1101
  "unocss/order-attributify": "off",
1061
- // Overrides built-in rules
1062
- ...options.overrides
1063
- }
1064
- }
1065
- ];
1066
-
1067
- // src/configs/vitest.ts
1068
- var vitest = (options = {}) => [
1069
- {
1070
- name: "ntnyq/vitest",
1071
- plugins: {
1072
- vitest: import_eslint_plugin2.default
1073
- },
1074
- files: [GLOB_TEST],
1075
- rules: {
1076
- ...import_eslint_plugin2.default.configs.recommended.rules,
1077
- // Overrides built-in rules
1102
+ // Overrides rules
1078
1103
  ...options.overrides
1079
1104
  }
1080
1105
  }
@@ -1126,7 +1151,7 @@ var imports = (options = {}) => [
1126
1151
  "import/no-duplicates": "error",
1127
1152
  "import/no-mutable-exports": "error",
1128
1153
  "import/newline-after-import": "error",
1129
- // Overrides built-in rules
1154
+ // Overrides rules
1130
1155
  ...options.overrides
1131
1156
  }
1132
1157
  }
@@ -1204,16 +1229,17 @@ var unicorn = (options = {}) => [
1204
1229
  "unicorn/prefer-array-some": "error",
1205
1230
  "unicorn/prefer-array-flat-map": "error",
1206
1231
  "unicorn/prefer-array-index-of": "error",
1207
- // Overrides built-in rules
1232
+ // Overrides rules
1208
1233
  ...options.overrides
1209
1234
  }
1210
1235
  }
1211
1236
  ];
1212
1237
 
1213
- // src/configs/disables.ts
1214
- var disables = () => [
1238
+ // src/configs/specials.ts
1239
+ var import_globals = __toESM(require("globals"), 1);
1240
+ var specials = () => [
1215
1241
  {
1216
- name: "ntnyq/disables/scripts",
1242
+ name: "ntnyq/specials/scripts",
1217
1243
  files: [`**/scripts/${GLOB_SRC}`],
1218
1244
  rules: {
1219
1245
  "no-console": "off",
@@ -1221,12 +1247,29 @@ var disables = () => [
1221
1247
  }
1222
1248
  },
1223
1249
  {
1224
- name: "ntnyq/disables/cli",
1250
+ name: "ntnyq/specials/cli",
1225
1251
  files: [`**/cli/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
1226
1252
  rules: {
1227
1253
  "no-console": "off",
1228
1254
  "@typescript-eslint/explicit-function-return-type": "off"
1229
1255
  }
1256
+ },
1257
+ {
1258
+ name: "ntnyq/specials/userscript",
1259
+ files: [`**/*.user.${GLOB_SRC_EXT}`],
1260
+ languageOptions: {
1261
+ globals: {
1262
+ ...import_globals.default.greasemonkey
1263
+ }
1264
+ },
1265
+ rules: {
1266
+ camelcase: [
1267
+ "error",
1268
+ {
1269
+ allow: ["^GM_.+"]
1270
+ }
1271
+ ]
1272
+ }
1230
1273
  }
1231
1274
  ];
1232
1275
 
@@ -1240,7 +1283,7 @@ var comments = (options = {}) => [
1240
1283
  rules: {
1241
1284
  ...import_eslint_plugin_eslint_comments.default.configs.recommended.rules,
1242
1285
  "@eslint-community/eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }],
1243
- // Overrides built-in rules
1286
+ // Overrides rules
1244
1287
  ...options.overrides
1245
1288
  }
1246
1289
  }
@@ -1278,7 +1321,7 @@ var markdown = (options = {}) => {
1278
1321
  "@typescript-eslint/no-use-before-define": "off",
1279
1322
  "@typescript-eslint/no-unused-expressions": "off",
1280
1323
  "@typescript-eslint/consistent-type-imports": "off",
1281
- // Overrides built-in rules
1324
+ // Overrides rules
1282
1325
  ...options.overrides
1283
1326
  }
1284
1327
  }
@@ -1332,7 +1375,7 @@ var prettier = (options = {}) => [
1332
1375
  "vue/template-curly-spacing": "off",
1333
1376
  ...import_eslint_plugin_prettier.default.configs.recommended.rules,
1334
1377
  "prettier/prettier": options.level || "warn",
1335
- // Overrides built-in rules
1378
+ // Overrides rules
1336
1379
  ...options.overrides
1337
1380
  }
1338
1381
  },
@@ -1362,7 +1405,7 @@ var gitignore = (options = {}) => [
1362
1405
 
1363
1406
  // src/configs/javascript.ts
1364
1407
  var import_js = __toESM(require("@eslint/js"), 1);
1365
- var import_globals = __toESM(require("globals"), 1);
1408
+ var import_globals2 = __toESM(require("globals"), 1);
1366
1409
  var javascript = (options = {}) => {
1367
1410
  const strictRules = {
1368
1411
  complexity: ["error", { max: 30 }],
@@ -1395,9 +1438,9 @@ var javascript = (options = {}) => {
1395
1438
  name: "ntnyq/js/core",
1396
1439
  languageOptions: {
1397
1440
  globals: {
1398
- ...import_globals.default.browser,
1399
- ...import_globals.default.es2021,
1400
- ...import_globals.default.node
1441
+ ...import_globals2.default.browser,
1442
+ ...import_globals2.default.es2021,
1443
+ ...import_globals2.default.node
1401
1444
  },
1402
1445
  sourceType: "module"
1403
1446
  },
@@ -1567,22 +1610,15 @@ var javascript = (options = {}) => {
1567
1610
  {
1568
1611
  functions: false,
1569
1612
  classes: false,
1570
- variables: true
1613
+ variables: true,
1614
+ allowNamedExports: false
1571
1615
  }
1572
1616
  ],
1573
1617
  // Strict rules
1574
1618
  ...options.strict ? strictRules : {},
1575
- // Overrides built-in rules
1619
+ // Overrides rules
1576
1620
  ...options.overrides
1577
1621
  }
1578
- },
1579
- {
1580
- name: "ntnyq/js/test",
1581
- files: ["**/*.{test,spec}.js?(x)"],
1582
- rules: {
1583
- "no-unused-expressions": "off",
1584
- "max-lines-per-function": "off"
1585
- }
1586
1622
  }
1587
1623
  ];
1588
1624
  };
@@ -1680,7 +1716,7 @@ var perfectionist = (options = {}) => [
1680
1716
  groupKind: "values-first"
1681
1717
  }
1682
1718
  ],
1683
- // Overrides built-in rules
1719
+ // Overrides rules
1684
1720
  ...options.overrides
1685
1721
  }
1686
1722
  }
@@ -1709,7 +1745,7 @@ var unusedImports = (options = {}) => [
1709
1745
  caughtErrorsIgnorePattern: "^_"
1710
1746
  }
1711
1747
  ],
1712
- // Overrides built-in rules
1748
+ // Overrides rules
1713
1749
  ...options.overrides
1714
1750
  }
1715
1751
  }
@@ -1864,10 +1900,13 @@ function ntnyq(options = {}, userConfigs = []) {
1864
1900
  })
1865
1901
  );
1866
1902
  }
1867
- if (options.vitest ?? hasVitest) {
1903
+ if (options.test ?? hasVitest) {
1868
1904
  configs.push(
1905
+ ...test({
1906
+ overrides: getOverrides(options, "test")
1907
+ }),
1869
1908
  ...vitest({
1870
- overrides: getOverrides(options, "vitest")
1909
+ overrides: getOverrides(options, "test")
1871
1910
  })
1872
1911
  );
1873
1912
  }
@@ -1892,7 +1931,7 @@ function ntnyq(options = {}, userConfigs = []) {
1892
1931
  })
1893
1932
  );
1894
1933
  }
1895
- const configDisables = disables();
1934
+ const configSpecials = specials();
1896
1935
  const configPrettier = options.prettier ?? true ? prettier({
1897
1936
  ...resolveSubOptions(options, "prettier"),
1898
1937
  overrides: getOverrides(options, "prettier")
@@ -1901,7 +1940,7 @@ function ntnyq(options = {}, userConfigs = []) {
1901
1940
  composer.append(
1902
1941
  ...configs,
1903
1942
  ...toArray(userConfigs),
1904
- ...configDisables,
1943
+ ...configSpecials,
1905
1944
  ...configPrettier
1906
1945
  );
1907
1946
  return composer;
@@ -1938,7 +1977,6 @@ function ntnyq(options = {}, userConfigs = []) {
1938
1977
  antfu,
1939
1978
  command,
1940
1979
  comments,
1941
- disables,
1942
1980
  getOverrides,
1943
1981
  gitignore,
1944
1982
  hasTypeScript,
@@ -1984,6 +2022,8 @@ function ntnyq(options = {}, userConfigs = []) {
1984
2022
  sortI18nLocale,
1985
2023
  sortPackageJson,
1986
2024
  sortTsConfig,
2025
+ specials,
2026
+ test,
1987
2027
  toArray,
1988
2028
  toml,
1989
2029
  tseslint,
package/dist/index.d.cts CHANGED
@@ -780,6 +780,11 @@ interface RuleOptions {
780
780
  * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/no-import-node-modules-by-path.test.ts
781
781
  */
782
782
  'antfu/no-import-node-modules-by-path'?: Linter.RuleEntry<[]>;
783
+ /**
784
+ * Prevent using top-level await
785
+ * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/no-top-level-await.test.ts
786
+ */
787
+ 'antfu/no-top-level-await'?: Linter.RuleEntry<[]>;
783
788
  /**
784
789
  * Do not use `exports =`
785
790
  * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/no-ts-export-equal.test.ts
@@ -12206,7 +12211,7 @@ type Yoda = [] | [("always" | "never")] | [
12206
12211
  onlyEquality?: boolean;
12207
12212
  }
12208
12213
  ];
12209
- type ConfigNames = 'ntnyq/antfu' | 'ntnyq/command' | 'ntnyq/eslint-comments' | 'ntnyq/ignores' | 'ntnyq/imports' | 'ntnyq/gitignore' | 'ntnyq/js/recommended' | 'ntnyq/js/core' | 'ntnyq/js/test' | 'ntnyq/jsdoc' | 'ntnyq/jsonc' | 'ntnyq/jsx' | 'ntnyq/markdown/recommended/plugin' | 'ntnyq/markdown/recommended/processor' | 'ntnyq/markdown/recommended/code-blocks' | 'ntnyq/markdown/disabled/code-blocks' | 'ntnyq/node' | 'ntnyq/prettier' | 'ntnyq/prettier/disabled' | 'ntnyq/regexp' | 'ntnyq/perfectionist' | 'ntnyq/sort/package-json' | 'ntnyq/sort/tsconfig' | 'typescript-eslint/base' | 'typescript-eslint/eslint-recommended' | 'typescript-eslint/recommended' | 'ntnyq/ts/core' | 'ntnyq/ts/dts' | 'ntnyq/ts/test' | 'ntnyq/unused-imports' | 'ntnyq/unicorn' | 'ntnyq/unocss' | 'typescript-eslint/base' | 'typescript-eslint/eslint-recommended' | 'typescript-eslint/recommended' | 'ntnyq/ts/core' | 'ntnyq/vue/ts' | 'ntnyq/vue/core' | 'ntnyq/yaml' | 'ntnyq/toml';
12214
+ type ConfigNames = 'ntnyq/antfu' | 'ntnyq/command' | 'ntnyq/eslint-comments' | 'ntnyq/ignores' | 'ntnyq/imports' | 'ntnyq/gitignore' | 'ntnyq/js/recommended' | 'ntnyq/js/core' | 'ntnyq/jsdoc' | 'ntnyq/jsonc' | 'ntnyq/jsx' | 'ntnyq/markdown/recommended/plugin' | 'ntnyq/markdown/recommended/processor' | 'ntnyq/markdown/recommended/code-blocks' | 'ntnyq/markdown/disabled/code-blocks' | 'ntnyq/node' | 'ntnyq/prettier' | 'ntnyq/prettier/disabled' | 'ntnyq/regexp' | 'ntnyq/perfectionist' | 'ntnyq/sort/package-json' | 'ntnyq/sort/tsconfig' | 'typescript-eslint/base' | 'typescript-eslint/eslint-recommended' | 'typescript-eslint/recommended' | 'ntnyq/ts/core' | 'ntnyq/ts/types' | 'ntnyq/unused-imports' | 'ntnyq/unicorn' | 'ntnyq/unocss' | 'typescript-eslint/base' | 'typescript-eslint/eslint-recommended' | 'typescript-eslint/recommended' | 'ntnyq/ts/core' | 'ntnyq/vue/ts' | 'ntnyq/vue/core' | 'ntnyq/yaml' | 'ntnyq/toml';
12210
12215
 
12211
12216
  /**
12212
12217
  * Typed flat config item
@@ -12319,7 +12324,11 @@ interface ConfigVueOptions extends OptionsOverrides {
12319
12324
  */
12320
12325
  vueVersion?: 2 | 3;
12321
12326
  }
12322
- interface ConfigVitestOptions extends OptionsOverrides {
12327
+ interface ConfigTestOptions extends OptionsOverrides {
12328
+ /**
12329
+ * Rules for vitest
12330
+ */
12331
+ overridesVitestRules?: TypedConfigItem['rules'];
12323
12332
  }
12324
12333
  interface ConfigUnusedImportsOptions extends OptionsOverrides {
12325
12334
  }
@@ -12357,7 +12366,7 @@ interface ConfigOptions {
12357
12366
  markdown?: boolean | ConfigMarkdownOptions;
12358
12367
  toml?: boolean | ConfigTomlOptions;
12359
12368
  vue?: boolean | ConfigVueOptions;
12360
- vitest?: boolean | ConfigVitestOptions;
12369
+ test?: boolean | ConfigTestOptions;
12361
12370
  }
12362
12371
 
12363
12372
  /**
@@ -12379,7 +12388,7 @@ declare const GLOB_JSX = "**/*.?([cm])jsx";
12379
12388
  declare const GLOB_TS = "**/*.?([cm])ts";
12380
12389
  declare const GLOB_TSX = "**/*.?([cm])tsx";
12381
12390
  declare const GLOB_DTS = "**/*.d.?([cm])ts";
12382
- declare const GLOB_TEST = "**/*.{test,spec,bench,benchmark}.?([cm])[jt]s?(x)";
12391
+ declare const GLOB_TEST: string[];
12383
12392
  declare const GLOB_STYLE = "**/*.{c,le,sc}ss";
12384
12393
  declare const GLOB_CSS = "**/*.css";
12385
12394
  declare const GLOB_LESS = "**/*.less";
@@ -12437,6 +12446,9 @@ declare const sortI18nLocale: () => TypedConfigItem[];
12437
12446
 
12438
12447
  declare const toml: (options?: ConfigTomlOptions) => TypedConfigItem[];
12439
12448
 
12449
+ declare const test: (options?: ConfigTestOptions) => TypedConfigItem[];
12450
+ declare const vitest: (options?: ConfigTestOptions) => TypedConfigItem[];
12451
+
12440
12452
  declare const antfu: (options?: ConfigAntfuOptions) => TypedConfigItem[];
12441
12453
 
12442
12454
  declare const jsdoc: (options?: ConfigJsdocOptions) => TypedConfigItem[];
@@ -12447,8 +12459,6 @@ declare const regexp: (options?: ConfigRegexpOptions) => TypedConfigItem[];
12447
12459
 
12448
12460
  declare const unocss: (options?: ConfigUnoCSSOptions) => TypedConfigItem[];
12449
12461
 
12450
- declare const vitest: (options?: ConfigVitestOptions) => TypedConfigItem[];
12451
-
12452
12462
  declare const command: (options?: ConfigCommandOptions) => TypedConfigItem[];
12453
12463
 
12454
12464
  /**
@@ -12460,7 +12470,7 @@ declare const imports: (options?: ConfigImportsOptions) => TypedConfigItem[];
12460
12470
 
12461
12471
  declare const unicorn: (options?: ConfigUnicornOptions) => TypedConfigItem[];
12462
12472
 
12463
- declare const disables: () => TypedConfigItem[];
12473
+ declare const specials: () => TypedConfigItem[];
12464
12474
 
12465
12475
  declare const comments: (options?: ConfigCommentsOptions) => TypedConfigItem[];
12466
12476
 
@@ -12480,4 +12490,4 @@ declare const perfectionist: (options?: ConfigPerfectionistOptions) => TypedConf
12480
12490
 
12481
12491
  declare const unusedImports: (options?: ConfigUnusedImportsOptions) => TypedConfigItem[];
12482
12492
 
12483
- export { type Arrayable, type Awaitable, type ConfigAntfuOptions, type ConfigCommandOptions, type ConfigCommentsOptions, type ConfigGitIgnoreOptions, type ConfigIgnoresOptions, type ConfigImportsOptions, type ConfigJavaScriptOptions, type ConfigJsdocOptions, type ConfigJsoncOptions, type ConfigMarkdownOptions, type ConfigNames, type ConfigNodeOptions, type ConfigOptions, type ConfigPerfectionistOptions, type ConfigPrettierOptions, type ConfigRegexpOptions, type ConfigTomlOptions, type ConfigTypeScriptOptions, type ConfigUnicornOptions, type ConfigUnoCSSOptions, type ConfigUnusedImportsOptions, type ConfigVitestOptions, type ConfigVueOptions, type ConfigYmlOptions, GLOB_ALL_SRC, GLOB_CSS, GLOB_DIST, GLOB_DTS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_NESTED, GLOB_NODE_MODULES, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TEST, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type InteropModuleDefault, type LiteralUnion, type OptionsFiles, type OptionsOverrides, type ParserOptions, type PerfectionistSortOrder, type PerfectionistSortType, type ResolvedOptions, type RuleOptions, type TypedConfigItem, antfu, command, comments, disables, getOverrides, gitignore, hasTypeScript, hasUnoCSS, hasVitest, hasVue, ignores, imports, interopDefault, javascript, jsdoc, jsonc, jsx, loadPlugin, markdown, node, ntnyq, perfectionist, prettier, regexp, resolveSubOptions, sortI18nLocale, sortPackageJson, sortTsConfig, toArray, toml, typescript, typescriptCore, unicorn, unocss, unusedImports, vitest, vue, yml };
12493
+ export { type Arrayable, type Awaitable, type ConfigAntfuOptions, type ConfigCommandOptions, type ConfigCommentsOptions, type ConfigGitIgnoreOptions, type ConfigIgnoresOptions, type ConfigImportsOptions, type ConfigJavaScriptOptions, type ConfigJsdocOptions, type ConfigJsoncOptions, type ConfigMarkdownOptions, type ConfigNames, type ConfigNodeOptions, type ConfigOptions, type ConfigPerfectionistOptions, type ConfigPrettierOptions, type ConfigRegexpOptions, type ConfigTestOptions, type ConfigTomlOptions, type ConfigTypeScriptOptions, type ConfigUnicornOptions, type ConfigUnoCSSOptions, type ConfigUnusedImportsOptions, type ConfigVueOptions, type ConfigYmlOptions, GLOB_ALL_SRC, GLOB_CSS, GLOB_DIST, GLOB_DTS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_NESTED, GLOB_NODE_MODULES, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TEST, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type InteropModuleDefault, type LiteralUnion, type OptionsFiles, type OptionsOverrides, type ParserOptions, type PerfectionistSortOrder, type PerfectionistSortType, type ResolvedOptions, type RuleOptions, type TypedConfigItem, antfu, command, comments, getOverrides, gitignore, hasTypeScript, hasUnoCSS, hasVitest, hasVue, ignores, imports, interopDefault, javascript, jsdoc, jsonc, jsx, loadPlugin, markdown, node, ntnyq, perfectionist, prettier, regexp, resolveSubOptions, sortI18nLocale, sortPackageJson, sortTsConfig, specials, test, toArray, toml, typescript, typescriptCore, unicorn, unocss, unusedImports, vitest, vue, yml };
package/dist/index.d.ts CHANGED
@@ -780,6 +780,11 @@ interface RuleOptions {
780
780
  * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/no-import-node-modules-by-path.test.ts
781
781
  */
782
782
  'antfu/no-import-node-modules-by-path'?: Linter.RuleEntry<[]>;
783
+ /**
784
+ * Prevent using top-level await
785
+ * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/no-top-level-await.test.ts
786
+ */
787
+ 'antfu/no-top-level-await'?: Linter.RuleEntry<[]>;
783
788
  /**
784
789
  * Do not use `exports =`
785
790
  * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/no-ts-export-equal.test.ts
@@ -12206,7 +12211,7 @@ type Yoda = [] | [("always" | "never")] | [
12206
12211
  onlyEquality?: boolean;
12207
12212
  }
12208
12213
  ];
12209
- type ConfigNames = 'ntnyq/antfu' | 'ntnyq/command' | 'ntnyq/eslint-comments' | 'ntnyq/ignores' | 'ntnyq/imports' | 'ntnyq/gitignore' | 'ntnyq/js/recommended' | 'ntnyq/js/core' | 'ntnyq/js/test' | 'ntnyq/jsdoc' | 'ntnyq/jsonc' | 'ntnyq/jsx' | 'ntnyq/markdown/recommended/plugin' | 'ntnyq/markdown/recommended/processor' | 'ntnyq/markdown/recommended/code-blocks' | 'ntnyq/markdown/disabled/code-blocks' | 'ntnyq/node' | 'ntnyq/prettier' | 'ntnyq/prettier/disabled' | 'ntnyq/regexp' | 'ntnyq/perfectionist' | 'ntnyq/sort/package-json' | 'ntnyq/sort/tsconfig' | 'typescript-eslint/base' | 'typescript-eslint/eslint-recommended' | 'typescript-eslint/recommended' | 'ntnyq/ts/core' | 'ntnyq/ts/dts' | 'ntnyq/ts/test' | 'ntnyq/unused-imports' | 'ntnyq/unicorn' | 'ntnyq/unocss' | 'typescript-eslint/base' | 'typescript-eslint/eslint-recommended' | 'typescript-eslint/recommended' | 'ntnyq/ts/core' | 'ntnyq/vue/ts' | 'ntnyq/vue/core' | 'ntnyq/yaml' | 'ntnyq/toml';
12214
+ type ConfigNames = 'ntnyq/antfu' | 'ntnyq/command' | 'ntnyq/eslint-comments' | 'ntnyq/ignores' | 'ntnyq/imports' | 'ntnyq/gitignore' | 'ntnyq/js/recommended' | 'ntnyq/js/core' | 'ntnyq/jsdoc' | 'ntnyq/jsonc' | 'ntnyq/jsx' | 'ntnyq/markdown/recommended/plugin' | 'ntnyq/markdown/recommended/processor' | 'ntnyq/markdown/recommended/code-blocks' | 'ntnyq/markdown/disabled/code-blocks' | 'ntnyq/node' | 'ntnyq/prettier' | 'ntnyq/prettier/disabled' | 'ntnyq/regexp' | 'ntnyq/perfectionist' | 'ntnyq/sort/package-json' | 'ntnyq/sort/tsconfig' | 'typescript-eslint/base' | 'typescript-eslint/eslint-recommended' | 'typescript-eslint/recommended' | 'ntnyq/ts/core' | 'ntnyq/ts/types' | 'ntnyq/unused-imports' | 'ntnyq/unicorn' | 'ntnyq/unocss' | 'typescript-eslint/base' | 'typescript-eslint/eslint-recommended' | 'typescript-eslint/recommended' | 'ntnyq/ts/core' | 'ntnyq/vue/ts' | 'ntnyq/vue/core' | 'ntnyq/yaml' | 'ntnyq/toml';
12210
12215
 
12211
12216
  /**
12212
12217
  * Typed flat config item
@@ -12319,7 +12324,11 @@ interface ConfigVueOptions extends OptionsOverrides {
12319
12324
  */
12320
12325
  vueVersion?: 2 | 3;
12321
12326
  }
12322
- interface ConfigVitestOptions extends OptionsOverrides {
12327
+ interface ConfigTestOptions extends OptionsOverrides {
12328
+ /**
12329
+ * Rules for vitest
12330
+ */
12331
+ overridesVitestRules?: TypedConfigItem['rules'];
12323
12332
  }
12324
12333
  interface ConfigUnusedImportsOptions extends OptionsOverrides {
12325
12334
  }
@@ -12357,7 +12366,7 @@ interface ConfigOptions {
12357
12366
  markdown?: boolean | ConfigMarkdownOptions;
12358
12367
  toml?: boolean | ConfigTomlOptions;
12359
12368
  vue?: boolean | ConfigVueOptions;
12360
- vitest?: boolean | ConfigVitestOptions;
12369
+ test?: boolean | ConfigTestOptions;
12361
12370
  }
12362
12371
 
12363
12372
  /**
@@ -12379,7 +12388,7 @@ declare const GLOB_JSX = "**/*.?([cm])jsx";
12379
12388
  declare const GLOB_TS = "**/*.?([cm])ts";
12380
12389
  declare const GLOB_TSX = "**/*.?([cm])tsx";
12381
12390
  declare const GLOB_DTS = "**/*.d.?([cm])ts";
12382
- declare const GLOB_TEST = "**/*.{test,spec,bench,benchmark}.?([cm])[jt]s?(x)";
12391
+ declare const GLOB_TEST: string[];
12383
12392
  declare const GLOB_STYLE = "**/*.{c,le,sc}ss";
12384
12393
  declare const GLOB_CSS = "**/*.css";
12385
12394
  declare const GLOB_LESS = "**/*.less";
@@ -12437,6 +12446,9 @@ declare const sortI18nLocale: () => TypedConfigItem[];
12437
12446
 
12438
12447
  declare const toml: (options?: ConfigTomlOptions) => TypedConfigItem[];
12439
12448
 
12449
+ declare const test: (options?: ConfigTestOptions) => TypedConfigItem[];
12450
+ declare const vitest: (options?: ConfigTestOptions) => TypedConfigItem[];
12451
+
12440
12452
  declare const antfu: (options?: ConfigAntfuOptions) => TypedConfigItem[];
12441
12453
 
12442
12454
  declare const jsdoc: (options?: ConfigJsdocOptions) => TypedConfigItem[];
@@ -12447,8 +12459,6 @@ declare const regexp: (options?: ConfigRegexpOptions) => TypedConfigItem[];
12447
12459
 
12448
12460
  declare const unocss: (options?: ConfigUnoCSSOptions) => TypedConfigItem[];
12449
12461
 
12450
- declare const vitest: (options?: ConfigVitestOptions) => TypedConfigItem[];
12451
-
12452
12462
  declare const command: (options?: ConfigCommandOptions) => TypedConfigItem[];
12453
12463
 
12454
12464
  /**
@@ -12460,7 +12470,7 @@ declare const imports: (options?: ConfigImportsOptions) => TypedConfigItem[];
12460
12470
 
12461
12471
  declare const unicorn: (options?: ConfigUnicornOptions) => TypedConfigItem[];
12462
12472
 
12463
- declare const disables: () => TypedConfigItem[];
12473
+ declare const specials: () => TypedConfigItem[];
12464
12474
 
12465
12475
  declare const comments: (options?: ConfigCommentsOptions) => TypedConfigItem[];
12466
12476
 
@@ -12480,4 +12490,4 @@ declare const perfectionist: (options?: ConfigPerfectionistOptions) => TypedConf
12480
12490
 
12481
12491
  declare const unusedImports: (options?: ConfigUnusedImportsOptions) => TypedConfigItem[];
12482
12492
 
12483
- export { type Arrayable, type Awaitable, type ConfigAntfuOptions, type ConfigCommandOptions, type ConfigCommentsOptions, type ConfigGitIgnoreOptions, type ConfigIgnoresOptions, type ConfigImportsOptions, type ConfigJavaScriptOptions, type ConfigJsdocOptions, type ConfigJsoncOptions, type ConfigMarkdownOptions, type ConfigNames, type ConfigNodeOptions, type ConfigOptions, type ConfigPerfectionistOptions, type ConfigPrettierOptions, type ConfigRegexpOptions, type ConfigTomlOptions, type ConfigTypeScriptOptions, type ConfigUnicornOptions, type ConfigUnoCSSOptions, type ConfigUnusedImportsOptions, type ConfigVitestOptions, type ConfigVueOptions, type ConfigYmlOptions, GLOB_ALL_SRC, GLOB_CSS, GLOB_DIST, GLOB_DTS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_NESTED, GLOB_NODE_MODULES, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TEST, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type InteropModuleDefault, type LiteralUnion, type OptionsFiles, type OptionsOverrides, type ParserOptions, type PerfectionistSortOrder, type PerfectionistSortType, type ResolvedOptions, type RuleOptions, type TypedConfigItem, antfu, command, comments, disables, getOverrides, gitignore, hasTypeScript, hasUnoCSS, hasVitest, hasVue, ignores, imports, interopDefault, javascript, jsdoc, jsonc, jsx, loadPlugin, markdown, node, ntnyq, perfectionist, prettier, regexp, resolveSubOptions, sortI18nLocale, sortPackageJson, sortTsConfig, toArray, toml, typescript, typescriptCore, unicorn, unocss, unusedImports, vitest, vue, yml };
12493
+ export { type Arrayable, type Awaitable, type ConfigAntfuOptions, type ConfigCommandOptions, type ConfigCommentsOptions, type ConfigGitIgnoreOptions, type ConfigIgnoresOptions, type ConfigImportsOptions, type ConfigJavaScriptOptions, type ConfigJsdocOptions, type ConfigJsoncOptions, type ConfigMarkdownOptions, type ConfigNames, type ConfigNodeOptions, type ConfigOptions, type ConfigPerfectionistOptions, type ConfigPrettierOptions, type ConfigRegexpOptions, type ConfigTestOptions, type ConfigTomlOptions, type ConfigTypeScriptOptions, type ConfigUnicornOptions, type ConfigUnoCSSOptions, type ConfigUnusedImportsOptions, type ConfigVueOptions, type ConfigYmlOptions, GLOB_ALL_SRC, GLOB_CSS, GLOB_DIST, GLOB_DTS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_NESTED, GLOB_NODE_MODULES, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TEST, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type InteropModuleDefault, type LiteralUnion, type OptionsFiles, type OptionsOverrides, type ParserOptions, type PerfectionistSortOrder, type PerfectionistSortType, type ResolvedOptions, type RuleOptions, type TypedConfigItem, antfu, command, comments, getOverrides, gitignore, hasTypeScript, hasUnoCSS, hasVitest, hasVue, ignores, imports, interopDefault, javascript, jsdoc, jsonc, jsx, loadPlugin, markdown, node, ntnyq, perfectionist, prettier, regexp, resolveSubOptions, sortI18nLocale, sortPackageJson, sortTsConfig, specials, test, toArray, toml, typescript, typescriptCore, unicorn, unocss, unusedImports, vitest, vue, yml };
package/dist/index.js CHANGED
@@ -5,11 +5,16 @@ import { FlatConfigComposer } from "eslint-flat-config-utils";
5
5
  var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
6
6
  var GLOB_SRC = `**/*.${GLOB_SRC_EXT}`;
7
7
  var GLOB_JS = "**/*.?([cm])js";
8
- var GLOB_JSX = "**/*.?([cm])jsx";
8
+ var GLOB_JSX = `${GLOB_JS}x`;
9
9
  var GLOB_TS = "**/*.?([cm])ts";
10
- var GLOB_TSX = "**/*.?([cm])tsx";
10
+ var GLOB_TSX = `${GLOB_TS}x`;
11
11
  var GLOB_DTS = "**/*.d.?([cm])ts";
12
- var GLOB_TEST = `**/*.{test,spec,bench,benchmark}.${GLOB_SRC_EXT}`;
12
+ var GLOB_TEST = [
13
+ `**/*.test.${GLOB_SRC_EXT}`,
14
+ `**/*.spec.${GLOB_SRC_EXT}`,
15
+ `**/*.bench.${GLOB_SRC_EXT}`,
16
+ `**/*.benchmark.${GLOB_SRC_EXT}`
17
+ ];
13
18
  var GLOB_STYLE = "**/*.{c,le,sc}ss";
14
19
  var GLOB_CSS = "**/*.css";
15
20
  var GLOB_LESS = "**/*.less";
@@ -136,6 +141,8 @@ var typescriptCore = (options = {}) => {
136
141
  rules: {
137
142
  // Disabled in favor of ts rules
138
143
  "no-redeclare": "off",
144
+ "no-use-before-define": "off",
145
+ "no-unused-vars": "off",
139
146
  "@typescript-eslint/no-redeclare": [
140
147
  "error",
141
148
  {
@@ -143,6 +150,18 @@ var typescriptCore = (options = {}) => {
143
150
  ignoreDeclarationMerge: true
144
151
  }
145
152
  ],
153
+ "@typescript-eslint/no-use-before-define": [
154
+ "error",
155
+ {
156
+ functions: false,
157
+ classes: false,
158
+ variables: true,
159
+ allowNamedExports: false,
160
+ enums: true,
161
+ typedefs: false,
162
+ ignoreTypeReferences: false
163
+ }
164
+ ],
146
165
  "@typescript-eslint/no-unused-vars": [
147
166
  "error",
148
167
  {
@@ -202,7 +221,7 @@ var typescriptCore = (options = {}) => {
202
221
  "@typescript-eslint/explicit-function-return-type": "off",
203
222
  "@typescript-eslint/explicit-module-boundary-types": "off",
204
223
  "@typescript-eslint/consistent-indexed-object-style": "off",
205
- // Overrides built-in rules
224
+ // Overrides rules
206
225
  ...options.overrides
207
226
  }
208
227
  });
@@ -211,21 +230,14 @@ var typescriptCore = (options = {}) => {
211
230
  var typescript = (options = {}) => [
212
231
  ...typescriptCore(options),
213
232
  {
214
- name: "ntnyq/ts/dts",
233
+ name: "ntnyq/ts/types",
215
234
  files: [GLOB_DTS, "**/types/**/*.ts"],
216
235
  rules: {
217
236
  "no-use-before-define": "off",
218
237
  "no-restricted-syntax": "off",
219
238
  "import/no-duplicates": "off",
220
- "import/newline-after-import": "off"
221
- }
222
- },
223
- {
224
- name: "ntnyq/ts/test",
225
- files: ["**/*.{spec,test}.ts?(x)"],
226
- rules: {
227
- "no-unused-expressions": "off",
228
- "max-lines-per-function": "off"
239
+ "import/newline-after-import": "off",
240
+ "@typescript-eslint/no-use-before-define": "off"
229
241
  }
230
242
  }
231
243
  ];
@@ -498,7 +510,7 @@ var vue = (options = {}) => {
498
510
  multiline: 1
499
511
  }
500
512
  ],
501
- // Overrides built-in rules
513
+ // Overrides rules
502
514
  ...options.overrides
503
515
  }
504
516
  }
@@ -521,7 +533,7 @@ var yml = (options = {}) => [
521
533
  ...default4.configs.prettier.rules,
522
534
  "yml/no-empty-mapping-value": "off",
523
535
  "yml/quotes": ["error", { avoidEscape: false, prefer: "single" }],
524
- // Overrides built-in rules
536
+ // Overrides rules
525
537
  ...options.overrides
526
538
  }
527
539
  }
@@ -543,7 +555,7 @@ var node = (options = {}) => [
543
555
  "node/prefer-global/buffer": ["error", "never"],
544
556
  "node/prefer-global/process": ["error", "never"],
545
557
  "node/process-exit-as-throw": "error",
546
- // Overrides built-in rules
558
+ // Overrides rules
547
559
  ...options.overrides
548
560
  }
549
561
  }
@@ -813,12 +825,40 @@ var toml = (options = {}) => [
813
825
  "toml/quoted-keys": "error",
814
826
  "toml/spaced-comment": "error",
815
827
  "toml/table-bracket-spacing": "error",
816
- // Overrides built-in rules
828
+ // Overrides rules
817
829
  ...options.overrides
818
830
  }
819
831
  }
820
832
  ];
821
833
 
834
+ // src/configs/test.ts
835
+ var test = (options = {}) => [
836
+ {
837
+ name: "ntnyq/test",
838
+ files: [...GLOB_TEST],
839
+ rules: {
840
+ "no-unused-expressions": "off",
841
+ "max-lines-per-function": "off",
842
+ // Overrides rules
843
+ ...options.overrides
844
+ }
845
+ }
846
+ ];
847
+ var vitest = (options = {}) => [
848
+ {
849
+ name: "ntnyq/vitest",
850
+ plugins: {
851
+ vitest: default11
852
+ },
853
+ files: [...GLOB_TEST],
854
+ rules: {
855
+ ...default11.configs.recommended.rules,
856
+ // Overrides rules
857
+ ...options.overridesVitestRules
858
+ }
859
+ }
860
+ ];
861
+
822
862
  // src/configs/antfu.ts
823
863
  var antfu = (options = {}) => [
824
864
  {
@@ -861,7 +901,7 @@ var jsdoc = (options = {}) => [
861
901
  "jsdoc/require-yields-check": "warn",
862
902
  "jsdoc/check-alignment": "warn",
863
903
  "jsdoc/multiline-blocks": "warn",
864
- // Overrides built-in rules
904
+ // Overrides rules
865
905
  ...options.overrides
866
906
  }
867
907
  }
@@ -906,7 +946,7 @@ var jsonc = (options = {}) => [
906
946
  allowMultiplePropertiesPerLine: true
907
947
  }
908
948
  ],
909
- // Overrides built-in rules
949
+ // Overrides rules
910
950
  ...options.overrides
911
951
  }
912
952
  }
@@ -920,7 +960,7 @@ var regexp = (options = {}) => [
920
960
  {
921
961
  name: "ntnyq/regexp",
922
962
  ...pluginRegexp.configs["flat/recommended"],
923
- // Overrides built-in rules
963
+ // Overrides rules
924
964
  ...options.overrides
925
965
  }
926
966
  ];
@@ -936,23 +976,7 @@ var unocss = (options = {}) => [
936
976
  "unocss/order": "error",
937
977
  // We don't use this
938
978
  "unocss/order-attributify": "off",
939
- // Overrides built-in rules
940
- ...options.overrides
941
- }
942
- }
943
- ];
944
-
945
- // src/configs/vitest.ts
946
- var vitest = (options = {}) => [
947
- {
948
- name: "ntnyq/vitest",
949
- plugins: {
950
- vitest: default11
951
- },
952
- files: [GLOB_TEST],
953
- rules: {
954
- ...default11.configs.recommended.rules,
955
- // Overrides built-in rules
979
+ // Overrides rules
956
980
  ...options.overrides
957
981
  }
958
982
  }
@@ -1004,7 +1028,7 @@ var imports = (options = {}) => [
1004
1028
  "import/no-duplicates": "error",
1005
1029
  "import/no-mutable-exports": "error",
1006
1030
  "import/newline-after-import": "error",
1007
- // Overrides built-in rules
1031
+ // Overrides rules
1008
1032
  ...options.overrides
1009
1033
  }
1010
1034
  }
@@ -1082,16 +1106,17 @@ var unicorn = (options = {}) => [
1082
1106
  "unicorn/prefer-array-some": "error",
1083
1107
  "unicorn/prefer-array-flat-map": "error",
1084
1108
  "unicorn/prefer-array-index-of": "error",
1085
- // Overrides built-in rules
1109
+ // Overrides rules
1086
1110
  ...options.overrides
1087
1111
  }
1088
1112
  }
1089
1113
  ];
1090
1114
 
1091
- // src/configs/disables.ts
1092
- var disables = () => [
1115
+ // src/configs/specials.ts
1116
+ import globals from "globals";
1117
+ var specials = () => [
1093
1118
  {
1094
- name: "ntnyq/disables/scripts",
1119
+ name: "ntnyq/specials/scripts",
1095
1120
  files: [`**/scripts/${GLOB_SRC}`],
1096
1121
  rules: {
1097
1122
  "no-console": "off",
@@ -1099,12 +1124,29 @@ var disables = () => [
1099
1124
  }
1100
1125
  },
1101
1126
  {
1102
- name: "ntnyq/disables/cli",
1127
+ name: "ntnyq/specials/cli",
1103
1128
  files: [`**/cli/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
1104
1129
  rules: {
1105
1130
  "no-console": "off",
1106
1131
  "@typescript-eslint/explicit-function-return-type": "off"
1107
1132
  }
1133
+ },
1134
+ {
1135
+ name: "ntnyq/specials/userscript",
1136
+ files: [`**/*.user.${GLOB_SRC_EXT}`],
1137
+ languageOptions: {
1138
+ globals: {
1139
+ ...globals.greasemonkey
1140
+ }
1141
+ },
1142
+ rules: {
1143
+ camelcase: [
1144
+ "error",
1145
+ {
1146
+ allow: ["^GM_.+"]
1147
+ }
1148
+ ]
1149
+ }
1108
1150
  }
1109
1151
  ];
1110
1152
 
@@ -1118,7 +1160,7 @@ var comments = (options = {}) => [
1118
1160
  rules: {
1119
1161
  ...default17.configs.recommended.rules,
1120
1162
  "@eslint-community/eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }],
1121
- // Overrides built-in rules
1163
+ // Overrides rules
1122
1164
  ...options.overrides
1123
1165
  }
1124
1166
  }
@@ -1156,7 +1198,7 @@ var markdown = (options = {}) => {
1156
1198
  "@typescript-eslint/no-use-before-define": "off",
1157
1199
  "@typescript-eslint/no-unused-expressions": "off",
1158
1200
  "@typescript-eslint/consistent-type-imports": "off",
1159
- // Overrides built-in rules
1201
+ // Overrides rules
1160
1202
  ...options.overrides
1161
1203
  }
1162
1204
  }
@@ -1210,7 +1252,7 @@ var prettier = (options = {}) => [
1210
1252
  "vue/template-curly-spacing": "off",
1211
1253
  ...default14.configs.recommended.rules,
1212
1254
  "prettier/prettier": options.level || "warn",
1213
- // Overrides built-in rules
1255
+ // Overrides rules
1214
1256
  ...options.overrides
1215
1257
  }
1216
1258
  },
@@ -1240,7 +1282,7 @@ var gitignore = (options = {}) => [
1240
1282
 
1241
1283
  // src/configs/javascript.ts
1242
1284
  import jsConfig from "@eslint/js";
1243
- import globals from "globals";
1285
+ import globals2 from "globals";
1244
1286
  var javascript = (options = {}) => {
1245
1287
  const strictRules = {
1246
1288
  complexity: ["error", { max: 30 }],
@@ -1273,9 +1315,9 @@ var javascript = (options = {}) => {
1273
1315
  name: "ntnyq/js/core",
1274
1316
  languageOptions: {
1275
1317
  globals: {
1276
- ...globals.browser,
1277
- ...globals.es2021,
1278
- ...globals.node
1318
+ ...globals2.browser,
1319
+ ...globals2.es2021,
1320
+ ...globals2.node
1279
1321
  },
1280
1322
  sourceType: "module"
1281
1323
  },
@@ -1445,22 +1487,15 @@ var javascript = (options = {}) => {
1445
1487
  {
1446
1488
  functions: false,
1447
1489
  classes: false,
1448
- variables: true
1490
+ variables: true,
1491
+ allowNamedExports: false
1449
1492
  }
1450
1493
  ],
1451
1494
  // Strict rules
1452
1495
  ...options.strict ? strictRules : {},
1453
- // Overrides built-in rules
1496
+ // Overrides rules
1454
1497
  ...options.overrides
1455
1498
  }
1456
- },
1457
- {
1458
- name: "ntnyq/js/test",
1459
- files: ["**/*.{test,spec}.js?(x)"],
1460
- rules: {
1461
- "no-unused-expressions": "off",
1462
- "max-lines-per-function": "off"
1463
- }
1464
1499
  }
1465
1500
  ];
1466
1501
  };
@@ -1558,7 +1593,7 @@ var perfectionist = (options = {}) => [
1558
1593
  groupKind: "values-first"
1559
1594
  }
1560
1595
  ],
1561
- // Overrides built-in rules
1596
+ // Overrides rules
1562
1597
  ...options.overrides
1563
1598
  }
1564
1599
  }
@@ -1587,7 +1622,7 @@ var unusedImports = (options = {}) => [
1587
1622
  caughtErrorsIgnorePattern: "^_"
1588
1623
  }
1589
1624
  ],
1590
- // Overrides built-in rules
1625
+ // Overrides rules
1591
1626
  ...options.overrides
1592
1627
  }
1593
1628
  }
@@ -1742,10 +1777,13 @@ function ntnyq(options = {}, userConfigs = []) {
1742
1777
  })
1743
1778
  );
1744
1779
  }
1745
- if (options.vitest ?? hasVitest) {
1780
+ if (options.test ?? hasVitest) {
1746
1781
  configs.push(
1782
+ ...test({
1783
+ overrides: getOverrides(options, "test")
1784
+ }),
1747
1785
  ...vitest({
1748
- overrides: getOverrides(options, "vitest")
1786
+ overrides: getOverrides(options, "test")
1749
1787
  })
1750
1788
  );
1751
1789
  }
@@ -1770,7 +1808,7 @@ function ntnyq(options = {}, userConfigs = []) {
1770
1808
  })
1771
1809
  );
1772
1810
  }
1773
- const configDisables = disables();
1811
+ const configSpecials = specials();
1774
1812
  const configPrettier = options.prettier ?? true ? prettier({
1775
1813
  ...resolveSubOptions(options, "prettier"),
1776
1814
  overrides: getOverrides(options, "prettier")
@@ -1779,7 +1817,7 @@ function ntnyq(options = {}, userConfigs = []) {
1779
1817
  composer.append(
1780
1818
  ...configs,
1781
1819
  ...toArray(userConfigs),
1782
- ...configDisables,
1820
+ ...configSpecials,
1783
1821
  ...configPrettier
1784
1822
  );
1785
1823
  return composer;
@@ -1815,7 +1853,6 @@ export {
1815
1853
  antfu,
1816
1854
  command,
1817
1855
  comments,
1818
- disables,
1819
1856
  getOverrides,
1820
1857
  gitignore,
1821
1858
  hasTypeScript,
@@ -1861,6 +1898,8 @@ export {
1861
1898
  sortI18nLocale,
1862
1899
  sortPackageJson,
1863
1900
  sortTsConfig,
1901
+ specials,
1902
+ test,
1864
1903
  toArray,
1865
1904
  toml,
1866
1905
  tseslint,
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@ntnyq/eslint-config",
3
3
  "type": "module",
4
- "version": "3.0.0-beta.14",
5
- "packageManager": "pnpm@9.10.0",
4
+ "version": "3.0.0-beta.16",
5
+ "packageManager": "pnpm@9.11.0",
6
6
  "description": "An opinionated ESLint config preset of ntnyq",
7
7
  "keywords": [
8
8
  "eslint",
@@ -56,7 +56,7 @@
56
56
  },
57
57
  "dependencies": {
58
58
  "@eslint-community/eslint-plugin-eslint-comments": "^4.4.0",
59
- "@eslint/js": "^9.10.0",
59
+ "@eslint/js": "^9.11.0",
60
60
  "@eslint/markdown": "^6.1.0",
61
61
  "@types/eslint__js": "^8.42.3",
62
62
  "@unocss/eslint-plugin": "^0.62.4",
@@ -64,7 +64,7 @@
64
64
  "eslint-config-flat-gitignore": "^0.3.0",
65
65
  "eslint-flat-config-utils": "^0.4.0",
66
66
  "eslint-merge-processors": "^0.1.0",
67
- "eslint-plugin-antfu": "^2.6.0",
67
+ "eslint-plugin-antfu": "^2.7.0",
68
68
  "eslint-plugin-command": "^0.2.5",
69
69
  "eslint-plugin-import-x": "^4.2.1",
70
70
  "eslint-plugin-jsdoc": "^50.2.4",
@@ -91,7 +91,7 @@
91
91
  "@ntnyq/prettier-config": "^1.21.3",
92
92
  "@types/node": "^22.5.5",
93
93
  "bumpp": "^9.5.2",
94
- "eslint": "^9.10.0",
94
+ "eslint": "^9.11.0",
95
95
  "eslint-typegen": "^0.3.2",
96
96
  "husky": "^9.1.6",
97
97
  "jiti": "^1.21.6",
@@ -101,7 +101,7 @@
101
101
  "tsup": "^8.3.0",
102
102
  "tsx": "^4.19.1",
103
103
  "typescript": "^5.6.2",
104
- "zx": "^8.1.7"
104
+ "zx": "^8.1.8"
105
105
  },
106
106
  "engines": {
107
107
  "node": ">=18.18.0"