my-code-style 1.8.2 → 1.8.4

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/CHANGELOG.md CHANGED
@@ -1,23 +1,32 @@
1
1
  ## 变更日志
2
2
 
3
- ## [1.8.2](https://github.com/myvn/codeStyle/compare/v1.8.1...v1.8.2) (2026-09-21)
4
-
3
+ ## [1.8.4](https://github.com/myvn/codeStyle/compare/v1.8.3...v1.8.4) (2026-09-22)
5
4
 
6
5
  ### 🐛 Bug Fixes | Bug 修复
7
6
 
8
- * versionrc 静默压优先级警告 + CHANGELOG 结构修复 + 发布工具迁移 catv@12 ([d1b8abf](https://github.com/myvn/codeStyle/commit/d1b8abfcccb595c33d4b9490e87b0599fe37b6bc))
7
+ - NIT-012 规则分叉了结 + 发布工具防失控(BUG-028)+ CI 工件冒烟 ([1f24451](https://github.com/myvn/codeStyle/commit/1f24451d114ae396eb935bec9227ce93873b7cf1))
9
8
 
10
- ### [1.8.1](https://github.com/myvn/codeStyle/compare/v1.8.0...v1.8.1) (2026-09-20)
9
+ ## [1.8.3](https://github.com/myvn/codeStyle/compare/v1.8.2...v1.8.3) (2026-09-21)
11
10
 
11
+ ### 🐛 Bug Fixes | Bug 修复
12
+
13
+ - 校准 peer 范围,修复 eslint 10 组合被 npm 拒装(BUG-027) ([33d211d](https://github.com/myvn/codeStyle/commit/33d211dcbdb24b2e67962c6c32d02628d13cec32))
14
+
15
+ ## [1.8.2](https://github.com/myvn/codeStyle/compare/v1.8.1...v1.8.2) (2026-09-21)
12
16
 
13
17
  ### 🐛 Bug Fixes | Bug 修复
14
18
 
15
- * **init:** 安装命令里的版本范围加引号,粘贴不再被 shell 截断 ([9abaf1d](https://github.com/myvn/codeStyle/commit/9abaf1d76ea3aff05f0d26d11a43e8661ed6221a))
19
+ - versionrc 静默压优先级警告 + CHANGELOG 结构修复 + 发布工具迁移 catv@12 ([d1b8abf](https://github.com/myvn/codeStyle/commit/d1b8abfcccb595c33d4b9490e87b0599fe37b6bc))
20
+
21
+ ### [1.8.1](https://github.com/myvn/codeStyle/compare/v1.8.0...v1.8.1) (2026-09-20)
22
+
23
+ ### 🐛 Bug Fixes | Bug 修复
16
24
 
25
+ - **init:** 安装命令里的版本范围加引号,粘贴不再被 shell 截断 ([9abaf1d](https://github.com/myvn/codeStyle/commit/9abaf1d76ea3aff05f0d26d11a43e8661ed6221a))
17
26
 
18
27
  ### ✨ Features | 新功能
19
28
 
20
- * **init:** 输出步骤化为固定六步,dry-run 全流程预览 ([f14ca47](https://github.com/myvn/codeStyle/commit/f14ca47449b7d3e8f9a381b6e145e99232586886))
29
+ - **init:** 输出步骤化为固定六步,dry-run 全流程预览 ([f14ca47](https://github.com/myvn/codeStyle/commit/f14ca47449b7d3e8f9a381b6e145e99232586886))
21
30
 
22
31
  ## [1.8.0](https://github.com/myvn/codeStyle/compare/v1.7.2...v1.8.0) (2026-09-20)
23
32
 
package/README.md CHANGED
@@ -190,6 +190,7 @@ module.exports = {
190
190
  | `my-code-style/commitlint` | Commitlint 基础配置 |
191
191
  | `my-code-style/commitlint/scopes` | 动态 scope 工具函数 |
192
192
  | `my-code-style/versionrc` | commit-and-tag-version 配置 |
193
+ | `my-code-style/package.json` | 包元数据(工具读取版本用) |
193
194
 
194
195
  ## CLI 初始化参数
195
196
 
@@ -239,12 +240,12 @@ npx my-code-style-init [--dry-run] [--backup] [--version|-v] [--help|-h]
239
240
  ## 测试套件
240
241
 
241
242
  ```bash
242
- npm run test:all # 全量运行 179 项:用例明细 + 分类统计 + 最慢文件定位
243
+ npm run test:all # 全量运行 182 项:用例明细 + 分类统计 + 最慢文件定位
243
244
  npm run diagnose # 换机器后先跑它:进程 / git / 文件系统 / hooks 各占多少
244
245
  npm run sweep # 给本机找最佳文件级并发(扫 integration 套件)
245
- npm test # 只跑基础 CLI 与配置矩阵(85 项)
246
+ npm test # 只跑基础 CLI 与配置矩阵(86 项)
246
247
  npm run test:integration:setup # 安装现代化隔离依赖运行环境
247
- npm run test:integration # Flat Config、真实 Husky 及提交链路测试(59 项)
248
+ npm run test:integration # Flat Config、真实 Husky 及提交链路测试(61 项)
248
249
  npm run test:legacy:setup # 安装 ESLint 8 隔离运行环境
249
250
  npm run test:legacy # ESLint 8.57.0 兼容性回归测试(27 项)
250
251
  npm run test:stylelint17:setup # 安装 Stylelint 17 隔离运行环境
@@ -257,19 +258,20 @@ npm run test:stylelint17 # Stylelint 17 生态兼容性回归(8 项)
257
258
  ```text
258
259
  my-code-style 测试套件
259
260
 
260
- ▶ [1/4] 基础 CLI 与配置矩阵 (共 85 项,5 文件 · 3 文件并发(自动:2 核 / 内存 4G))
261
+ ▶ [1/4] 基础 CLI 与配置矩阵 (共 86 项,5 文件 · 3 文件并发(自动:2 核 / 内存 4G))
261
262
  ✓ 运行器 TAP 解析:统计通过与失败、SKIP 与每用例耗时 · 7ms
262
263
  ✓ cz 交互提示为中文,且可选类型与 type-enum 一一对应 · 1ms
263
- ✓ 一键安装命令对含 || 的版本范围加引号,可整段粘贴执行 · 44ms
264
+ ✓ peer 范围覆盖我们声明支持的上游大版本(校准防回退,BUG-027) · 0ms
265
+ ✓ 一键安装命令对含 || 的版本范围加引号,可整段粘贴执行 · 40ms
264
266
  ✓ 初始化结尾指引把 cz 用法说清楚(先 git add + 指到 README 手册) · 80ms
265
267
  …
266
- ✓ 通过 85 · 3.7s · 最慢文件 init-matrix.test.cjs 3.2s
268
+ ✓ 通过 86 · 3.6s · 最慢文件 init-matrix.test.cjs 3.2s
267
269
 
268
- ▶ [2/4] 现代工具链与提交链 (共 59 项,23 文件 · 3 文件并发(自动:2 核 / 内存 4G))
270
+ ▶ [2/4] 现代工具链与提交链 (共 61 项,24 文件 · 3 文件并发(自动:2 核 / 内存 4G))
269
271
  ✓ 完整提交链:JS/TS/Vue/nvue/CSS/less 自动修复及二次复检 · 10.4s
270
272
  ✓ 发布防呆:HEAD 已有 v* tag 时拦截(此时 release 工具会静默抬版并写出空 CHANGELOG) · 609ms
271
273
  …
272
- ✓ 通过 59 · 41.0s · 最慢文件 commit-chain-both.test.cjs 10.6s
274
+ ✓ 通过 61 · 41.4s · 最慢文件 commit-chain-less.test.cjs 11.4s
273
275
 
274
276
  ▶ [3/4] ESLint 8 兼容性 (共 27 项,1 文件 · 3 文件并发(自动:2 核 / 内存 4G))
275
277
  ✓ 独立运行 ESLint 8 支持下限而非 ESLint 9 · 1ms
@@ -286,17 +288,17 @@ npm run test:stylelint17 # Stylelint 17 生态兼容性回归(8 项)
286
288
  ──────────────────────────────────────────────────────
287
289
  套件 通过 失败 跳过 用时
288
290
  ──────────────────────────────────────────────────────
289
- 基础 CLI 与配置矩阵 85 0 - 3.7s
290
- 现代工具链与提交链 59 0 - 41.0s
291
- ESLint 8 兼容性 27 0 - 18.3s
292
- Stylelint 17 兼容性 8 0 - 7.2s
291
+ 基础 CLI 与配置矩阵 86 0 - 3.6s
292
+ 现代工具链与提交链 61 0 - 41.4s
293
+ ESLint 8 兼容性 27 0 - 18.7s
294
+ Stylelint 17 兼容性 8 0 - 7.3s
293
295
  ──────────────────────────────────────────────────────
294
- 合计 179 0 - 71.1s
296
+ 合计 182 0 - 70.0s
295
297
  ──────────────────────────────────────────────────────
296
298
 
297
- ⏱ 最慢文件:eslint8.test.cjs 18.3s · commit-chain-both.test.cjs 10.6s · commit-chain-scss.test.cjs 10.6s
299
+ ⏱ 最慢文件:eslint8.test.cjs 18.0s · commit-chain-less.test.cjs 11.4s · commit-chain-both.test.cjs 11.3s
298
300
 
299
- ✅ 全部通过:179/179 项,用时 71.1s
301
+ ✅ 全部通过:182/182 项,用时 70.0s
300
302
  ```
301
303
 
302
304
  终端里每个套件下方还有一条实时进度条(`██████░░░░ 38/66 失败 0 4.0s`)。附加参数:
@@ -374,7 +376,7 @@ npm run test:all -- --profile # 看每个测试文件耗时,定位瓶颈
374
376
  | `npm run test:integration`(运行器调度,自动并发 3) | 30.6s(只看集成套件那一段) |
375
377
  | 串行套件 + 文件级并发 23(全部一波) | ✗ 3.8G 内存沙箱被 OOM 压垮(19 项 SIGKILL) |
376
378
 
377
- 同机复测(179 项,同一台 2 核沙箱连续跑;绝对秒数随机器负载波动,相对关系稳定):串行套件 + 文件级并发 1 = 70.4s、默认自动并发 3 = 71.1s、`--parallel` 四套件 = 66.8s、`npm run test:integration` = 41.2s、`node --test demo-test/integration/*.test.cjs` = 53.3s。
379
+ 同机复测(182 项,同一台 2 核沙箱连续跑;绝对秒数随机器负载波动,相对关系稳定):串行套件 + 文件级并发 1 = 72.3s、默认自动并发 3 = 70.0s、`--parallel` 四套件 = 64.0s、`npm run test:integration` = 43.3s、`node --test demo-test/integration/*.test.cjs` = 62.4s。
378
380
 
379
381
  (2 核沙箱里并行收益被 CPU 争抢吃掉大半,`--concurrency=1` 时单个文件只要 0.7–4.2s;
380
382
  16 核机器上集成套件那段 ≈ 最慢子文件,即"一次真实提交"的量级。)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "my-code-style",
3
- "version": "1.8.2",
3
+ "version": "1.8.4",
4
4
  "description": "Lint/Format/Git 配置工程化 npm 包(ESLint + Prettier + Stylelint + Commitlint + Husky + standard-version)",
5
5
  "type": "commonjs",
6
6
  "main": "src/eslint/uniapp.cjs",
@@ -29,7 +29,8 @@
29
29
  "./stylelint/less-override": "./src/stylelint/less-override.cjs",
30
30
  "./commitlint": "./src/commitlint/base.cjs",
31
31
  "./commitlint/scopes": "./src/commitlint/scopes.cjs",
32
- "./versionrc": "./src/versionrc/index.cjs"
32
+ "./versionrc": "./src/versionrc/index.cjs",
33
+ "./package.json": "./package.json"
33
34
  },
34
35
  "files": [
35
36
  "src",
@@ -44,6 +45,7 @@
44
45
  "scripts": {
45
46
  "test": "node --test tests/*.test.cjs demo-test/*.test.cjs",
46
47
  "test:demo": "node --test demo-test/*.test.cjs",
48
+ "test:count": "node scripts/count-tests.cjs demo-test/*.test.cjs",
47
49
  "test:integration:setup": "node demo-test/setup-integration.cjs",
48
50
  "test:integration": "node scripts/test-all.cjs --suite=integration",
49
51
  "test:legacy:setup": "node demo-test/setup-legacy.cjs",
@@ -69,23 +71,23 @@
69
71
  "node": ">=18"
70
72
  },
71
73
  "peerDependencies": {
72
- "@commitlint/cli": "^19.0.0",
73
- "@commitlint/config-conventional": "^19.0.0",
74
- "@eslint/js": "^9.0.0",
74
+ "@commitlint/cli": "^19.0.0 || ^20.0.0 || ^21.0.0",
75
+ "@commitlint/config-conventional": "^19.0.0 || ^20.0.0 || ^21.0.0",
76
+ "@eslint/js": "^9.0.0 || ^10.0.0",
75
77
  "@typescript-eslint/eslint-plugin": "^8.0.0",
76
78
  "@typescript-eslint/parser": "^8.0.0",
77
79
  "commit-and-tag-version": "^12.0.0",
78
80
  "czg": "^1.0.0",
79
81
  "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",
80
82
  "eslint-config-prettier": "^10.1.8",
81
- "eslint-import-resolver-typescript": "^3.0.0",
83
+ "eslint-import-resolver-typescript": "^3.0.0 || ^4.0.0",
82
84
  "eslint-plugin-import": "^2.0.0",
83
85
  "eslint-plugin-import-x": "^4.0.0",
84
86
  "eslint-plugin-prettier": "^5.2.0",
85
87
  "eslint-plugin-vue": "^10.0.0",
86
- "globals": "^16.0.0",
88
+ "globals": "^16.0.0 || ^17.0.0",
87
89
  "husky": "^9.0.0",
88
- "lint-staged": "^16.0.0",
90
+ "lint-staged": "^16.0.0 || ^17.0.0",
89
91
  "postcss-html": "^2.0.0",
90
92
  "postcss-less": "^6.0.0",
91
93
  "postcss-scss": "^4.0.0",
@@ -36,7 +36,13 @@ export const commonRules = {
36
36
 
37
37
  // Import rules (using import-x for flat config compatibility)
38
38
  "import-x/no-unresolved": "off",
39
- "import-x/extensions": "off",
39
+ // 与 legacy 的 import/extensions 对齐(NIT-012):相对导入的 js/jsx/ts/tsx 不带
40
+ // 扩展名;mjs/cjs 未列出、按规则默认要求带扩展名(与本仓 .mjs 互引一致)
41
+ "import-x/extensions": [
42
+ "error",
43
+ "ignorePackages",
44
+ { js: "never", jsx: "never", ts: "never", tsx: "never" },
45
+ ],
40
46
  "import-x/prefer-default-export": "off",
41
47
  "import-x/no-extraneous-dependencies": "off",
42
48
 
@@ -9,7 +9,8 @@ export default [
9
9
 
10
10
  // Add uni-app globals
11
11
  {
12
- files: ["**/*.{vue,ts,js,nvue}"],
12
+ // 覆盖 base 配置的全部语言文件(此前漏了 mjs/cjs/mts/cts/jsx/tsx,NIT-012)
13
+ files: ["**/*.{vue,ts,js,mjs,cjs,mts,cts,jsx,tsx,nvue}"],
13
14
  languageOptions: {
14
15
  globals: uniappGlobals,
15
16
  },