@lincy/eslint-config 4.2.4 → 4.2.6

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.
Files changed (3) hide show
  1. package/dist/index.cjs +52 -18
  2. package/dist/index.js +52 -18
  3. package/package.json +38 -38
package/dist/index.cjs CHANGED
@@ -216,7 +216,7 @@ async function imports(options = {}) {
216
216
  },
217
217
  rules: {
218
218
  "antfu/import-dedupe": "error",
219
- "antfu/no-import-dist": "error",
219
+ "antfu/no-import-dist": "off",
220
220
  "antfu/no-import-node-modules-by-path": "error",
221
221
  "import/first": "error",
222
222
  "import/no-duplicates": "error",
@@ -322,7 +322,6 @@ async function javascript(options = {}) {
322
322
  "no-multi-str": "error",
323
323
  "no-new": "error",
324
324
  "no-new-func": "error",
325
- "no-new-object": "error",
326
325
  "no-new-symbol": "error",
327
326
  "no-new-wrappers": "error",
328
327
  "no-obj-calls": "error",
@@ -506,7 +505,6 @@ async function jsdoc(options = {}) {
506
505
  {
507
506
  name: "eslint:jsdoc",
508
507
  plugins: {
509
- // @ts-expect-error missing types
510
508
  jsdoc: await interopDefault(import("eslint-plugin-jsdoc"))
511
509
  },
512
510
  rules: {
@@ -1392,6 +1390,8 @@ async function typescript(options = {}) {
1392
1390
  ...componentExts.map((ext) => `**/*.${ext}`)
1393
1391
  ];
1394
1392
  const filesTypeAware = options.filesTypeAware ?? [GLOB_TS, GLOB_TSX];
1393
+ const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
1394
+ const isTypeAware = !!tsconfigPath;
1395
1395
  const typeAwareRules = {
1396
1396
  "dot-notation": "off",
1397
1397
  "no-implied-eval": "off",
@@ -1413,7 +1413,6 @@ async function typescript(options = {}) {
1413
1413
  "ts/restrict-template-expressions": "error",
1414
1414
  "ts/unbound-method": "error"
1415
1415
  };
1416
- const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
1417
1416
  const [
1418
1417
  pluginTs,
1419
1418
  parserTs
@@ -1421,29 +1420,43 @@ async function typescript(options = {}) {
1421
1420
  interopDefault(import("@typescript-eslint/eslint-plugin")),
1422
1421
  interopDefault(import("@typescript-eslint/parser"))
1423
1422
  ]);
1424
- return [
1425
- {
1426
- // Install the plugins without globs, so they can be configured separately.
1427
- name: "eslint:typescript:setup",
1428
- plugins: {
1429
- antfu: import_eslint_plugin_antfu.default,
1430
- ts: pluginTs
1431
- }
1432
- },
1433
- {
1434
- files,
1423
+ function makeParser(typeAware, files2, ignores2) {
1424
+ return {
1425
+ files: files2,
1426
+ ...ignores2 ? { ignores: ignores2 } : {},
1435
1427
  languageOptions: {
1436
1428
  parser: parserTs,
1437
1429
  parserOptions: {
1438
1430
  extraFileExtensions: componentExts.map((ext) => `.${ext}`),
1439
1431
  sourceType: "module",
1440
- ...tsconfigPath ? {
1432
+ ...typeAware ? {
1441
1433
  project: tsconfigPath,
1442
1434
  tsconfigRootDir: import_node_process2.default.cwd()
1443
1435
  } : {},
1444
1436
  ...parserOptions
1445
1437
  }
1446
1438
  },
1439
+ name: `eslint:typescript:${typeAware ? "type-aware-parser" : "parser"}`
1440
+ };
1441
+ }
1442
+ return [
1443
+ {
1444
+ // Install the plugins without globs, so they can be configured separately.
1445
+ name: "eslint:typescript:setup",
1446
+ plugins: {
1447
+ antfu: import_eslint_plugin_antfu.default,
1448
+ ts: pluginTs
1449
+ }
1450
+ },
1451
+ // assign type-aware parser for type-aware files and type-unaware parser for the rest
1452
+ ...isTypeAware ? [
1453
+ makeParser(true, filesTypeAware),
1454
+ makeParser(false, files, filesTypeAware)
1455
+ ] : [
1456
+ makeParser(false, files)
1457
+ ],
1458
+ {
1459
+ files,
1447
1460
  name: "eslint:typescript:rules",
1448
1461
  rules: {
1449
1462
  ...renameRules(
@@ -1465,6 +1478,7 @@ async function typescript(options = {}) {
1465
1478
  "ts/ban-types": ["error", { types: { Function: false } }],
1466
1479
  "ts/consistent-type-definitions": ["error", "interface"],
1467
1480
  "ts/consistent-type-imports": ["error", { disallowTypeAnnotations: false, prefer: "type-imports" }],
1481
+ "ts/method-signature-style": ["error", "property"],
1468
1482
  "ts/no-dupe-class-members": "error",
1469
1483
  "ts/no-dynamic-delete": "off",
1470
1484
  "ts/no-explicit-any": "off",
@@ -1626,6 +1640,24 @@ async function vue(options = {}) {
1626
1640
  ]);
1627
1641
  return [
1628
1642
  {
1643
+ languageOptions: {
1644
+ globals: {
1645
+ computed: "readonly",
1646
+ defineEmits: "readonly",
1647
+ defineExpose: "readonly",
1648
+ defineProps: "readonly",
1649
+ onMounted: "readonly",
1650
+ onUnmounted: "readonly",
1651
+ reactive: "readonly",
1652
+ ref: "readonly",
1653
+ shallowReactive: "readonly",
1654
+ shallowRef: "readonly",
1655
+ toRef: "readonly",
1656
+ toRefs: "readonly",
1657
+ watch: "readonly",
1658
+ watchEffect: "readonly"
1659
+ }
1660
+ },
1629
1661
  name: "eslint:vue:setup",
1630
1662
  plugins: {
1631
1663
  vue: pluginVue
@@ -1672,6 +1704,7 @@ async function vue(options = {}) {
1672
1704
  }],
1673
1705
  "vue/component-name-in-template-casing": ["error", "PascalCase"],
1674
1706
  "vue/component-options-name-casing": ["error", "PascalCase"],
1707
+ "vue/component-tags-order": "off",
1675
1708
  "vue/custom-event-name-casing": vueVersion === "3" ? ["error", "camelCase"] : ["error", "kebab-case"],
1676
1709
  ...vueVersion === "2" ? {
1677
1710
  "vue/require-explicit-emits": "off"
@@ -1831,7 +1864,7 @@ async function toml(options = {}) {
1831
1864
  ]);
1832
1865
  return [
1833
1866
  {
1834
- name: "antfu:toml:setup",
1867
+ name: "eslint:toml:setup",
1835
1868
  plugins: {
1836
1869
  toml: pluginToml
1837
1870
  }
@@ -1841,7 +1874,7 @@ async function toml(options = {}) {
1841
1874
  languageOptions: {
1842
1875
  parser: parserToml
1843
1876
  },
1844
- name: "antfu:toml:rules",
1877
+ name: "eslint:toml:rules",
1845
1878
  rules: {
1846
1879
  "style/spaced-comment": "off",
1847
1880
  "toml/comma-style": "error",
@@ -1873,6 +1906,7 @@ async function toml(options = {}) {
1873
1906
 
1874
1907
  // src/factory.ts
1875
1908
  var flatConfigProps = [
1909
+ "name",
1876
1910
  "files",
1877
1911
  "ignores",
1878
1912
  "languageOptions",
package/dist/index.js CHANGED
@@ -127,7 +127,7 @@ async function imports(options = {}) {
127
127
  },
128
128
  rules: {
129
129
  "antfu/import-dedupe": "error",
130
- "antfu/no-import-dist": "error",
130
+ "antfu/no-import-dist": "off",
131
131
  "antfu/no-import-node-modules-by-path": "error",
132
132
  "import/first": "error",
133
133
  "import/no-duplicates": "error",
@@ -233,7 +233,6 @@ async function javascript(options = {}) {
233
233
  "no-multi-str": "error",
234
234
  "no-new": "error",
235
235
  "no-new-func": "error",
236
- "no-new-object": "error",
237
236
  "no-new-symbol": "error",
238
237
  "no-new-wrappers": "error",
239
238
  "no-obj-calls": "error",
@@ -417,7 +416,6 @@ async function jsdoc(options = {}) {
417
416
  {
418
417
  name: "eslint:jsdoc",
419
418
  plugins: {
420
- // @ts-expect-error missing types
421
419
  jsdoc: await interopDefault(import("eslint-plugin-jsdoc"))
422
420
  },
423
421
  rules: {
@@ -1303,6 +1301,8 @@ async function typescript(options = {}) {
1303
1301
  ...componentExts.map((ext) => `**/*.${ext}`)
1304
1302
  ];
1305
1303
  const filesTypeAware = options.filesTypeAware ?? [GLOB_TS, GLOB_TSX];
1304
+ const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
1305
+ const isTypeAware = !!tsconfigPath;
1306
1306
  const typeAwareRules = {
1307
1307
  "dot-notation": "off",
1308
1308
  "no-implied-eval": "off",
@@ -1324,7 +1324,6 @@ async function typescript(options = {}) {
1324
1324
  "ts/restrict-template-expressions": "error",
1325
1325
  "ts/unbound-method": "error"
1326
1326
  };
1327
- const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
1328
1327
  const [
1329
1328
  pluginTs,
1330
1329
  parserTs
@@ -1332,29 +1331,43 @@ async function typescript(options = {}) {
1332
1331
  interopDefault(import("@typescript-eslint/eslint-plugin")),
1333
1332
  interopDefault(import("@typescript-eslint/parser"))
1334
1333
  ]);
1335
- return [
1336
- {
1337
- // Install the plugins without globs, so they can be configured separately.
1338
- name: "eslint:typescript:setup",
1339
- plugins: {
1340
- antfu: default2,
1341
- ts: pluginTs
1342
- }
1343
- },
1344
- {
1345
- files,
1334
+ function makeParser(typeAware, files2, ignores2) {
1335
+ return {
1336
+ files: files2,
1337
+ ...ignores2 ? { ignores: ignores2 } : {},
1346
1338
  languageOptions: {
1347
1339
  parser: parserTs,
1348
1340
  parserOptions: {
1349
1341
  extraFileExtensions: componentExts.map((ext) => `.${ext}`),
1350
1342
  sourceType: "module",
1351
- ...tsconfigPath ? {
1343
+ ...typeAware ? {
1352
1344
  project: tsconfigPath,
1353
1345
  tsconfigRootDir: process2.cwd()
1354
1346
  } : {},
1355
1347
  ...parserOptions
1356
1348
  }
1357
1349
  },
1350
+ name: `eslint:typescript:${typeAware ? "type-aware-parser" : "parser"}`
1351
+ };
1352
+ }
1353
+ return [
1354
+ {
1355
+ // Install the plugins without globs, so they can be configured separately.
1356
+ name: "eslint:typescript:setup",
1357
+ plugins: {
1358
+ antfu: default2,
1359
+ ts: pluginTs
1360
+ }
1361
+ },
1362
+ // assign type-aware parser for type-aware files and type-unaware parser for the rest
1363
+ ...isTypeAware ? [
1364
+ makeParser(true, filesTypeAware),
1365
+ makeParser(false, files, filesTypeAware)
1366
+ ] : [
1367
+ makeParser(false, files)
1368
+ ],
1369
+ {
1370
+ files,
1358
1371
  name: "eslint:typescript:rules",
1359
1372
  rules: {
1360
1373
  ...renameRules(
@@ -1376,6 +1389,7 @@ async function typescript(options = {}) {
1376
1389
  "ts/ban-types": ["error", { types: { Function: false } }],
1377
1390
  "ts/consistent-type-definitions": ["error", "interface"],
1378
1391
  "ts/consistent-type-imports": ["error", { disallowTypeAnnotations: false, prefer: "type-imports" }],
1392
+ "ts/method-signature-style": ["error", "property"],
1379
1393
  "ts/no-dupe-class-members": "error",
1380
1394
  "ts/no-dynamic-delete": "off",
1381
1395
  "ts/no-explicit-any": "off",
@@ -1537,6 +1551,24 @@ async function vue(options = {}) {
1537
1551
  ]);
1538
1552
  return [
1539
1553
  {
1554
+ languageOptions: {
1555
+ globals: {
1556
+ computed: "readonly",
1557
+ defineEmits: "readonly",
1558
+ defineExpose: "readonly",
1559
+ defineProps: "readonly",
1560
+ onMounted: "readonly",
1561
+ onUnmounted: "readonly",
1562
+ reactive: "readonly",
1563
+ ref: "readonly",
1564
+ shallowReactive: "readonly",
1565
+ shallowRef: "readonly",
1566
+ toRef: "readonly",
1567
+ toRefs: "readonly",
1568
+ watch: "readonly",
1569
+ watchEffect: "readonly"
1570
+ }
1571
+ },
1540
1572
  name: "eslint:vue:setup",
1541
1573
  plugins: {
1542
1574
  vue: pluginVue
@@ -1583,6 +1615,7 @@ async function vue(options = {}) {
1583
1615
  }],
1584
1616
  "vue/component-name-in-template-casing": ["error", "PascalCase"],
1585
1617
  "vue/component-options-name-casing": ["error", "PascalCase"],
1618
+ "vue/component-tags-order": "off",
1586
1619
  "vue/custom-event-name-casing": vueVersion === "3" ? ["error", "camelCase"] : ["error", "kebab-case"],
1587
1620
  ...vueVersion === "2" ? {
1588
1621
  "vue/require-explicit-emits": "off"
@@ -1742,7 +1775,7 @@ async function toml(options = {}) {
1742
1775
  ]);
1743
1776
  return [
1744
1777
  {
1745
- name: "antfu:toml:setup",
1778
+ name: "eslint:toml:setup",
1746
1779
  plugins: {
1747
1780
  toml: pluginToml
1748
1781
  }
@@ -1752,7 +1785,7 @@ async function toml(options = {}) {
1752
1785
  languageOptions: {
1753
1786
  parser: parserToml
1754
1787
  },
1755
- name: "antfu:toml:rules",
1788
+ name: "eslint:toml:rules",
1756
1789
  rules: {
1757
1790
  "style/spaced-comment": "off",
1758
1791
  "toml/comma-style": "error",
@@ -1784,6 +1817,7 @@ async function toml(options = {}) {
1784
1817
 
1785
1818
  // src/factory.ts
1786
1819
  var flatConfigProps = [
1820
+ "name",
1787
1821
  "files",
1788
1822
  "ignores",
1789
1823
  "languageOptions",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lincy/eslint-config",
3
3
  "type": "module",
4
- "version": "4.2.4",
4
+ "version": "4.2.6",
5
5
  "packageManager": "pnpm@8.7.6",
6
6
  "description": "LinCenYing's ESLint config",
7
7
  "author": "LinCenYing <lincenying@gmail.com> (https://github.com/lincenying/)",
@@ -64,66 +64,66 @@
64
64
  "dependencies": {
65
65
  "@antfu/eslint-define-config": "1.23.0-2",
66
66
  "@antfu/install-pkg": "^0.3.1",
67
- "@stylistic/eslint-plugin": "1.5.1",
68
- "@typescript-eslint/eslint-plugin": "^6.16.0",
69
- "@typescript-eslint/parser": "^6.16.0",
70
- "eslint-config-flat-gitignore": "^0.1.2",
67
+ "@stylistic/eslint-plugin": "1.6.3",
68
+ "@typescript-eslint/eslint-plugin": "^7.2.0",
69
+ "@typescript-eslint/parser": "^7.2.0",
70
+ "eslint-config-flat-gitignore": "^0.1.3",
71
71
  "eslint-merge-processors": "^0.1.0",
72
72
  "eslint-parser-plain": "^0.1.0",
73
- "eslint-plugin-antfu": "^2.1.1",
73
+ "eslint-plugin-antfu": "^2.1.2",
74
74
  "eslint-plugin-eslint-comments": "^3.2.0",
75
75
  "eslint-plugin-i": "^2.29.1",
76
- "eslint-plugin-jsdoc": "^46.9.1",
77
- "eslint-plugin-jsonc": "^2.11.2",
78
- "eslint-plugin-markdown": "^3.0.1",
79
- "eslint-plugin-n": "^16.5.0",
76
+ "eslint-plugin-jsdoc": "^48.2.1",
77
+ "eslint-plugin-jsonc": "^2.13.0",
78
+ "eslint-plugin-markdown": "^4.0.1",
79
+ "eslint-plugin-n": "^16.6.2",
80
80
  "eslint-plugin-no-only-tests": "^3.1.0",
81
- "eslint-plugin-perfectionist": "^2.5.0",
82
- "eslint-plugin-toml": "^0.8.0",
83
- "eslint-plugin-unicorn": "^50.0.1",
84
- "eslint-plugin-unused-imports": "^3.0.0",
85
- "eslint-plugin-vitest": "^0.3.20",
86
- "eslint-plugin-vue": "^9.19.2",
87
- "eslint-plugin-yml": "^1.11.0",
81
+ "eslint-plugin-perfectionist": "^2.6.0",
82
+ "eslint-plugin-toml": "^0.9.2",
83
+ "eslint-plugin-unicorn": "^51.0.1",
84
+ "eslint-plugin-unused-imports": "^3.1.0",
85
+ "eslint-plugin-vitest": "^0.3.25",
86
+ "eslint-plugin-vue": "^9.23.0",
87
+ "eslint-plugin-yml": "^1.12.2",
88
88
  "eslint-processor-vue-blocks": "^0.1.1",
89
- "globals": "^13.24.0",
89
+ "globals": "^14.0.0",
90
90
  "jsonc-eslint-parser": "^2.4.0",
91
91
  "local-pkg": "^0.5.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
  },
97
97
  "devDependencies": {
98
98
  "@antfu/ni": "^0.21.12",
99
- "@eslint-types/jsdoc": "46.9.0",
100
- "@eslint-types/typescript-eslint": "^6.12.0",
101
- "@eslint-types/unicorn": "^49.0.0",
99
+ "@eslint-types/jsdoc": "48.2.0",
100
+ "@eslint-types/typescript-eslint": "^7.0.2",
101
+ "@eslint-types/unicorn": "^51.0.1",
102
102
  "@lincy/eslint-config": "workspace:*",
103
- "@stylistic/eslint-plugin-migrate": "^1.5.1",
104
- "@types/eslint": "^8.56.0",
105
- "@types/node": "^20.10.5",
103
+ "@stylistic/eslint-plugin-migrate": "^1.6.3",
104
+ "@types/eslint": "^8.56.5",
105
+ "@types/node": "^20.11.26",
106
106
  "@types/prompts": "^2.4.9",
107
- "@unocss/eslint-plugin": "^0.58.0",
108
- "bumpp": "^9.2.1",
109
- "eslint": "^8.56.0",
110
- "eslint-flat-config-viewer": "^0.1.3",
107
+ "@unocss/eslint-plugin": "^0.58.5",
108
+ "bumpp": "^9.4.0",
109
+ "eslint": "^8.57.0",
110
+ "eslint-flat-config-viewer": "^0.1.11",
111
111
  "eslint-plugin-format": "^0.1.0",
112
- "eslint-plugin-react": "^7.33.2",
112
+ "eslint-plugin-react": "^7.34.0",
113
113
  "eslint-plugin-react-hooks": "^4.6.0",
114
114
  "eslint-plugin-react-refresh": "^0.4.5",
115
- "esno": "^4.0.0",
116
- "lint-staged": "^15.2.0",
117
- "prettier": "^3.1.1",
115
+ "esno": "^4.7.0",
116
+ "lint-staged": "^15.2.2",
117
+ "prettier": "^3.2.5",
118
118
  "rimraf": "^5.0.5",
119
- "simple-git-hooks": "^2.9.0",
119
+ "simple-git-hooks": "^2.10.0",
120
120
  "simple-open-url": "^3.0.1",
121
121
  "sucrase": "^3.35.0",
122
- "tsup": "^8.0.1",
123
- "typescript": "^5.3.3",
122
+ "tsup": "^8.0.2",
123
+ "typescript": "^5.4.2",
124
124
  "unbuild": "^2.0.0",
125
- "vitest": "^1.1.0",
126
- "vue": "^3.3.13"
125
+ "vitest": "^1.3.1",
126
+ "vue": "^3.4.21"
127
127
  },
128
128
  "pnpm": {
129
129
  "peerDependencyRules": {