my-code-style 1.9.2 → 1.9.3
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 +7 -0
- package/README.md +3 -1
- package/bin/init +3 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
## 变更日志
|
|
2
2
|
|
|
3
|
+
## [1.9.3](https://github.com/myvn/codeStyle/compare/v1.9.2...v1.9.3) (2026-09-23)
|
|
4
|
+
|
|
5
|
+
### 🐛 Bug Fixes | Bug 修复
|
|
6
|
+
|
|
7
|
+
- **init:** BUG-038 兼容段 files 补 vue/nvue——SFC 内显式 .ts import 不再报 error ([c2298af](https://github.com/myvn/codeStyle/commit/c2298af354592f4f9232d3571be5ff31075a81e5))
|
|
8
|
+
- **peer:** typescript 放宽至 ^5.0.0 || ^6.0.0——TS 6(Vite 8 模板默认)不再堵死装机(BUG-039) ([fa633f1](https://github.com/myvn/codeStyle/commit/fa633f1a0f65229609cd6a38f88d032d08124e50))
|
|
9
|
+
|
|
3
10
|
## [1.9.2](https://github.com/myvn/codeStyle/compare/v1.9.1...v1.9.2) (2026-09-23)
|
|
4
11
|
|
|
5
12
|
### 🐛 Bug Fixes | Bug 修复
|
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ npx my-code-style-init --dry-run
|
|
|
26
26
|
npx my-code-style-init # 需保留旧文件时加 --backup
|
|
27
27
|
|
|
28
28
|
# 3. 按 CLI 输出的缺失依赖清单安装 peerDependencies(会按包管理器生成命令,别漏 typescript 和 stylelint-order——后者是 recess-order 7 的 peer,Vue/SCSS 项目缺了它 stylelint 直接崩)
|
|
29
|
-
pnpm add -D my-code-style eslint@^9.0.0 typescript@^
|
|
29
|
+
pnpm add -D my-code-style eslint@^9.0.0 typescript@^6.0.0 prettier@^3.0.0 ... # 以 CLI 实际输出为准
|
|
30
30
|
|
|
31
31
|
# 4. 初始化 hooks 并首次检查
|
|
32
32
|
pnpm prepare # npm: npm run prepare
|
|
@@ -222,6 +222,7 @@ npx my-code-style-init [--dry-run] [--backup] [--merge] [--version|-v] [--help|-
|
|
|
222
222
|
init 会**自动检测**:命中显式扩展名 import 时,生成的 `eslint.config.mjs` 注入兼容段——该规则**降级为 warn**,`pnpm lint` 退出码不受影响:
|
|
223
223
|
|
|
224
224
|
- **带 `.ts` 与不带 `.ts` 都可以写**,两种风格共存不报错;
|
|
225
|
+
- 兼容段同样覆盖 **Vue SFC(`.vue`/`.nvue`)**:`<script setup>` 里的显式扩展名 import 不会绕过兼容段报错(BUG-038);
|
|
225
226
|
- 不一致的写法仍会出 warning,作为渐进统一的风格信号;
|
|
226
227
|
- 团队统一后想恢复严格检查(error 级、只允许省略),删除 `eslint.config.mjs` 里的兼容段即可。
|
|
227
228
|
|
|
@@ -263,6 +264,7 @@ npx my-code-style-doctor
|
|
|
263
264
|
| `pnpm prepare` 输出 `.git can't be found`,hooks 不生效 | husky 必须在 git 仓库内执行 | 先 `git init`、再 `pnpm prepare`;验证 `git config core.hooksPath` 输出 `.husky/_` |
|
|
264
265
|
| 安装依赖报 `ERR_PNPM_IGNORED_BUILDS`(如 `unrs-resolver`) | pnpm 10+ 默认拦截依赖的构建脚本 | 执行 `pnpm approve-builds` 后重新安装,不是初始化失败 |
|
|
265
266
|
| `eslint` 声明 `>=8.0.0` 却生成了 Flat Config | 无上界范围 npm 实际会装 9,CLI 按 9 生成 | 确定留在 8 就把范围收紧到 `<9`(如 `~8.57.0`)后重跑 init |
|
|
267
|
+
| 首次接入存量/脚手架项目,`lint:style` 集中报几十个属性顺序错 | stylelint-order(recess-order)按既有排序规约检查,脚手架模板(如 Vite 的 `style.css`)不满足 | 一次性 `stylelint "**/*.{vue,nvue,html,css,scss,less}" --fix` 自动归位后再提交;此后保持绿色。属存量风格收敛,非本配置引入的错误 |
|
|
266
268
|
| 重复 init 后,改过的 `.prettierrc.cjs` / hooks 被覆盖 | 除 ESLint 入口与已存在的 `.gitignore` 外,目标文件一律覆盖 | 先用 `--dry-run` 看清单、用 `--backup` 留档(备份含 `package.json`,目录会自动写入 `.gitignore`) |
|
|
267
269
|
| 自定义 `lint-staged` 分组消失 | `lint-staged` 为整体替换,避免残留失效分组 | 从 `.my-code-style-backup/package.json` 恢复后手动合并 |
|
|
268
270
|
| 提交时 lint 报错、提交失败 | 修不了的错误(语法错误、非法 CSS 属性)会阻止提交 | 按提示修复;紧急情况可用 `git commit --no-verify`,但请在 **CI 用 `pnpm lint` 兜底** |
|
package/bin/init
CHANGED
|
@@ -621,7 +621,9 @@ function eslintFlatConfigContent(projectType, { compatExplicitTsImports = false
|
|
|
621
621
|
// 两种写法的"风格不一致"仍会以警告提示,团队可渐进统一;想恢复严格检查
|
|
622
622
|
// (error + 只允许省略)删除此段即可。
|
|
623
623
|
{
|
|
624
|
-
|
|
624
|
+
// 含 vue/nvue:SFC <script setup> 内的显式 .ts import 同样走兼容口径,
|
|
625
|
+
// 否则 .vue 文件会绕过此段仍按 error 报(BUG-038)
|
|
626
|
+
files: ["**/*.{ts,tsx,mts,cts,vue,nvue}"],
|
|
625
627
|
rules: { "import-x/extensions": "warn" },
|
|
626
628
|
}`
|
|
627
629
|
: ""
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "my-code-style",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.3",
|
|
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",
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"stylelint-config-recommended-vue": "^2.0.0",
|
|
102
102
|
"stylelint-order": "^6.0.0 || ^7.0.0 || ^8.0.0",
|
|
103
103
|
"stylelint-prettier": "^5.0.0",
|
|
104
|
-
"typescript": "^5.0.0",
|
|
104
|
+
"typescript": "^5.0.0 || ^6.0.0",
|
|
105
105
|
"typescript-eslint": "^8.0.0",
|
|
106
106
|
"vue-eslint-parser": "^10.3.0"
|
|
107
107
|
},
|