@kirklin/eslint-config 2.7.0 → 3.0.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
@@ -24,9 +24,6 @@
24
24
  <br>
25
25
  </div>
26
26
 
27
- ## Features
28
-
29
- - "double quotes", must semi;
30
27
  - Auto fix for formatting (aimed to be used standalone **without** Prettier)
31
28
  - Reasonable defaults, best practices, only one line of config
32
29
  - Designed to work with TypeScript, JSX, Vue, JSON, YAML, Toml, Markdown, etc. Out-of-box.
@@ -748,9 +745,15 @@ export default kirklin({
748
745
 
749
746
  ### Editor Specific Disables
750
747
 
751
- Some rules are disabled when inside ESLint IDE integrations, namely [`unused-imports/no-unused-imports`](https://www.npmjs.com/package/eslint-plugin-unused-imports) [`test/no-only-tests`](https://github.com/levibuzolic/eslint-plugin-no-only-tests)
748
+ Auto-fixing for the following rules are disabled when ESLint is running in a code editor:
749
+
750
+ - [`prefer-const`](https://eslint.org/docs/rules/prefer-const)
751
+ - [`test/no-only-tests`](https://github.com/levibuzolic/eslint-plugin-no-only-tests)
752
+ - [`unused-imports/no-unused-imports`](https://www.npmjs.com/package/eslint-plugin-unused-imports)
753
+
754
+ Since v3.0.0, they are no longer disabled, but made non-fixable using [this helper](https://github.com/antfu/eslint-flat-config-utils#composerdisablerulesfix).
752
755
 
753
- This is to prevent unused imports from getting removed by the IDE during refactoring to get a better developer experience. Those rules will be applied when you run ESLint in the terminal or [Lint Staged](#lint-staged). If you don't want this behavior, you can disable them:
756
+ This is to prevent unused imports from getting removed by the editor during refactoring to get a better developer experience. Those rules will be applied when you run ESLint in the terminal or [Lint Staged](#lint-staged). If you don't want this behavior, you can disable them:
754
757
 
755
758
  ```js
756
759
  // eslint.config.js
package/README.zh-cn.md CHANGED
@@ -40,10 +40,10 @@
40
40
  - 可选的[格式化程序](#formatters)支持CSS,HTML,XML等。
41
41
  - **样式原则**:最小化阅读,稳定的差异性,保持一致性
42
42
 
43
- > [!IMPORTANT]
44
- > v1.0.0开始,该配置已重写为新的 [ESLint Flat配置](https://eslint.org/docs/latest/use/configure/configuration-files-new), 请查看[发布说明](https://github.com/kirklin/eslint-config/releases/tag/v1.0.0)以获取更多详细信息。
45
- >
46
- > 自 v2.7.0 起,需要 ESLint v9.5.0+。
43
+ > [!NOTE]
44
+ > v1.0.0 版本起,该配置已重写为新的 [ESLint Flat 配置](https://eslint.org/docs/latest/use/configure/configuration-files-new),详细信息请查看 [发布说明](https://github.com/kirklin/eslint-config/releases/tag/v1.0.0)
45
+ >
46
+ > 自 v2.7.0 版本起,现要求使用 ESLint v9.5.0 及以上版本。
47
47
 
48
48
  ## 使用方法
49
49
 
@@ -747,20 +747,19 @@ export default kirklin({
747
747
  });
748
748
  ```
749
749
 
750
- ### 编辑器特定禁用
750
+ ### 编辑器特定的禁用规则
751
751
 
752
- 有些规则在ESLint IDE集成中被禁用,具体来说是 [`unused-imports/no-unused-imports`](https://www.npmjs.com/package/eslint-plugin-unused-imports) 和 [`test/no-only-tests`](https://github.com/levibuzolic/eslint-plugin-no-only-tests)。
752
+ ESLint 在代码编辑器中运行时,以下规则的自动修复功能被禁用:
753
753
 
754
- 这样做是为了防止在重构过程中IDE自动移除未使用的导入,以提供更好的开发体验。当您在终端或使用 [Lint Staged](#lint-staged) 运行ESLint时,这些规则将会被应用。如果您不希望有这样的行为,可以通过以下方式禁用它们:
754
+ - [`prefer-const`](https://eslint.org/docs/rules/prefer-const)
755
+ - [`test/no-only-tests`](https://github.com/levibuzolic/eslint-plugin-no-only-tests)
756
+ - [`unused-imports/no-unused-imports`](https://www.npmjs.com/package/eslint-plugin-unused-imports)
755
757
 
756
- ```js
757
- // eslint.config.js
758
- import kirklin from "@kirklin/eslint-config";
758
+ 自 v3.0.0 版本起,这些规则不再被完全禁用,而是通过 [此辅助工具](https://github.com/antfu/eslint-flat-config-utils#composerdisablerulesfix) 设为不可自动修复。
759
759
 
760
- export default kirklin({
761
- isInEditor: false
762
- });
763
- ```
760
+ 这样可以防止编辑器在重构代码时自动删除未使用的导入,以提供更好的开发体验。这些规则仍然会在你通过终端运行 ESLint 或使用 [Lint Staged](#lint-staged) 时生效。
761
+
762
+ 如果你不希望有这种行为,你可以手动禁用它们。
764
763
 
765
764
  ### Lint Staged
766
765
 
package/dist/cli.js CHANGED
@@ -12,8 +12,8 @@ import c from "picocolors";
12
12
  var package_default = {
13
13
  name: "@kirklin/eslint-config",
14
14
  type: "module",
15
- version: "2.7.0",
16
- packageManager: "pnpm@9.12.3",
15
+ version: "3.0.0",
16
+ packageManager: "pnpm@10.2.1",
17
17
  description: "Kirk Lin's ESLint config",
18
18
  author: "Kirk Lin (https://github.com/kirklin/)",
19
19
  license: "MIT",
@@ -23,10 +23,7 @@ var package_default = {
23
23
  "eslint-config"
24
24
  ],
25
25
  exports: {
26
- ".": {
27
- import: "./dist/index.js",
28
- require: "./dist/index.cjs"
29
- }
26
+ ".": "./dist/index.js"
30
27
  },
31
28
  main: "./dist/index.js",
32
29
  types: "./dist/index.d.ts",
@@ -36,14 +33,14 @@ var package_default = {
36
33
  "dist"
37
34
  ],
38
35
  scripts: {
39
- build: "nr typegen && tsup --format esm,cjs --clean --dts",
40
- stub: "tsup --format esm",
36
+ build: "nr typegen && tsup --clean --dts",
37
+ stub: "tsup",
41
38
  dev: "npx @eslint/config-inspector --config eslint.config.ts",
42
39
  "build:inspector": "pnpm build && npx @eslint/config-inspector build",
43
- watch: "tsup --format esm,cjs --watch",
44
- lint: "eslint --flag unstable_ts_config .",
45
- "lint:fix": "eslint --flag unstable_ts_config . --fix",
46
- typegen: "esno scripts/typegen.ts",
40
+ watch: "tsup --watch",
41
+ lint: "eslint .",
42
+ "lint:fix": "eslint . --fix",
43
+ typegen: "tsx scripts/typegen.ts",
47
44
  prepack: "nr build",
48
45
  release: "bumpp && pnpm publish",
49
46
  test: "vitest",
@@ -51,7 +48,7 @@ var package_default = {
51
48
  prepare: "simple-git-hooks"
52
49
  },
53
50
  peerDependencies: {
54
- "@eslint-react/eslint-plugin": "^1.5.8",
51
+ "@eslint-react/eslint-plugin": "^1.19.0",
55
52
  "@prettier/plugin-xml": "^3.4.1",
56
53
  "@unocss/eslint-plugin": ">=0.50.0",
57
54
  "astro-eslint-parser": "^1.0.2",
@@ -62,7 +59,7 @@ var package_default = {
62
59
  "eslint-plugin-react-refresh": "^0.4.4",
63
60
  "eslint-plugin-solid": "^0.14.3",
64
61
  "eslint-plugin-svelte": ">=2.35.1",
65
- "prettier-plugin-astro": "^0.13.0",
62
+ "prettier-plugin-astro": "^0.14.0",
66
63
  "prettier-plugin-slidev": "^1.0.5",
67
64
  "svelte-eslint-parser": ">=0.37.0"
68
65
  },
@@ -108,35 +105,35 @@ var package_default = {
108
105
  }
109
106
  },
110
107
  dependencies: {
111
- "@antfu/install-pkg": "^0.4.1",
112
- "@clack/prompts": "^0.7.0",
108
+ "@antfu/install-pkg": "^1.0.0",
109
+ "@clack/prompts": "^0.10.0",
113
110
  "@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
114
- "@eslint/markdown": "^6.2.1",
115
- "@stylistic/eslint-plugin": "^2.10.1",
116
- "@typescript-eslint/eslint-plugin": "^8.12.2",
117
- "@typescript-eslint/parser": "^8.12.2",
118
- "@vitest/eslint-plugin": "^1.1.7",
119
- "eslint-config-flat-gitignore": "^0.3.0",
120
- "eslint-flat-config-utils": "^0.4.0",
121
- "eslint-merge-processors": "^0.1.0",
122
- "eslint-plugin-command": "^0.2.6",
123
- "eslint-plugin-import-x": "^4.4.0",
124
- "eslint-plugin-jsdoc": "^50.4.3",
125
- "eslint-plugin-jsonc": "^2.16.0",
126
- "eslint-plugin-kirklin": "^1.5.0",
127
- "eslint-plugin-n": "^17.12.0",
111
+ "@eslint/markdown": "^6.2.2",
112
+ "@stylistic/eslint-plugin": "^3.1.0",
113
+ "@typescript-eslint/eslint-plugin": "^8.23.0",
114
+ "@typescript-eslint/parser": "^8.23.0",
115
+ "@vitest/eslint-plugin": "^1.1.26",
116
+ "eslint-config-flat-gitignore": "^2.0.0",
117
+ "eslint-flat-config-utils": "^2.0.1",
118
+ "eslint-merge-processors": "^2.0.0",
119
+ "eslint-plugin-command": "^3.0.0",
120
+ "eslint-plugin-import-x": "^4.6.1",
121
+ "eslint-plugin-jsdoc": "^50.6.3",
122
+ "eslint-plugin-jsonc": "^2.19.1",
123
+ "eslint-plugin-kirklin": "^2.0.0",
124
+ "eslint-plugin-n": "^17.15.1",
128
125
  "eslint-plugin-no-only-tests": "^3.3.0",
129
- "eslint-plugin-perfectionist": "^3.9.1",
130
- "eslint-plugin-regexp": "^2.6.0",
131
- "eslint-plugin-toml": "^0.11.1",
132
- "eslint-plugin-unicorn": "^56.0.0",
126
+ "eslint-plugin-perfectionist": "^4.8.0",
127
+ "eslint-plugin-regexp": "^2.7.0",
128
+ "eslint-plugin-toml": "^0.12.0",
129
+ "eslint-plugin-unicorn": "^56.0.1",
133
130
  "eslint-plugin-unused-imports": "^4.1.4",
134
- "eslint-plugin-vue": "^9.30.0",
135
- "eslint-plugin-yml": "^1.15.0",
136
- "eslint-processor-vue-blocks": "^0.1.2",
137
- globals: "^15.11.0",
131
+ "eslint-plugin-vue": "^9.32.0",
132
+ "eslint-plugin-yml": "^1.16.0",
133
+ "eslint-processor-vue-blocks": "^2.0.0",
134
+ globals: "^15.14.0",
138
135
  "jsonc-eslint-parser": "^2.4.0",
139
- "local-pkg": "^0.5.0",
136
+ "local-pkg": "^1.0.0",
140
137
  "parse-gitignore": "^2.0.0",
141
138
  picocolors: "^1.1.1",
142
139
  "toml-eslint-parser": "^0.10.0",
@@ -145,56 +142,55 @@ var package_default = {
145
142
  yargs: "^17.7.2"
146
143
  },
147
144
  devDependencies: {
148
- "@antfu/ni": "^0.23.0",
149
- "@eslint-react/eslint-plugin": "^1.15.2",
150
- "@eslint/config-inspector": "^0.5.6",
145
+ "@antfu/ni": "^23.3.1",
146
+ "@eslint-react/eslint-plugin": "^1.26.2",
147
+ "@eslint/config-inspector": "^1.0.0",
151
148
  "@kirklin/eslint-config": "workspace:*",
152
149
  "@prettier/plugin-xml": "^3.4.1",
153
- "@stylistic/eslint-plugin-migrate": "^2.10.1",
150
+ "@stylistic/eslint-plugin-migrate": "^3.1.0",
154
151
  "@types/fs-extra": "^11.0.4",
155
- "@types/node": "^22.8.6",
152
+ "@types/node": "^22.13.1",
156
153
  "@types/prompts": "^2.4.9",
157
154
  "@types/yargs": "^17.0.33",
158
- "@unocss/eslint-plugin": "^0.63.6",
159
- "astro-eslint-parser": "^1.0.3",
160
- bumpp: "^9.8.0",
161
- eslint: "^9.14.0",
162
- "eslint-plugin-astro": "^1.3.0",
163
- "eslint-plugin-format": "^0.1.2",
164
- "eslint-plugin-react-hooks": "^5.0.0",
165
- "eslint-plugin-react-refresh": "^0.4.14",
166
- "eslint-plugin-solid": "^0.14.3",
167
- "eslint-plugin-svelte": "^2.46.0",
168
- "eslint-typegen": "^0.3.2",
169
- esno: "^4.8.0",
170
- execa: "^9.5.1",
171
- "fast-glob": "^3.3.2",
172
- "fs-extra": "^11.2.0",
173
- jiti: "^2.4.0",
174
- "lint-staged": "^15.2.10",
155
+ "@unocss/eslint-plugin": "^65.4.3",
156
+ "astro-eslint-parser": "^1.2.1",
157
+ bumpp: "^10.0.2",
158
+ eslint: "^9.20.0",
159
+ "eslint-plugin-astro": "^1.3.1",
160
+ "eslint-plugin-format": "^1.0.1",
161
+ "eslint-plugin-react-hooks": "^5.1.0",
162
+ "eslint-plugin-react-refresh": "^0.4.18",
163
+ "eslint-plugin-solid": "^0.14.5",
164
+ "eslint-plugin-svelte": "^2.46.1",
165
+ "eslint-typegen": "^1.0.0",
166
+ execa: "^9.5.2",
167
+ "fast-glob": "^3.3.3",
168
+ "fs-extra": "^11.3.0",
169
+ jiti: "^2.4.2",
170
+ "lint-staged": "^15.4.3",
175
171
  "prettier-plugin-astro": "^0.14.1",
176
172
  "prettier-plugin-slidev": "^1.0.5",
177
173
  rimraf: "^6.0.1",
178
174
  "simple-git-hooks": "^2.11.1",
179
- svelte: "^5.1.9",
175
+ svelte: "^5.19.9",
180
176
  "svelte-eslint-parser": "^0.43.0",
181
- tsup: "^8.3.5",
177
+ tsup: "^8.3.6",
182
178
  tsx: "^4.19.2",
183
- typescript: "^5.6.3",
184
- vitest: "^2.1.4",
185
- vue: "^3.5.12"
179
+ typescript: "^5.7.3",
180
+ vitest: "^3.0.5",
181
+ vue: "^3.5.13"
186
182
  },
187
183
  resolutions: {
188
184
  "@eslint-community/eslint-utils": "^4.4.1",
189
- "@typescript-eslint/utils": "^8.12.2",
190
- eslint: "^9.14.0",
185
+ "@typescript-eslint/utils": "^8.23.0",
186
+ eslint: "^9.20.0",
191
187
  tsx: "^4.19.2"
192
188
  },
193
189
  "simple-git-hooks": {
194
190
  "pre-commit": "npx lint-staged"
195
191
  },
196
192
  "lint-staged": {
197
- "*": "eslint --flag unstable_ts_config --fix"
193
+ "*": "eslint --fix"
198
194
  }
199
195
  };
200
196
 
@@ -242,6 +238,7 @@ var vscodeSettingsString = `
242
238
  "gql",
243
239
  "graphql",
244
240
  "astro",
241
+ "svelte",
245
242
  "css",
246
243
  "less",
247
244
  "scss",
@@ -565,7 +562,7 @@ async function run(options = {}) {
565
562
  await updateEslintFiles(result);
566
563
  await updateVscodeSettings(result);
567
564
  p4.log.success(c5.green(`Setup completed`));
568
- p4.outro(`Now you can update the dependencies and run ${c5.blue("eslint . --fix")}
565
+ p4.outro(`Now you can update the dependencies by run ${c5.blue("pnpm install")} and run ${c5.blue("eslint . --fix")}
569
566
  `);
570
567
  }
571
568