@coderwyd/eslint-config 4.6.3 → 4.7.1

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.
@@ -221,12 +220,11 @@ function isInGitHooksOrLintStaged() {
221
220
  //#endregion
222
221
  //#region src/configs/imports.ts
223
222
  async function imports() {
224
- const pluginImport = await interopDefault(import("eslint-plugin-import-lite"));
225
223
  return [{
226
224
  name: "coderwyd/imports/rules",
227
225
  plugins: {
228
226
  antfu: pluginAntfu,
229
- import: pluginImport
227
+ import: await interopDefault(import("eslint-plugin-import-lite"))
230
228
  },
231
229
  rules: {
232
230
  "antfu/import-dedupe": "error",
@@ -702,6 +700,9 @@ async function react(options = {}) {
702
700
  },
703
701
  name: "coderwyd/react/rules",
704
702
  rules: {
703
+ "react/jsx-no-comment-textnodes": "warn",
704
+ "react/jsx-no-duplicate-props": "warn",
705
+ "react/jsx-uses-vars": "warn",
705
706
  "react/no-access-state-in-setstate": "error",
706
707
  "react/no-array-index-key": "warn",
707
708
  "react/no-children-count": "warn",
@@ -710,7 +711,6 @@ async function react(options = {}) {
710
711
  "react/no-children-only": "warn",
711
712
  "react/no-children-to-array": "warn",
712
713
  "react/no-clone-element": "warn",
713
- "react/no-comment-textnodes": "warn",
714
714
  "react/no-component-will-mount": "error",
715
715
  "react/no-component-will-receive-props": "error",
716
716
  "react/no-component-will-update": "error",
@@ -718,7 +718,6 @@ async function react(options = {}) {
718
718
  "react/no-create-ref": "error",
719
719
  "react/no-default-props": "error",
720
720
  "react/no-direct-mutation-state": "error",
721
- "react/no-duplicate-jsx-props": "warn",
722
721
  "react/no-duplicate-key": "warn",
723
722
  "react/no-forward-ref": "warn",
724
723
  "react/no-implicit-key": "warn",
@@ -730,6 +729,7 @@ async function react(options = {}) {
730
729
  "react/no-set-state-in-component-did-update": "warn",
731
730
  "react/no-set-state-in-component-will-update": "warn",
732
731
  "react/no-string-refs": "error",
732
+ "react/no-unnecessary-use-prefix": "warn",
733
733
  "react/no-unsafe-component-will-mount": "warn",
734
734
  "react/no-unsafe-component-will-receive-props": "warn",
735
735
  "react/no-unsafe-component-will-update": "warn",
@@ -739,7 +739,7 @@ async function react(options = {}) {
739
739
  "react/no-unused-state": "warn",
740
740
  "react/no-use-context": "warn",
741
741
  "react/no-useless-forward-ref": "warn",
742
- "react/use-jsx-vars": "warn",
742
+ "react/prefer-use-state-lazy-initialization": "warn",
743
743
  "react-dom/no-dangerously-set-innerhtml": "warn",
744
744
  "react-dom/no-dangerously-set-innerhtml-with-children": "error",
745
745
  "react-dom/no-find-dom-node": "error",
@@ -755,11 +755,8 @@ async function react(options = {}) {
755
755
  "react-dom/no-unsafe-target-blank": "warn",
756
756
  "react-dom/no-use-form-state": "error",
757
757
  "react-dom/no-void-elements-with-children": "error",
758
- "react-hooks/exhaustive-deps": "warn",
759
- "react-hooks/rules-of-hooks": "error",
760
- "react-hooks/react-compiler": "warn",
758
+ ...pluginReactHooks.configs.recommended.rules,
761
759
  "react-hooks-extra/no-direct-set-state-in-use-effect": "warn",
762
- "react-hooks-extra/no-unnecessary-use-prefix": "warn",
763
760
  "react-web-api/no-leaked-event-listener": "warn",
764
761
  "react-web-api/no-leaked-interval": "warn",
765
762
  "react-web-api/no-leaked-resize-observer": "warn",
@@ -798,7 +795,7 @@ async function react(options = {}) {
798
795
  ...isTypeAware ? [{
799
796
  files: filesTypeAware,
800
797
  ignores: ignoresTypeAware,
801
- name: "antfu/react/type-aware-rules",
798
+ name: "coderwyd/react/type-aware-rules",
802
799
  rules: { ...typeAwareRules }
803
800
  }] : []
804
801
  ];
@@ -1168,10 +1165,9 @@ async function svelte(options = {}) {
1168
1165
  async function tailwindcss(options = {}) {
1169
1166
  const { overrides } = options;
1170
1167
  await ensurePackages(["eslint-plugin-tailwindcss"]);
1171
- const pluginTailwindcss = await interopDefault(import("eslint-plugin-tailwindcss"));
1172
1168
  return [{
1173
1169
  name: "coderwyd/tailwindcss/rules",
1174
- plugins: { tailwindcss: pluginTailwindcss },
1170
+ plugins: { tailwindcss: await interopDefault(import("eslint-plugin-tailwindcss")) },
1175
1171
  rules: {
1176
1172
  "tailwindcss/classnames-order": "warn",
1177
1173
  "tailwindcss/enforces-negative-arbitrary-values": "warn",
@@ -1457,10 +1453,9 @@ function unicorn(options = {}) {
1457
1453
  async function unocss(options = {}) {
1458
1454
  const { attributify = true, strict = false } = options;
1459
1455
  await ensurePackages(["@unocss/eslint-plugin"]);
1460
- const pluginUnoCSS = await interopDefault(import("@unocss/eslint-plugin"));
1461
1456
  return [{
1462
1457
  name: "coderwyd/unocss/rules",
1463
- plugins: { unocss: pluginUnoCSS },
1458
+ plugins: { unocss: await interopDefault(import("@unocss/eslint-plugin")) },
1464
1459
  rules: {
1465
1460
  "unocss/order": "warn",
1466
1461
  ...attributify ? { "unocss/order-attributify": "warn" } : {},
@@ -1475,7 +1470,7 @@ async function vue(options = {}) {
1475
1470
  const { files = [GLOB_VUE], overrides = {} } = options;
1476
1471
  const [pluginVue, parserVue] = await Promise.all([interopDefault(import("eslint-plugin-vue")), interopDefault(import("vue-eslint-parser"))]);
1477
1472
  const isVue3 = getVueVersion() === 3;
1478
- const configKeys = isVue3 ? [
1473
+ const vueRules = (isVue3 ? [
1479
1474
  "essential",
1480
1475
  "strongly-recommended",
1481
1476
  "recommended"
@@ -1483,8 +1478,7 @@ async function vue(options = {}) {
1483
1478
  "vue2-essential",
1484
1479
  "vue2-strongly-recommended",
1485
1480
  "vue2-recommended"
1486
- ];
1487
- const vueRules = configKeys.reduce((preRules, key) => {
1481
+ ]).reduce((preRules, key) => {
1488
1482
  const config = pluginVue.configs[key];
1489
1483
  return {
1490
1484
  ...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.3",
4
+ "version": "4.7.1",
5
5
  "description": "Donny's ESLint config",
6
6
  "author": "Donny Wang <donny526@outlook.com> (https://github.com/coderwyd/)",
7
7
  "license": "MIT",
@@ -36,7 +36,7 @@
36
36
  "@eslint-react/eslint-plugin": "^1.5.8",
37
37
  "@unocss/eslint-plugin": ">=0.50.0",
38
38
  "eslint": "^9.5.0",
39
- "eslint-plugin-react-hooks": "^4.6.0 || ^5.0.0",
39
+ "eslint-plugin-react-hooks": "^4.6.0 || ^5.0.0 || ^7.0.0",
40
40
  "eslint-plugin-react-refresh": "^0.4.4",
41
41
  "eslint-plugin-svelte": ">=2.35.1",
42
42
  "eslint-plugin-tailwindcss": "^3.16.0",
@@ -71,60 +71,60 @@
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.46.1",
75
+ "@typescript-eslint/parser": "^8.46.1",
76
+ "@vitest/eslint-plugin": "^1.3.20",
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",
85
- "eslint-plugin-jsonc": "^2.20.1",
86
- "eslint-plugin-n": "^17.21.3",
83
+ "eslint-plugin-jsdoc": "61.1.2",
84
+ "eslint-plugin-jsonc": "^2.21.0",
85
+ "eslint-plugin-n": "^17.23.1",
87
86
  "eslint-plugin-no-only-tests": "^3.3.0",
88
- "eslint-plugin-perfectionist": "^4.15.0",
87
+ "eslint-plugin-perfectionist": "^4.15.1",
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",
93
- "eslint-plugin-yml": "^1.18.0",
94
- "eslint-typegen": "^2.3.0",
95
- "globals": "^16.3.0",
96
- "jsonc-eslint-parser": "^2.4.0",
91
+ "eslint-plugin-vue": "^10.5.0",
92
+ "eslint-plugin-yml": "^1.19.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
- "picocolors": "^1.1.1",
100
- "prettier": "^3.6.2",
101
97
  "prompts": "^2.4.2",
102
98
  "vue-eslint-parser": "^10.2.0",
103
99
  "yaml-eslint-parser": "^1.3.0",
104
100
  "yargs": "^18.0.0"
105
101
  },
106
102
  "devDependencies": {
107
- "@antfu/ni": "^25.0.0",
108
- "@eslint-react/eslint-plugin": "^1.52.9",
109
- "@eslint/config-inspector": "^1.2.0",
103
+ "@antfu/ni": "^26.1.0",
104
+ "@eslint-react/eslint-plugin": "^2.2.2",
105
+ "@eslint/config-inspector": "^1.3.0",
110
106
  "@types/eslint-config-prettier": "^6.11.3",
111
- "@types/node": "^24.3.0",
107
+ "@types/node": "^24.7.2",
112
108
  "@types/prompts": "^2.4.9",
113
109
  "@types/yargs": "^17.0.33",
114
- "@unocss/eslint-plugin": "^66.5.0",
115
- "bumpp": "^10.2.3",
116
- "eslint": "^9.34.0",
117
- "eslint-plugin-react-hooks": "6.0.0-rc1",
118
- "eslint-plugin-react-refresh": "^0.4.20",
119
- "eslint-plugin-svelte": "^3.12.0",
110
+ "@unocss/eslint-plugin": "^66.5.3",
111
+ "bumpp": "^10.3.1",
112
+ "eslint": "^9.37.0",
113
+ "eslint-plugin-react-hooks": "7.0.0",
114
+ "eslint-plugin-react-refresh": "^0.4.23",
115
+ "eslint-plugin-svelte": "^3.12.4",
120
116
  "eslint-plugin-tailwindcss": "^3.18.2",
121
- "jiti": "^2.5.1",
117
+ "eslint-typegen": "^2.3.0",
118
+ "jiti": "^2.6.1",
122
119
  "nano-staged": "^0.8.0",
120
+ "prettier": "^3.6.2",
121
+ "publint": "^0.3.14",
123
122
  "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"
123
+ "svelte": "^5.40.0",
124
+ "svelte-eslint-parser": "^1.3.3",
125
+ "tsdown": "^0.15.7",
126
+ "typescript": "^5.9.3",
127
+ "unplugin-unused": "^0.5.4"
128
128
  },
129
129
  "simple-git-hooks": {
130
130
  "pre-commit": "pnpm exec nano-staged"