Skip to content

chore(lint): replace eslint with tsc --noEmit + prettier --check#94

Merged
luojiyin1987 merged 2 commits into
masterfrom
chore/replace-eslint-with-tsc-prettier
Jul 10, 2026
Merged

chore(lint): replace eslint with tsc --noEmit + prettier --check#94
luojiyin1987 merged 2 commits into
masterfrom
chore/replace-eslint-with-tsc-prettier

Conversation

@luojiyin1987

Copy link
Copy Markdown
Contributor

背景

npm install 当前会拉起整条 eslint 弃用警告链(@antfu/eslint-config-*eslint@8 EOL、rimraf@3/glob@7 via eslint、@humanwhocodes/*eslint-plugin-markdown)。这些全部来自 dev/eslint 工具链,不影响发布的 CLI,但噪声大、工具链老化。

改动

按既定方案(方案 2,分阶段)移除 eslint,npm run lint 改为类型检查 + 格式检查:

  • devDependencies 删除 eslint + @attachments/eslint-config(安装减少 211 个包)
  • 新增 script:typecheck = tsc -p tsconfig.json --noEmit
  • lint script 改为 npm run typecheck && prettier --check "src/**/*.ts" "__tests__/**/*.ts"
  • 删除 .eslintrc.js
  • 清理 sanitize-terminal.ts 中已失效的 eslint-disable-next-line 注释
  • 保留 prettier 依赖(PR2 再评估是否删除 / 统一 format)

验证

  • npm installfound 0 vulnerabilities,eslint 链警告消失(jest 的 glob 弃用警告属测试链,非本次范围)
  • npm run lint:通过(typecheck 0 错 + prettier --check 通过)
  • npm test:11 suites / 106 tests 全过
  • npm run build:成功

提交拆分(单关注点)

  • `87fbb3a` `chore(lint): replace eslint with tsc --noEmit + prettier --check`(package.json + 删 .eslintrc.js)
  • `db8953b` `style: normalize formatting to prettier defaults`(25 个文件的纯格式化归一,因代码原为 @attachments 内嵌 prettier 选项格式,与 prettier 默认不一致,一次性归一以便 `prettier --check` 通过)

已知取舍

  • 明确放弃 style 规则(unused-imports / prefer-const / import-order / 复杂度),由 tsc 兜底类型错误
  • typecheck 仅覆盖 `src`(tsconfig `include` 不含 `tests`),测试类型错误由 `npm test`(ts-jest)兜底

@luojiyin1987 luojiyin1987 merged commit 6bcd960 into master Jul 10, 2026
5 checks passed
@luojiyin1987 luojiyin1987 deleted the chore/replace-eslint-with-tsc-prettier branch July 10, 2026 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant