@dhzh/eslint-config 0.18.0 → 0.19.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/README.md CHANGED
@@ -43,14 +43,16 @@ Differences from [@antfu/eslint-config](https://github.com/antfu/eslint-config/b
43
43
 
44
44
  > Note: Temporarily close the rules of the [`Perfectionist`](https://perfectionist.dev/) plugin from version `v0.15.0`, because I haven't found a way to achieve the best balance between actual development needs and personal habits.
45
45
 
46
- 9. react related:
46
+ 9. React related:
47
47
 
48
48
  - `'react/no-useless-fragment': 'warn'`
49
49
 
50
- 10. remove spacing when useing jsx curly braces:
50
+ 10. Remove spacing when useing jsx curly braces:
51
51
 
52
52
  - `'style/jsx-curly-spacing': ['error', { children: true, when: 'never' }]`
53
53
 
54
+ 11. Keep auto fix with code editors for rules: [`prefer-const`](https://eslint.org/docs/rules/prefer-const), [`unused-imports/no-unused-imports`](https://www.npmjs.com/package/eslint-plugin-unused-imports).
55
+
54
56
  ## Usage
55
57
 
56
58
  > Requires ESLint v9.5.0+
package/dist/cli.cjs CHANGED
@@ -41,7 +41,7 @@ var import_picocolors = __toESM(require("picocolors"), 1);
41
41
  var package_default = {
42
42
  name: "@dhzh/eslint-config",
43
43
  type: "module",
44
- version: "0.18.0",
44
+ version: "0.19.0",
45
45
  packageManager: "pnpm@9.15.3",
46
46
  description: "Lyle's ESLint config",
47
47
  author: "Lyle Zheng <dhzhme@gmail.com>",
@@ -65,11 +65,11 @@ var package_default = {
65
65
  "dist"
66
66
  ],
67
67
  scripts: {
68
- build: "nr typegen && tsup --format esm,cjs --clean --dts",
69
- stub: "tsup --format esm",
68
+ build: "nr typegen && tsup --clean --dts",
69
+ stub: "tsup",
70
70
  dev: "npx @eslint/config-inspector --config eslint.config.ts",
71
71
  "build:inspector": "pnpm build && npx @eslint/config-inspector build",
72
- watch: "tsup --format esm,cjs --watch",
72
+ watch: "tsup --watch",
73
73
  lint: "eslint .",
74
74
  "lint-fix": "eslint --fix .",
75
75
  typegen: "tsx scripts/typegen.ts",
@@ -127,23 +127,23 @@ var package_default = {
127
127
  "@antfu/install-pkg": "^1.0.0",
128
128
  "@clack/prompts": "^0.9.1",
129
129
  "@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
130
- "@eslint-react/eslint-plugin": "^1.23.2",
131
- "@eslint/markdown": "^6.2.1",
132
- "@stylistic/eslint-plugin": "^2.13.0",
133
- "@typescript-eslint/eslint-plugin": "^8.19.1",
134
- "@typescript-eslint/parser": "^8.19.1",
130
+ "@eslint-react/eslint-plugin": "^1.24.1",
131
+ "@eslint/markdown": "^6.2.2",
132
+ "@stylistic/eslint-plugin": "^3.0.0",
133
+ "@typescript-eslint/eslint-plugin": "^8.21.0",
134
+ "@typescript-eslint/parser": "^8.21.0",
135
135
  "@vitest/eslint-plugin": "^1.1.25",
136
136
  "eslint-config-flat-gitignore": "^1.0.0",
137
- "eslint-flat-config-utils": "^1.0.0",
137
+ "eslint-flat-config-utils": "^2.0.0",
138
138
  "eslint-merge-processors": "^1.0.0",
139
- "eslint-plugin-antfu": "^2.7.0",
140
- "eslint-plugin-command": "^2.1.0",
139
+ "eslint-plugin-antfu": "^3.0.0",
140
+ "eslint-plugin-command": "^3.0.0",
141
141
  "eslint-plugin-import-x": "^4.6.1",
142
- "eslint-plugin-jsdoc": "^50.6.1",
143
- "eslint-plugin-jsonc": "^2.18.2",
142
+ "eslint-plugin-jsdoc": "^50.6.3",
143
+ "eslint-plugin-jsonc": "^2.19.1",
144
144
  "eslint-plugin-n": "^17.15.1",
145
145
  "eslint-plugin-no-only-tests": "^3.3.0",
146
- "eslint-plugin-perfectionist": "^4.6.0",
146
+ "eslint-plugin-perfectionist": "^4.7.0",
147
147
  "eslint-plugin-react-hooks": "^5.1.0",
148
148
  "eslint-plugin-react-refresh": "^0.4.18",
149
149
  "eslint-plugin-regexp": "^2.7.0",
@@ -165,18 +165,18 @@ var package_default = {
165
165
  },
166
166
  devDependencies: {
167
167
  "@antfu/ni": "^23.2.0",
168
- "@eslint/config-inspector": "^0.7.1",
168
+ "@eslint/config-inspector": "^1.0.0",
169
169
  "@prettier/plugin-xml": "^3.4.1",
170
- "@stylistic/eslint-plugin-migrate": "^2.13.0",
170
+ "@stylistic/eslint-plugin-migrate": "^3.0.0",
171
171
  "@types/fs-extra": "^11.0.4",
172
- "@types/node": "^22.10.5",
172
+ "@types/node": "^22.10.10",
173
173
  "@types/prompts": "^2.4.9",
174
174
  "@types/yargs": "^17.0.33",
175
- "@unocss/eslint-plugin": "^65.4.0",
176
- "astro-eslint-parser": "^1.1.0",
177
- bumpp: "^9.10.0",
178
- "bundle-require": "^5.0.0",
179
- eslint: "^9.18.0",
175
+ "@unocss/eslint-plugin": "^65.4.3",
176
+ "astro-eslint-parser": "^1.2.1",
177
+ bumpp: "^10.0.1",
178
+ "bundle-require": "^5.1.0",
179
+ eslint: "^9.19.0",
180
180
  "eslint-plugin-astro": "^1.3.1",
181
181
  "eslint-plugin-format": "^1.0.1",
182
182
  "eslint-plugin-solid": "^0.14.5",
@@ -184,9 +184,9 @@ var package_default = {
184
184
  "eslint-typegen": "^1.0.0",
185
185
  execa: "^9.5.2",
186
186
  "fast-glob": "^3.3.3",
187
- "fs-extra": "^11.2.0",
187
+ "fs-extra": "^11.3.0",
188
188
  jiti: "^2.4.2",
189
- "lint-staged": "^15.3.0",
189
+ "lint-staged": "^15.4.2",
190
190
  "prettier-plugin-astro": "^0.14.1",
191
191
  "prettier-plugin-slidev": "^1.0.5",
192
192
  rimraf: "^6.0.1",
@@ -198,8 +198,8 @@ var package_default = {
198
198
  },
199
199
  resolutions: {
200
200
  "@eslint-community/eslint-utils": "^4.4.1",
201
- "@typescript-eslint/utils": "^8.19.1",
202
- eslint: "^9.18.0",
201
+ "@typescript-eslint/utils": "^8.21.0",
202
+ eslint: "^9.19.0",
203
203
  tsx: "^4.19.2"
204
204
  },
205
205
  "simple-git-hooks": {
package/dist/cli.js CHANGED
@@ -12,7 +12,7 @@ import c from "picocolors";
12
12
  var package_default = {
13
13
  name: "@dhzh/eslint-config",
14
14
  type: "module",
15
- version: "0.18.0",
15
+ version: "0.19.0",
16
16
  packageManager: "pnpm@9.15.3",
17
17
  description: "Lyle's ESLint config",
18
18
  author: "Lyle Zheng <dhzhme@gmail.com>",
@@ -36,11 +36,11 @@ var package_default = {
36
36
  "dist"
37
37
  ],
38
38
  scripts: {
39
- build: "nr typegen && tsup --format esm,cjs --clean --dts",
40
- stub: "tsup --format esm",
39
+ build: "nr typegen && tsup --clean --dts",
40
+ stub: "tsup",
41
41
  dev: "npx @eslint/config-inspector --config eslint.config.ts",
42
42
  "build:inspector": "pnpm build && npx @eslint/config-inspector build",
43
- watch: "tsup --format esm,cjs --watch",
43
+ watch: "tsup --watch",
44
44
  lint: "eslint .",
45
45
  "lint-fix": "eslint --fix .",
46
46
  typegen: "tsx scripts/typegen.ts",
@@ -98,23 +98,23 @@ var package_default = {
98
98
  "@antfu/install-pkg": "^1.0.0",
99
99
  "@clack/prompts": "^0.9.1",
100
100
  "@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
101
- "@eslint-react/eslint-plugin": "^1.23.2",
102
- "@eslint/markdown": "^6.2.1",
103
- "@stylistic/eslint-plugin": "^2.13.0",
104
- "@typescript-eslint/eslint-plugin": "^8.19.1",
105
- "@typescript-eslint/parser": "^8.19.1",
101
+ "@eslint-react/eslint-plugin": "^1.24.1",
102
+ "@eslint/markdown": "^6.2.2",
103
+ "@stylistic/eslint-plugin": "^3.0.0",
104
+ "@typescript-eslint/eslint-plugin": "^8.21.0",
105
+ "@typescript-eslint/parser": "^8.21.0",
106
106
  "@vitest/eslint-plugin": "^1.1.25",
107
107
  "eslint-config-flat-gitignore": "^1.0.0",
108
- "eslint-flat-config-utils": "^1.0.0",
108
+ "eslint-flat-config-utils": "^2.0.0",
109
109
  "eslint-merge-processors": "^1.0.0",
110
- "eslint-plugin-antfu": "^2.7.0",
111
- "eslint-plugin-command": "^2.1.0",
110
+ "eslint-plugin-antfu": "^3.0.0",
111
+ "eslint-plugin-command": "^3.0.0",
112
112
  "eslint-plugin-import-x": "^4.6.1",
113
- "eslint-plugin-jsdoc": "^50.6.1",
114
- "eslint-plugin-jsonc": "^2.18.2",
113
+ "eslint-plugin-jsdoc": "^50.6.3",
114
+ "eslint-plugin-jsonc": "^2.19.1",
115
115
  "eslint-plugin-n": "^17.15.1",
116
116
  "eslint-plugin-no-only-tests": "^3.3.0",
117
- "eslint-plugin-perfectionist": "^4.6.0",
117
+ "eslint-plugin-perfectionist": "^4.7.0",
118
118
  "eslint-plugin-react-hooks": "^5.1.0",
119
119
  "eslint-plugin-react-refresh": "^0.4.18",
120
120
  "eslint-plugin-regexp": "^2.7.0",
@@ -136,18 +136,18 @@ var package_default = {
136
136
  },
137
137
  devDependencies: {
138
138
  "@antfu/ni": "^23.2.0",
139
- "@eslint/config-inspector": "^0.7.1",
139
+ "@eslint/config-inspector": "^1.0.0",
140
140
  "@prettier/plugin-xml": "^3.4.1",
141
- "@stylistic/eslint-plugin-migrate": "^2.13.0",
141
+ "@stylistic/eslint-plugin-migrate": "^3.0.0",
142
142
  "@types/fs-extra": "^11.0.4",
143
- "@types/node": "^22.10.5",
143
+ "@types/node": "^22.10.10",
144
144
  "@types/prompts": "^2.4.9",
145
145
  "@types/yargs": "^17.0.33",
146
- "@unocss/eslint-plugin": "^65.4.0",
147
- "astro-eslint-parser": "^1.1.0",
148
- bumpp: "^9.10.0",
149
- "bundle-require": "^5.0.0",
150
- eslint: "^9.18.0",
146
+ "@unocss/eslint-plugin": "^65.4.3",
147
+ "astro-eslint-parser": "^1.2.1",
148
+ bumpp: "^10.0.1",
149
+ "bundle-require": "^5.1.0",
150
+ eslint: "^9.19.0",
151
151
  "eslint-plugin-astro": "^1.3.1",
152
152
  "eslint-plugin-format": "^1.0.1",
153
153
  "eslint-plugin-solid": "^0.14.5",
@@ -155,9 +155,9 @@ var package_default = {
155
155
  "eslint-typegen": "^1.0.0",
156
156
  execa: "^9.5.2",
157
157
  "fast-glob": "^3.3.3",
158
- "fs-extra": "^11.2.0",
158
+ "fs-extra": "^11.3.0",
159
159
  jiti: "^2.4.2",
160
- "lint-staged": "^15.3.0",
160
+ "lint-staged": "^15.4.2",
161
161
  "prettier-plugin-astro": "^0.14.1",
162
162
  "prettier-plugin-slidev": "^1.0.5",
163
163
  rimraf: "^6.0.1",
@@ -169,8 +169,8 @@ var package_default = {
169
169
  },
170
170
  resolutions: {
171
171
  "@eslint-community/eslint-utils": "^4.4.1",
172
- "@typescript-eslint/utils": "^8.19.1",
173
- eslint: "^9.18.0",
172
+ "@typescript-eslint/utils": "^8.21.0",
173
+ eslint: "^9.19.0",
174
174
  tsx: "^4.19.2"
175
175
  },
176
176
  "simple-git-hooks": {
package/dist/index.cjs CHANGED
@@ -107,7 +107,7 @@ __export(src_exports, {
107
107
  });
108
108
  module.exports = __toCommonJS(src_exports);
109
109
 
110
- // node_modules/.pnpm/tsup@8.3.5_jiti@2.4.2_postcss@8.4.47_tsx@4.19.2_typescript@5.7.3_yaml@2.6.1/node_modules/tsup/assets/cjs_shims.js
110
+ // node_modules/.pnpm/tsup@8.3.5_jiti@2.4.2_postcss@8.4.47_tsx@4.19.2_typescript@5.7.3_yaml@2.7.0/node_modules/tsup/assets/cjs_shims.js
111
111
  var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
112
112
  var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
113
113
 
@@ -828,6 +828,7 @@ async function imports(options = {}) {
828
828
  "antfu/import-dedupe": "error",
829
829
  "antfu/no-import-dist": "error",
830
830
  "antfu/no-import-node-modules-by-path": "error",
831
+ "import/consistent-type-specifier-style": ["error", "prefer-top-level"],
831
832
  "import/first": "error",
832
833
  "import/no-duplicates": "error",
833
834
  "import/no-mutable-exports": "error",
@@ -1013,7 +1014,7 @@ async function javascript(options = {}) {
1013
1014
  }
1014
1015
  ],
1015
1016
  "prefer-const": [
1016
- "error",
1017
+ isInEditor ? "warn" : "error",
1017
1018
  {
1018
1019
  destructuring: "all",
1019
1020
  ignoreReadBeforeAssign: true
@@ -1027,7 +1028,7 @@ async function javascript(options = {}) {
1027
1028
  "prefer-template": "error",
1028
1029
  "symbol-description": "error",
1029
1030
  "unicode-bom": ["error", "never"],
1030
- "unused-imports/no-unused-imports": isInEditor ? "off" : "error",
1031
+ "unused-imports/no-unused-imports": isInEditor ? "warn" : "error",
1031
1032
  "unused-imports/no-unused-vars": [
1032
1033
  "error",
1033
1034
  {
@@ -1975,7 +1976,7 @@ async function test(options = {}) {
1975
1976
  "test/consistent-test-it": ["error", { fn: "it", withinDescribe: "it" }],
1976
1977
  "test/no-identical-title": "error",
1977
1978
  "test/no-import-node-test": "error",
1978
- "test/no-only-tests": isInEditor ? "off" : "error",
1979
+ "test/no-only-tests": isInEditor ? "warn" : "error",
1979
1980
  "test/prefer-hooks-in-order": "error",
1980
1981
  "test/prefer-lowercase-title": "error",
1981
1982
  // Disables
@@ -2156,7 +2157,11 @@ async function typescript(options = {}) {
2156
2157
  "no-useless-constructor": "off",
2157
2158
  "ts/ban-ts-comment": ["error", { "ts-expect-error": "allow-with-description" }],
2158
2159
  "ts/consistent-type-definitions": ["error", "interface"],
2159
- "ts/consistent-type-imports": ["error", { disallowTypeAnnotations: false, prefer: "type-imports" }],
2160
+ "ts/consistent-type-imports": ["error", {
2161
+ disallowTypeAnnotations: false,
2162
+ fixStyle: "separate-type-imports",
2163
+ prefer: "type-imports"
2164
+ }],
2160
2165
  "ts/method-signature-style": ["error", "property"],
2161
2166
  // https://www.totaltypescript.com/method-shorthand-syntax-considered-harmful
2162
2167
  "ts/no-dupe-class-members": "error",
@@ -2719,6 +2724,16 @@ function dhzh(options = {}, ...userConfigs) {
2719
2724
  if (autoRenamePlugins) {
2720
2725
  composer = composer.renamePlugins(defaultPluginRenaming);
2721
2726
  }
2727
+ if (isInEditor) {
2728
+ composer = composer.disableRulesFix(
2729
+ [
2730
+ "test/no-only-tests"
2731
+ ],
2732
+ {
2733
+ builtinRules: () => import(["eslint", "use-at-your-own-risk"].join("/")).then((r) => r.builtinRules)
2734
+ }
2735
+ );
2736
+ }
2722
2737
  return composer;
2723
2738
  }
2724
2739
  function resolveSubOptions(options, key) {