@coderwyd/eslint-config 4.6.2 → 4.7.0

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/dist/index.js CHANGED
@@ -123,8 +123,7 @@ const isCwdInScope = isPackageExists("@coderwyd/eslint-config");
123
123
  * Combine array and non-array configs into a single array.
124
124
  */
125
125
  async function combine(...configs$1) {
126
- const resolved = await Promise.all(configs$1);
127
- return resolved.flat();
126
+ return (await Promise.all(configs$1)).flat();
128
127
  }
129
128
  /**
130
129
  * Rename plugin prefixes in a rule object.
@@ -702,6 +701,9 @@ async function react(options = {}) {
702
701
  },
703
702
  name: "coderwyd/react/rules",
704
703
  rules: {
704
+ "react/jsx-no-comment-textnodes": "warn",
705
+ "react/jsx-no-duplicate-props": "warn",
706
+ "react/jsx-uses-vars": "warn",
705
707
  "react/no-access-state-in-setstate": "error",
706
708
  "react/no-array-index-key": "warn",
707
709
  "react/no-children-count": "warn",
@@ -710,7 +712,6 @@ async function react(options = {}) {
710
712
  "react/no-children-only": "warn",
711
713
  "react/no-children-to-array": "warn",
712
714
  "react/no-clone-element": "warn",
713
- "react/no-comment-textnodes": "warn",
714
715
  "react/no-component-will-mount": "error",
715
716
  "react/no-component-will-receive-props": "error",
716
717
  "react/no-component-will-update": "error",
@@ -718,7 +719,6 @@ async function react(options = {}) {
718
719
  "react/no-create-ref": "error",
719
720
  "react/no-default-props": "error",
720
721
  "react/no-direct-mutation-state": "error",
721
- "react/no-duplicate-jsx-props": "warn",
722
722
  "react/no-duplicate-key": "warn",
723
723
  "react/no-forward-ref": "warn",
724
724
  "react/no-implicit-key": "warn",
@@ -730,6 +730,7 @@ async function react(options = {}) {
730
730
  "react/no-set-state-in-component-did-update": "warn",
731
731
  "react/no-set-state-in-component-will-update": "warn",
732
732
  "react/no-string-refs": "error",
733
+ "react/no-unnecessary-use-prefix": "warn",
733
734
  "react/no-unsafe-component-will-mount": "warn",
734
735
  "react/no-unsafe-component-will-receive-props": "warn",
735
736
  "react/no-unsafe-component-will-update": "warn",
@@ -739,7 +740,7 @@ async function react(options = {}) {
739
740
  "react/no-unused-state": "warn",
740
741
  "react/no-use-context": "warn",
741
742
  "react/no-useless-forward-ref": "warn",
742
- "react/use-jsx-vars": "warn",
743
+ "react/prefer-use-state-lazy-initialization": "warn",
743
744
  "react-dom/no-dangerously-set-innerhtml": "warn",
744
745
  "react-dom/no-dangerously-set-innerhtml-with-children": "error",
745
746
  "react-dom/no-find-dom-node": "error",
@@ -757,9 +758,7 @@ async function react(options = {}) {
757
758
  "react-dom/no-void-elements-with-children": "error",
758
759
  "react-hooks/exhaustive-deps": "warn",
759
760
  "react-hooks/rules-of-hooks": "error",
760
- "react-hooks/react-compiler": "warn",
761
761
  "react-hooks-extra/no-direct-set-state-in-use-effect": "warn",
762
- "react-hooks-extra/no-unnecessary-use-prefix": "warn",
763
762
  "react-web-api/no-leaked-event-listener": "warn",
764
763
  "react-web-api/no-leaked-interval": "warn",
765
764
  "react-web-api/no-leaked-resize-observer": "warn",
@@ -798,7 +797,7 @@ async function react(options = {}) {
798
797
  ...isTypeAware ? [{
799
798
  files: filesTypeAware,
800
799
  ignores: ignoresTypeAware,
801
- name: "antfu/react/type-aware-rules",
800
+ name: "coderwyd/react/type-aware-rules",
802
801
  rules: { ...typeAwareRules }
803
802
  }] : []
804
803
  ];
@@ -1168,10 +1167,9 @@ async function svelte(options = {}) {
1168
1167
  async function tailwindcss(options = {}) {
1169
1168
  const { overrides } = options;
1170
1169
  await ensurePackages(["eslint-plugin-tailwindcss"]);
1171
- const pluginTailwindcss = await interopDefault(import("eslint-plugin-tailwindcss"));
1172
1170
  return [{
1173
1171
  name: "coderwyd/tailwindcss/rules",
1174
- plugins: { tailwindcss: pluginTailwindcss },
1172
+ plugins: { tailwindcss: await interopDefault(import("eslint-plugin-tailwindcss")) },
1175
1173
  rules: {
1176
1174
  "tailwindcss/classnames-order": "warn",
1177
1175
  "tailwindcss/enforces-negative-arbitrary-values": "warn",
@@ -1236,27 +1234,55 @@ async function typescript(options = {}) {
1236
1234
  const tsconfigPath = options.tsconfigPath;
1237
1235
  const isTypeAware = !!tsconfigPath;
1238
1236
  const typeAwareRules = {
1239
- "dot-notation": "off",
1237
+ "no-array-constructor": "off",
1240
1238
  "no-implied-eval": "off",
1239
+ "no-throw-literal": "off",
1240
+ "no-unused-expressions": "off",
1241
+ "no-unused-vars": "off",
1242
+ "prefer-promise-reject-errors": "off",
1241
1243
  "require-await": "off",
1242
1244
  "ts/await-thenable": "error",
1243
- "ts/dot-notation": ["error", { allowKeywords: true }],
1245
+ "ts/ban-ts-comment": "error",
1246
+ "ts/no-array-constructor": "error",
1247
+ "ts/no-array-delete": "error",
1248
+ "ts/no-base-to-string": "error",
1249
+ "ts/no-duplicate-enum-values": "error",
1250
+ "ts/no-duplicate-type-constituents": "error",
1251
+ "ts/no-empty-object-type": "error",
1252
+ "ts/no-explicit-any": "error",
1253
+ "ts/no-extra-non-null-assertion": "error",
1244
1254
  "ts/no-floating-promises": "error",
1245
1255
  "ts/no-for-in-array": "error",
1246
1256
  "ts/no-implied-eval": "error",
1257
+ "ts/no-misused-new": "error",
1247
1258
  "ts/no-misused-promises": "error",
1259
+ "ts/no-namespace": "error",
1260
+ "ts/no-non-null-asserted-optional-chain": "error",
1261
+ "ts/no-redundant-type-constituents": "error",
1262
+ "ts/no-require-imports": "error",
1263
+ "ts/no-this-alias": "error",
1248
1264
  "ts/no-unnecessary-type-assertion": "error",
1265
+ "ts/no-unnecessary-type-constraint": "error",
1249
1266
  "ts/no-unsafe-argument": "error",
1250
1267
  "ts/no-unsafe-assignment": "error",
1251
1268
  "ts/no-unsafe-call": "error",
1269
+ "ts/no-unsafe-declaration-merging": "error",
1270
+ "ts/no-unsafe-enum-comparison": "error",
1271
+ "ts/no-unsafe-function-type": "error",
1252
1272
  "ts/no-unsafe-member-access": "error",
1253
1273
  "ts/no-unsafe-return": "error",
1254
- "ts/promise-function-async": "error",
1274
+ "ts/no-unsafe-unary-minus": "error",
1275
+ "ts/no-unused-expressions": "error",
1276
+ "ts/no-unused-vars": "error",
1277
+ "ts/no-wrapper-object-types": "error",
1278
+ "ts/only-throw-error": "error",
1279
+ "ts/prefer-as-const": "error",
1280
+ "ts/prefer-namespace-keyword": "error",
1281
+ "ts/prefer-promise-reject-errors": "error",
1282
+ "ts/require-await": "error",
1255
1283
  "ts/restrict-plus-operands": "error",
1256
1284
  "ts/restrict-template-expressions": "error",
1257
- "ts/return-await": "error",
1258
- "ts/strict-boolean-expressions": "error",
1259
- "ts/switch-exhaustiveness-check": "error",
1285
+ "ts/triple-slash-reference": "error",
1260
1286
  "ts/unbound-method": "error"
1261
1287
  };
1262
1288
  const [pluginTs, parserTs] = await Promise.all([interopDefault(import("@typescript-eslint/eslint-plugin")), interopDefault(import("@typescript-eslint/parser"))]);
@@ -1429,10 +1455,9 @@ function unicorn(options = {}) {
1429
1455
  async function unocss(options = {}) {
1430
1456
  const { attributify = true, strict = false } = options;
1431
1457
  await ensurePackages(["@unocss/eslint-plugin"]);
1432
- const pluginUnoCSS = await interopDefault(import("@unocss/eslint-plugin"));
1433
1458
  return [{
1434
1459
  name: "coderwyd/unocss/rules",
1435
- plugins: { unocss: pluginUnoCSS },
1460
+ plugins: { unocss: await interopDefault(import("@unocss/eslint-plugin")) },
1436
1461
  rules: {
1437
1462
  "unocss/order": "warn",
1438
1463
  ...attributify ? { "unocss/order-attributify": "warn" } : {},
@@ -1447,7 +1472,7 @@ async function vue(options = {}) {
1447
1472
  const { files = [GLOB_VUE], overrides = {} } = options;
1448
1473
  const [pluginVue, parserVue] = await Promise.all([interopDefault(import("eslint-plugin-vue")), interopDefault(import("vue-eslint-parser"))]);
1449
1474
  const isVue3 = getVueVersion() === 3;
1450
- const configKeys = isVue3 ? [
1475
+ const vueRules = (isVue3 ? [
1451
1476
  "essential",
1452
1477
  "strongly-recommended",
1453
1478
  "recommended"
@@ -1455,8 +1480,7 @@ async function vue(options = {}) {
1455
1480
  "vue2-essential",
1456
1481
  "vue2-strongly-recommended",
1457
1482
  "vue2-recommended"
1458
- ];
1459
- const vueRules = configKeys.reduce((preRules, key) => {
1483
+ ]).reduce((preRules, key) => {
1460
1484
  const config = pluginVue.configs[key];
1461
1485
  return {
1462
1486
  ...preRules,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@coderwyd/eslint-config",
3
3
  "type": "module",
4
- "version": "4.6.2",
4
+ "version": "4.7.0",
5
5
  "description": "Donny's ESLint config",
6
6
  "author": "Donny Wang <donny526@outlook.com> (https://github.com/coderwyd/)",
7
7
  "license": "MIT",
@@ -71,60 +71,61 @@
71
71
  "dependencies": {
72
72
  "@antfu/install-pkg": "^1.1.0",
73
73
  "@eslint-community/eslint-plugin-eslint-comments": "^4.5.0",
74
- "@typescript-eslint/eslint-plugin": "^8.42.0",
75
- "@typescript-eslint/parser": "^8.42.0",
76
- "@vitest/eslint-plugin": "^1.3.7",
74
+ "@typescript-eslint/eslint-plugin": "^8.45.0",
75
+ "@typescript-eslint/parser": "^8.45.0",
76
+ "@vitest/eslint-plugin": "^1.3.13",
77
77
  "eslint-config-flat-gitignore": "^2.1.0",
78
78
  "eslint-config-prettier": "^10.1.8",
79
79
  "eslint-plugin-antfu": "^3.1.1",
80
80
  "eslint-plugin-command": "^3.3.1",
81
- "eslint-plugin-de-morgan": "^1.3.1",
82
- "eslint-plugin-eslint-comments": "^3.2.0",
81
+ "eslint-plugin-de-morgan": "^2.0.0",
83
82
  "eslint-plugin-import-lite": "^0.3.0",
84
- "eslint-plugin-jsdoc": "^54.3.1",
83
+ "eslint-plugin-jsdoc": "^60.5.0",
85
84
  "eslint-plugin-jsonc": "^2.20.1",
86
- "eslint-plugin-n": "^17.21.3",
85
+ "eslint-plugin-n": "^17.23.1",
87
86
  "eslint-plugin-no-only-tests": "^3.3.0",
88
87
  "eslint-plugin-perfectionist": "^4.15.0",
89
88
  "eslint-plugin-regexp": "^2.10.0",
90
- "eslint-plugin-unicorn": "^60.0.0",
89
+ "eslint-plugin-unicorn": "^61.0.2",
91
90
  "eslint-plugin-unused-imports": "^4.2.0",
92
- "eslint-plugin-vue": "^10.4.0",
91
+ "eslint-plugin-vue": "^10.5.0",
93
92
  "eslint-plugin-yml": "^1.18.0",
94
- "eslint-typegen": "^2.3.0",
95
- "globals": "^16.3.0",
96
- "jsonc-eslint-parser": "^2.4.0",
93
+ "globals": "^16.4.0",
94
+ "jsonc-eslint-parser": "^2.4.1",
97
95
  "local-pkg": "^1.1.2",
98
96
  "parse-gitignore": "^2.0.0",
99
97
  "picocolors": "^1.1.1",
100
- "prettier": "^3.6.2",
101
98
  "prompts": "^2.4.2",
102
99
  "vue-eslint-parser": "^10.2.0",
103
100
  "yaml-eslint-parser": "^1.3.0",
104
101
  "yargs": "^18.0.0"
105
102
  },
106
103
  "devDependencies": {
107
- "@antfu/ni": "^25.0.0",
108
- "@eslint-react/eslint-plugin": "^1.52.9",
109
- "@eslint/config-inspector": "^1.2.0",
104
+ "@antfu/ni": "^26.1.0",
105
+ "@eslint-react/eslint-plugin": "^2.0.3",
106
+ "@eslint/config-inspector": "^1.3.0",
110
107
  "@types/eslint-config-prettier": "^6.11.3",
111
- "@types/node": "^24.3.0",
108
+ "@types/node": "^24.6.0",
112
109
  "@types/prompts": "^2.4.9",
113
110
  "@types/yargs": "^17.0.33",
114
- "@unocss/eslint-plugin": "^66.5.0",
111
+ "@unocss/eslint-plugin": "^66.5.2",
115
112
  "bumpp": "^10.2.3",
116
- "eslint": "^9.34.0",
113
+ "eslint": "^9.36.0",
117
114
  "eslint-plugin-react-hooks": "6.0.0-rc1",
118
- "eslint-plugin-react-refresh": "^0.4.20",
119
- "eslint-plugin-svelte": "^3.12.0",
115
+ "eslint-plugin-react-refresh": "^0.4.22",
116
+ "eslint-plugin-svelte": "^3.12.4",
120
117
  "eslint-plugin-tailwindcss": "^3.18.2",
121
- "jiti": "^2.5.1",
118
+ "eslint-typegen": "^2.3.0",
119
+ "jiti": "^2.6.0",
122
120
  "nano-staged": "^0.8.0",
121
+ "prettier": "^3.6.2",
122
+ "publint": "^0.3.13",
123
123
  "simple-git-hooks": "^2.13.1",
124
- "svelte": "^5.38.6",
125
- "svelte-eslint-parser": "^1.3.1",
126
- "tsdown": "^0.14.2",
127
- "typescript": "^5.9.2"
124
+ "svelte": "^5.39.6",
125
+ "svelte-eslint-parser": "^1.3.3",
126
+ "tsdown": "^0.15.5",
127
+ "typescript": "^5.9.2",
128
+ "unplugin-unused": "^0.5.3"
128
129
  },
129
130
  "simple-git-hooks": {
130
131
  "pre-commit": "pnpm exec nano-staged"