@antfu/eslint-config 2.6.2 → 2.6.4

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
@@ -192,7 +192,7 @@ export default antfu({
192
192
 
193
193
  // `.eslintignore` is no longer supported in Flat config, use `ignores` instead
194
194
  ignores: [
195
- './fixtures',
195
+ '**/fixtures',
196
196
  // ...globs
197
197
  ]
198
198
  })
package/dist/cli.cjs CHANGED
@@ -46,21 +46,21 @@ var import_parse_gitignore = __toESM(require("parse-gitignore"), 1);
46
46
  var import_picocolors = __toESM(require("picocolors"), 1);
47
47
 
48
48
  // package.json
49
- var version = "2.6.2";
49
+ var version = "2.6.4";
50
50
  var devDependencies = {
51
51
  "@antfu/eslint-config": "workspace:*",
52
52
  "@antfu/eslint-plugin-prettier": "^5.0.1-1",
53
53
  "@antfu/ni": "^0.21.12",
54
- "@stylistic/eslint-plugin-migrate": "^1.5.3",
55
- "@types/eslint": "^8.56.1",
54
+ "@stylistic/eslint-plugin-migrate": "^1.5.4",
55
+ "@types/eslint": "^8.56.2",
56
56
  "@types/fs-extra": "^11.0.4",
57
- "@types/node": "^20.10.7",
57
+ "@types/node": "^20.11.16",
58
58
  "@types/prompts": "^2.4.9",
59
59
  "@types/yargs": "^17.0.32",
60
- "@unocss/eslint-plugin": "^0.58.3",
61
- bumpp: "^9.2.1",
60
+ "@unocss/eslint-plugin": "^0.58.4",
61
+ bumpp: "^9.3.0",
62
62
  eslint: "npm:eslint-ts-patch@^8.56.0-0",
63
- "eslint-flat-config-viewer": "^0.1.4",
63
+ "eslint-flat-config-viewer": "^0.1.11",
64
64
  "eslint-plugin-format": "^0.1.0",
65
65
  "eslint-plugin-react": "^7.33.2",
66
66
  "eslint-plugin-react-hooks": "^4.6.0",
@@ -71,15 +71,15 @@ var devDependencies = {
71
71
  execa: "^8.0.1",
72
72
  "fast-glob": "^3.3.2",
73
73
  "fs-extra": "^11.2.0",
74
- "lint-staged": "^15.2.0",
74
+ "lint-staged": "^15.2.1",
75
75
  rimraf: "^5.0.5",
76
76
  "simple-git-hooks": "^2.9.0",
77
- svelte: "^4.2.8",
77
+ svelte: "^4.2.9",
78
78
  "svelte-eslint-parser": "^0.33.1",
79
79
  tsup: "^8.0.1",
80
80
  typescript: "^5.3.3",
81
- vitest: "^1.1.3",
82
- vue: "^3.4.5"
81
+ vitest: "^1.2.2",
82
+ vue: "^3.4.15"
83
83
  };
84
84
 
85
85
  // src/cli/constants.ts
package/dist/cli.js CHANGED
@@ -17,21 +17,21 @@ import parse from "parse-gitignore";
17
17
  import c from "picocolors";
18
18
 
19
19
  // package.json
20
- var version = "2.6.2";
20
+ var version = "2.6.4";
21
21
  var devDependencies = {
22
22
  "@antfu/eslint-config": "workspace:*",
23
23
  "@antfu/eslint-plugin-prettier": "^5.0.1-1",
24
24
  "@antfu/ni": "^0.21.12",
25
- "@stylistic/eslint-plugin-migrate": "^1.5.3",
26
- "@types/eslint": "^8.56.1",
25
+ "@stylistic/eslint-plugin-migrate": "^1.5.4",
26
+ "@types/eslint": "^8.56.2",
27
27
  "@types/fs-extra": "^11.0.4",
28
- "@types/node": "^20.10.7",
28
+ "@types/node": "^20.11.16",
29
29
  "@types/prompts": "^2.4.9",
30
30
  "@types/yargs": "^17.0.32",
31
- "@unocss/eslint-plugin": "^0.58.3",
32
- bumpp: "^9.2.1",
31
+ "@unocss/eslint-plugin": "^0.58.4",
32
+ bumpp: "^9.3.0",
33
33
  eslint: "npm:eslint-ts-patch@^8.56.0-0",
34
- "eslint-flat-config-viewer": "^0.1.4",
34
+ "eslint-flat-config-viewer": "^0.1.11",
35
35
  "eslint-plugin-format": "^0.1.0",
36
36
  "eslint-plugin-react": "^7.33.2",
37
37
  "eslint-plugin-react-hooks": "^4.6.0",
@@ -42,15 +42,15 @@ var devDependencies = {
42
42
  execa: "^8.0.1",
43
43
  "fast-glob": "^3.3.2",
44
44
  "fs-extra": "^11.2.0",
45
- "lint-staged": "^15.2.0",
45
+ "lint-staged": "^15.2.1",
46
46
  rimraf: "^5.0.5",
47
47
  "simple-git-hooks": "^2.9.0",
48
- svelte: "^4.2.8",
48
+ svelte: "^4.2.9",
49
49
  "svelte-eslint-parser": "^0.33.1",
50
50
  tsup: "^8.0.1",
51
51
  typescript: "^5.3.3",
52
- vitest: "^1.1.3",
53
- vue: "^3.4.5"
52
+ vitest: "^1.2.2",
53
+ vue: "^3.4.15"
54
54
  };
55
55
 
56
56
  // src/cli/constants.ts
package/dist/index.cjs CHANGED
@@ -328,7 +328,6 @@ async function javascript(options = {}) {
328
328
  "no-multi-str": "error",
329
329
  "no-new": "error",
330
330
  "no-new-func": "error",
331
- "no-new-object": "error",
332
331
  "no-new-symbol": "error",
333
332
  "no-new-wrappers": "error",
334
333
  "no-obj-calls": "error",
@@ -1432,6 +1431,8 @@ async function typescript(options = {}) {
1432
1431
  ...componentExts.map((ext) => `**/*.${ext}`)
1433
1432
  ];
1434
1433
  const filesTypeAware = options.filesTypeAware ?? [GLOB_TS, GLOB_TSX];
1434
+ const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
1435
+ const isTypeAware = !!tsconfigPath;
1435
1436
  const typeAwareRules = {
1436
1437
  "dot-notation": "off",
1437
1438
  "no-implied-eval": "off",
@@ -1453,7 +1454,6 @@ async function typescript(options = {}) {
1453
1454
  "ts/restrict-template-expressions": "error",
1454
1455
  "ts/unbound-method": "error"
1455
1456
  };
1456
- const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
1457
1457
  const [
1458
1458
  pluginTs,
1459
1459
  parserTs
@@ -1461,29 +1461,41 @@ async function typescript(options = {}) {
1461
1461
  interopDefault(import("@typescript-eslint/eslint-plugin")),
1462
1462
  interopDefault(import("@typescript-eslint/parser"))
1463
1463
  ]);
1464
- return [
1465
- {
1466
- // Install the plugins without globs, so they can be configured separately.
1467
- name: "antfu:typescript:setup",
1468
- plugins: {
1469
- antfu: import_eslint_plugin_antfu.default,
1470
- ts: pluginTs
1471
- }
1472
- },
1473
- {
1474
- files,
1464
+ function makeParser(typeAware, files2, ignores2) {
1465
+ return {
1466
+ files: files2,
1467
+ ...ignores2 ? { ignores: ignores2 } : {},
1475
1468
  languageOptions: {
1476
1469
  parser: parserTs,
1477
1470
  parserOptions: {
1478
1471
  extraFileExtensions: componentExts.map((ext) => `.${ext}`),
1479
1472
  sourceType: "module",
1480
- ...tsconfigPath ? {
1473
+ ...typeAware ? {
1481
1474
  project: tsconfigPath,
1482
1475
  tsconfigRootDir: import_node_process2.default.cwd()
1483
1476
  } : {},
1484
1477
  ...parserOptions
1485
1478
  }
1486
1479
  },
1480
+ name: `antfu:typescript:${typeAware ? "type-aware-parser" : "parser"}`
1481
+ };
1482
+ }
1483
+ return [
1484
+ {
1485
+ // Install the plugins without globs, so they can be configured separately.
1486
+ name: "antfu:typescript:setup",
1487
+ plugins: {
1488
+ antfu: import_eslint_plugin_antfu.default,
1489
+ ts: pluginTs
1490
+ }
1491
+ },
1492
+ // assign type-aware parser for type-aware files and type-unaware parser for the rest
1493
+ ...isTypeAware ? [
1494
+ makeParser(true, filesTypeAware),
1495
+ makeParser(false, files, filesTypeAware)
1496
+ ] : [makeParser(false, files)],
1497
+ {
1498
+ files,
1487
1499
  name: "antfu:typescript:rules",
1488
1500
  rules: {
1489
1501
  ...renameRules(
@@ -1505,6 +1517,8 @@ async function typescript(options = {}) {
1505
1517
  "ts/ban-types": ["error", { types: { Function: false } }],
1506
1518
  "ts/consistent-type-definitions": ["error", "interface"],
1507
1519
  "ts/consistent-type-imports": ["error", { disallowTypeAnnotations: false, prefer: "type-imports" }],
1520
+ "ts/method-signature-style": ["error", "property"],
1521
+ // https://www.totaltypescript.com/method-shorthand-syntax-considered-harmful
1508
1522
  "ts/no-dupe-class-members": "error",
1509
1523
  "ts/no-dynamic-delete": "off",
1510
1524
  "ts/no-explicit-any": "off",
@@ -1704,6 +1718,8 @@ async function vue(options = {}) {
1704
1718
  }],
1705
1719
  "vue/component-name-in-template-casing": ["error", "PascalCase"],
1706
1720
  "vue/component-options-name-casing": ["error", "PascalCase"],
1721
+ // this is deprecated
1722
+ "vue/component-tags-order": "off",
1707
1723
  "vue/custom-event-name-casing": ["error", "camelCase"],
1708
1724
  "vue/define-macros-order": ["error", {
1709
1725
  order: ["defineOptions", "defineProps", "defineEmits", "defineSlots"]
@@ -1717,7 +1733,6 @@ async function vue(options = {}) {
1717
1733
  "vue/multi-word-component-names": "off",
1718
1734
  "vue/no-dupe-keys": "off",
1719
1735
  "vue/no-empty-pattern": "error",
1720
- "vue/no-extra-parens": ["error", "functions"],
1721
1736
  "vue/no-irregular-whitespace": "error",
1722
1737
  "vue/no-loss-of-precision": "error",
1723
1738
  "vue/no-restricted-syntax": [
@@ -1899,6 +1914,7 @@ async function toml(options = {}) {
1899
1914
 
1900
1915
  // src/factory.ts
1901
1916
  var flatConfigProps = [
1917
+ "name",
1902
1918
  "files",
1903
1919
  "ignores",
1904
1920
  "languageOptions",
package/dist/index.d.cts CHANGED
@@ -316,7 +316,7 @@ interface OptionsConfig extends OptionsComponentExts {
316
316
  *
317
317
  * @default true
318
318
  */
319
- stylistic?: boolean | StylisticConfig;
319
+ stylistic?: boolean | (StylisticConfig & OptionsOverrides);
320
320
  /**
321
321
  * Enable react rules.
322
322
  *
package/dist/index.d.ts CHANGED
@@ -316,7 +316,7 @@ interface OptionsConfig extends OptionsComponentExts {
316
316
  *
317
317
  * @default true
318
318
  */
319
- stylistic?: boolean | StylisticConfig;
319
+ stylistic?: boolean | (StylisticConfig & OptionsOverrides);
320
320
  /**
321
321
  * Enable react rules.
322
322
  *
package/dist/index.js CHANGED
@@ -235,7 +235,6 @@ async function javascript(options = {}) {
235
235
  "no-multi-str": "error",
236
236
  "no-new": "error",
237
237
  "no-new-func": "error",
238
- "no-new-object": "error",
239
238
  "no-new-symbol": "error",
240
239
  "no-new-wrappers": "error",
241
240
  "no-obj-calls": "error",
@@ -1339,6 +1338,8 @@ async function typescript(options = {}) {
1339
1338
  ...componentExts.map((ext) => `**/*.${ext}`)
1340
1339
  ];
1341
1340
  const filesTypeAware = options.filesTypeAware ?? [GLOB_TS, GLOB_TSX];
1341
+ const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
1342
+ const isTypeAware = !!tsconfigPath;
1342
1343
  const typeAwareRules = {
1343
1344
  "dot-notation": "off",
1344
1345
  "no-implied-eval": "off",
@@ -1360,7 +1361,6 @@ async function typescript(options = {}) {
1360
1361
  "ts/restrict-template-expressions": "error",
1361
1362
  "ts/unbound-method": "error"
1362
1363
  };
1363
- const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
1364
1364
  const [
1365
1365
  pluginTs,
1366
1366
  parserTs
@@ -1368,29 +1368,41 @@ async function typescript(options = {}) {
1368
1368
  interopDefault(import("@typescript-eslint/eslint-plugin")),
1369
1369
  interopDefault(import("@typescript-eslint/parser"))
1370
1370
  ]);
1371
- return [
1372
- {
1373
- // Install the plugins without globs, so they can be configured separately.
1374
- name: "antfu:typescript:setup",
1375
- plugins: {
1376
- antfu: default2,
1377
- ts: pluginTs
1378
- }
1379
- },
1380
- {
1381
- files,
1371
+ function makeParser(typeAware, files2, ignores2) {
1372
+ return {
1373
+ files: files2,
1374
+ ...ignores2 ? { ignores: ignores2 } : {},
1382
1375
  languageOptions: {
1383
1376
  parser: parserTs,
1384
1377
  parserOptions: {
1385
1378
  extraFileExtensions: componentExts.map((ext) => `.${ext}`),
1386
1379
  sourceType: "module",
1387
- ...tsconfigPath ? {
1380
+ ...typeAware ? {
1388
1381
  project: tsconfigPath,
1389
1382
  tsconfigRootDir: process2.cwd()
1390
1383
  } : {},
1391
1384
  ...parserOptions
1392
1385
  }
1393
1386
  },
1387
+ name: `antfu:typescript:${typeAware ? "type-aware-parser" : "parser"}`
1388
+ };
1389
+ }
1390
+ return [
1391
+ {
1392
+ // Install the plugins without globs, so they can be configured separately.
1393
+ name: "antfu:typescript:setup",
1394
+ plugins: {
1395
+ antfu: default2,
1396
+ ts: pluginTs
1397
+ }
1398
+ },
1399
+ // assign type-aware parser for type-aware files and type-unaware parser for the rest
1400
+ ...isTypeAware ? [
1401
+ makeParser(true, filesTypeAware),
1402
+ makeParser(false, files, filesTypeAware)
1403
+ ] : [makeParser(false, files)],
1404
+ {
1405
+ files,
1394
1406
  name: "antfu:typescript:rules",
1395
1407
  rules: {
1396
1408
  ...renameRules(
@@ -1412,6 +1424,8 @@ async function typescript(options = {}) {
1412
1424
  "ts/ban-types": ["error", { types: { Function: false } }],
1413
1425
  "ts/consistent-type-definitions": ["error", "interface"],
1414
1426
  "ts/consistent-type-imports": ["error", { disallowTypeAnnotations: false, prefer: "type-imports" }],
1427
+ "ts/method-signature-style": ["error", "property"],
1428
+ // https://www.totaltypescript.com/method-shorthand-syntax-considered-harmful
1415
1429
  "ts/no-dupe-class-members": "error",
1416
1430
  "ts/no-dynamic-delete": "off",
1417
1431
  "ts/no-explicit-any": "off",
@@ -1611,6 +1625,8 @@ async function vue(options = {}) {
1611
1625
  }],
1612
1626
  "vue/component-name-in-template-casing": ["error", "PascalCase"],
1613
1627
  "vue/component-options-name-casing": ["error", "PascalCase"],
1628
+ // this is deprecated
1629
+ "vue/component-tags-order": "off",
1614
1630
  "vue/custom-event-name-casing": ["error", "camelCase"],
1615
1631
  "vue/define-macros-order": ["error", {
1616
1632
  order: ["defineOptions", "defineProps", "defineEmits", "defineSlots"]
@@ -1624,7 +1640,6 @@ async function vue(options = {}) {
1624
1640
  "vue/multi-word-component-names": "off",
1625
1641
  "vue/no-dupe-keys": "off",
1626
1642
  "vue/no-empty-pattern": "error",
1627
- "vue/no-extra-parens": ["error", "functions"],
1628
1643
  "vue/no-irregular-whitespace": "error",
1629
1644
  "vue/no-loss-of-precision": "error",
1630
1645
  "vue/no-restricted-syntax": [
@@ -1806,6 +1821,7 @@ async function toml(options = {}) {
1806
1821
 
1807
1822
  // src/factory.ts
1808
1823
  var flatConfigProps = [
1824
+ "name",
1809
1825
  "files",
1810
1826
  "ignores",
1811
1827
  "languageOptions",
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@antfu/eslint-config",
3
3
  "type": "module",
4
- "version": "2.6.2",
5
- "packageManager": "pnpm@8.14.0",
4
+ "version": "2.6.4",
5
+ "packageManager": "pnpm@8.15.1",
6
6
  "description": "Anthony's ESLint config",
7
7
  "author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
8
8
  "license": "MIT",
@@ -61,28 +61,28 @@
61
61
  "@antfu/eslint-define-config": "^1.23.0-2",
62
62
  "@antfu/install-pkg": "^0.3.1",
63
63
  "@eslint-types/jsdoc": "46.8.2-1",
64
- "@eslint-types/typescript-eslint": "^6.17.0",
64
+ "@eslint-types/typescript-eslint": "^6.19.1",
65
65
  "@eslint-types/unicorn": "^50.0.1",
66
- "@stylistic/eslint-plugin": "^1.5.3",
67
- "@typescript-eslint/eslint-plugin": "^6.18.0",
68
- "@typescript-eslint/parser": "^6.18.0",
66
+ "@stylistic/eslint-plugin": "^1.5.4",
67
+ "@typescript-eslint/eslint-plugin": "^6.20.0",
68
+ "@typescript-eslint/parser": "^6.20.0",
69
69
  "eslint-config-flat-gitignore": "^0.1.2",
70
70
  "eslint-merge-processors": "^0.1.0",
71
- "eslint-plugin-antfu": "^2.1.1",
71
+ "eslint-plugin-antfu": "^2.1.2",
72
72
  "eslint-plugin-eslint-comments": "^3.2.0",
73
73
  "eslint-plugin-i": "^2.29.1",
74
- "eslint-plugin-jsdoc": "^48.0.2",
75
- "eslint-plugin-jsonc": "^2.11.2",
74
+ "eslint-plugin-jsdoc": "^48.0.4",
75
+ "eslint-plugin-jsonc": "^2.13.0",
76
76
  "eslint-plugin-markdown": "^3.0.1",
77
- "eslint-plugin-n": "^16.6.1",
77
+ "eslint-plugin-n": "^16.6.2",
78
78
  "eslint-plugin-no-only-tests": "^3.1.0",
79
79
  "eslint-plugin-perfectionist": "^2.5.0",
80
- "eslint-plugin-toml": "^0.8.0",
80
+ "eslint-plugin-toml": "^0.9.2",
81
81
  "eslint-plugin-unicorn": "^50.0.1",
82
82
  "eslint-plugin-unused-imports": "^3.0.0",
83
- "eslint-plugin-vitest": "^0.3.20",
84
- "eslint-plugin-vue": "^9.19.2",
85
- "eslint-plugin-yml": "^1.11.0",
83
+ "eslint-plugin-vitest": "^0.3.21",
84
+ "eslint-plugin-vue": "^9.21.1",
85
+ "eslint-plugin-yml": "^1.12.2",
86
86
  "eslint-processor-vue-blocks": "^0.1.1",
87
87
  "globals": "^13.24.0",
88
88
  "jsonc-eslint-parser": "^2.4.0",
@@ -91,23 +91,23 @@
91
91
  "picocolors": "^1.0.0",
92
92
  "prompts": "^2.4.2",
93
93
  "toml-eslint-parser": "^0.9.3",
94
- "vue-eslint-parser": "^9.3.2",
94
+ "vue-eslint-parser": "^9.4.2",
95
95
  "yaml-eslint-parser": "^1.2.2",
96
96
  "yargs": "^17.7.2"
97
97
  },
98
98
  "devDependencies": {
99
99
  "@antfu/eslint-plugin-prettier": "^5.0.1-1",
100
100
  "@antfu/ni": "^0.21.12",
101
- "@stylistic/eslint-plugin-migrate": "^1.5.3",
102
- "@types/eslint": "^8.56.1",
101
+ "@stylistic/eslint-plugin-migrate": "^1.5.4",
102
+ "@types/eslint": "^8.56.2",
103
103
  "@types/fs-extra": "^11.0.4",
104
- "@types/node": "^20.10.7",
104
+ "@types/node": "^20.11.16",
105
105
  "@types/prompts": "^2.4.9",
106
106
  "@types/yargs": "^17.0.32",
107
- "@unocss/eslint-plugin": "^0.58.3",
108
- "bumpp": "^9.2.1",
107
+ "@unocss/eslint-plugin": "^0.58.4",
108
+ "bumpp": "^9.3.0",
109
109
  "eslint": "npm:eslint-ts-patch@^8.56.0-0",
110
- "eslint-flat-config-viewer": "^0.1.4",
110
+ "eslint-flat-config-viewer": "^0.1.11",
111
111
  "eslint-plugin-format": "^0.1.0",
112
112
  "eslint-plugin-react": "^7.33.2",
113
113
  "eslint-plugin-react-hooks": "^4.6.0",
@@ -118,16 +118,16 @@
118
118
  "execa": "^8.0.1",
119
119
  "fast-glob": "^3.3.2",
120
120
  "fs-extra": "^11.2.0",
121
- "lint-staged": "^15.2.0",
121
+ "lint-staged": "^15.2.1",
122
122
  "rimraf": "^5.0.5",
123
123
  "simple-git-hooks": "^2.9.0",
124
- "svelte": "^4.2.8",
124
+ "svelte": "^4.2.9",
125
125
  "svelte-eslint-parser": "^0.33.1",
126
126
  "tsup": "^8.0.1",
127
127
  "typescript": "^5.3.3",
128
- "vitest": "^1.1.3",
129
- "vue": "^3.4.5",
130
- "@antfu/eslint-config": "2.6.2"
128
+ "vitest": "^1.2.2",
129
+ "vue": "^3.4.15",
130
+ "@antfu/eslint-config": "2.6.4"
131
131
  },
132
132
  "simple-git-hooks": {
133
133
  "pre-commit": "pnpm lint-staged"