{"_id":"@abctech001/code-quality-toolkit","_rev":"6-62cfc9942a2853942e9667bd20e54c24","name":"@abctech001/code-quality-toolkit","dist-tags":{"latest":"1.0.5"},"versions":{"1.0.0":{"name":"@abctech001/code-quality-toolkit","version":"1.0.0","keywords":["eslint","prettier","husky","lint-staged","commitlint","typescript","code-quality","git-hooks"],"license":"MIT","_id":"@abctech001/code-quality-toolkit@1.0.0","maintainers":[{"name":"haha002","email":"sexmoringnak@gmail.com"}],"bin":{"team-dev-init":"bin/init.js","team-typecheck":"lib/scripts/typecheck.js"},"dist":{"shasum":"33879fddae7f392a9cc5bb824f3c444abe7e5a6a","tarball":"https://registry.npmjs.org/@abctech001/code-quality-toolkit/-/code-quality-toolkit-1.0.0.tgz","fileCount":16,"integrity":"sha512-+Av5plbg3R8ZqdkbXShlZpnAb1x/uqi3hQB0aKBpqoj5jBx3nZkM870FCnqtKAEzFt+eOn3+1jJZ64TG0+erHQ==","signatures":[{"sig":"MEUCIQDpm8jfrBMTErD54ZXjSZg4CSkQE6ou9xwpI86pwwi0RQIgF0B4lsOwC3TfQ65e+TC2teAuNKrycjc2fMs01hvftPE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":39706},"main":"./lib/index.js","type":"module","engines":{"node":">=18.18.0"},"exports":{".":"./lib/index.js","./eslint":"./configs/eslint.config.js","./prettier":"./configs/prettier.config.js","./commitlint":"./configs/commitlint.config.js","./lint-staged":"./configs/lint-staged.config.js"},"gitHead":"55949120c84f5e0e752a3c4d1daf45d0e99e00db","_npmUser":{"name":"haha002","email":"sexmoringnak@gmail.com"},"_npmVersion":"10.9.0","description":"团队代码质量工具包：Husky + lint-staged + ESLint + Prettier + Commitlint + TypeScript 类型检查，一键集成","directories":{},"_nodeVersion":"22.12.0","dependencies":{"husky":"^9.1.7","eslint":"^9.28.0","globals":"^16.2.0","prettier":"^3.5.3","tsc-files":"^1.1.4","@eslint/js":"^9.28.0","lint-staged":"^16.1.0","@commitlint/cli":"^19.8.0","typescript-eslint":"^8.33.1","eslint-config-prettier":"^10.1.5","eslint-plugin-prettier":"^5.4.1","@commitlint/config-conventional":"^19.8.0"},"_hasShrinkwrap":false,"peerDependencies":{"typescript":">=5.0.0"},"peerDependenciesMeta":{"typescript":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/code-quality-toolkit_1.0.0_1782867637119_0.3013569116271888","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@abctech001/code-quality-toolkit","version":"1.0.1","keywords":["eslint","prettier","husky","lint-staged","commitlint","typescript","code-quality","git-hooks"],"license":"MIT","_id":"@abctech001/code-quality-toolkit@1.0.1","maintainers":[{"name":"haha002","email":"sexmoringnak@gmail.com"}],"bin":{"team-dev-init":"bin/init.js","team-typecheck":"lib/scripts/typecheck.js"},"dist":{"shasum":"f98842ed896808ef5963e5a58cdcf0e4e7d7621f","tarball":"https://registry.npmjs.org/@abctech001/code-quality-toolkit/-/code-quality-toolkit-1.0.1.tgz","fileCount":16,"integrity":"sha512-pVBxSOVQWk2ytAfzy7+hasIzEMUbBlIiOQ4LkfHNPSw+t5Xbnm9l0pQzBzYzDXcNQIkcg3P9h6tdKhs2gXRM4g==","signatures":[{"sig":"MEUCIB4XqH7QQwaYpDtyx30zBzb3E4CYV6EVIlxbvfhdJerbAiEApi+U8EkWqGBAF2IcWSg/Ol4QP0QjCD09ou79Q8YcZiw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":41319},"main":"./lib/index.js","type":"module","engines":{"node":">=18.18.0"},"exports":{".":"./lib/index.js","./eslint":"./configs/eslint.config.js","./prettier":"./configs/prettier.config.js","./commitlint":"./configs/commitlint.config.js","./lint-staged":"./configs/lint-staged.config.js"},"gitHead":"55949120c84f5e0e752a3c4d1daf45d0e99e00db","_npmUser":{"name":"haha002","email":"sexmoringnak@gmail.com"},"_npmVersion":"10.9.0","description":"团队代码质量工具包：Husky + lint-staged + ESLint + Prettier + Commitlint + TypeScript 类型检查，一键集成","directories":{},"_nodeVersion":"22.12.0","dependencies":{"husky":"^9.1.7","eslint":"^9.28.0","globals":"^16.2.0","prettier":"^3.5.3","tsc-files":"^1.1.4","@eslint/js":"^9.28.0","lint-staged":"^16.1.0","@commitlint/cli":"^19.8.0","typescript-eslint":"^8.33.1","eslint-config-prettier":"^10.1.5","eslint-plugin-prettier":"^5.4.1","@commitlint/config-conventional":"^19.8.0"},"_hasShrinkwrap":false,"peerDependencies":{"typescript":">=5.0.0"},"peerDependenciesMeta":{"typescript":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/code-quality-toolkit_1.0.1_1782873212933_0.8919389223073251","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@abctech001/code-quality-toolkit","version":"1.0.2","keywords":["eslint","prettier","husky","lint-staged","commitlint","typescript","code-quality","git-hooks"],"license":"MIT","_id":"@abctech001/code-quality-toolkit@1.0.2","maintainers":[{"name":"haha002","email":"sexmoringnak@gmail.com"}],"bin":{"team-dev-init":"bin/init.js","team-typecheck":"lib/scripts/typecheck.js"},"dist":{"shasum":"ca3ef0f9028f7b99378f289897eed2eb0163e0e7","tarball":"https://registry.npmjs.org/@abctech001/code-quality-toolkit/-/code-quality-toolkit-1.0.2.tgz","fileCount":17,"integrity":"sha512-7xvlM3htqzkFU9d9bNkIuuH3r/gFAXv0IfR/X9VouSha0RbCtQDWOSUpbmhOpSsxpOuvWRT/Um7DDyKrCm53Sw==","signatures":[{"sig":"MEUCIQDpYSEJ9wLCtR2OvTpNZVqQu6bR9c7yMVqsyXlOMRckZAIgHbdhTbbXgQLekWyECeImRw6IqIEEUuZxZnHmxw+kPEo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":51044},"main":"./lib/index.js","type":"module","engines":{"node":">=18.18.0"},"exports":{".":"./lib/index.js","./eslint":"./configs/eslint.config.js","./prettier":"./configs/prettier.config.js","./commitlint":"./configs/commitlint.config.js","./lint-staged":"./configs/lint-staged.config.js"},"gitHead":"55949120c84f5e0e752a3c4d1daf45d0e99e00db","_npmUser":{"name":"haha002","email":"sexmoringnak@gmail.com"},"_npmVersion":"10.9.0","description":"团队代码质量工具包：Husky + lint-staged + ESLint + Prettier + Commitlint + TypeScript 类型检查，一键集成","directories":{},"_nodeVersion":"22.12.0","dependencies":{"husky":"^9.1.7","eslint":"^9.28.0","globals":"^16.2.0","prettier":"^3.5.3","tsc-files":"^1.1.4","@eslint/js":"^9.28.0","lint-staged":"^16.1.0","@commitlint/cli":"^19.8.0","typescript-eslint":"^8.33.1","eslint-config-prettier":"^10.1.5","eslint-plugin-prettier":"^5.4.1","@commitlint/config-conventional":"^19.8.0"},"_hasShrinkwrap":false,"peerDependencies":{"typescript":">=5.0.0"},"peerDependenciesMeta":{"typescript":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/code-quality-toolkit_1.0.2_1782874128326_0.9571417059969116","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@abctech001/code-quality-toolkit","version":"1.0.3","keywords":["eslint","prettier","husky","lint-staged","commitlint","typescript","code-quality","git-hooks"],"license":"MIT","_id":"@abctech001/code-quality-toolkit@1.0.3","maintainers":[{"name":"haha002","email":"sexmoringnak@gmail.com"}],"bin":{"team-dev-init":"bin/init.js","team-typecheck":"lib/scripts/typecheck.js"},"dist":{"shasum":"303badfaaf69210204af22e9450d54fa0b923f9e","tarball":"https://registry.npmjs.org/@abctech001/code-quality-toolkit/-/code-quality-toolkit-1.0.3.tgz","fileCount":17,"integrity":"sha512-LPElGstSl51TYsZAFqJxa7qo0HDUi+yEneQ59tQb8vQ3WK3/knb+E3Mubym8vfEeOBbqjrqfa5OKCVt8Kr3aoQ==","signatures":[{"sig":"MEUCICU38ywDez+zjo7hhqDPFqFpv9jDNmSVKk5Z70TX+VmBAiEAqSUmSi+qRRhFgFsZi2mLLmeCMfI8xB+PusSrHXgkrR0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":51216},"main":"./lib/index.js","type":"module","engines":{"node":">=18.18.0"},"exports":{".":"./lib/index.js","./eslint":"./configs/eslint.config.js","./prettier":"./configs/prettier.config.js","./commitlint":"./configs/commitlint.config.js","./lint-staged":"./configs/lint-staged.config.js"},"gitHead":"55949120c84f5e0e752a3c4d1daf45d0e99e00db","_npmUser":{"name":"haha002","email":"sexmoringnak@gmail.com"},"_npmVersion":"10.9.0","description":"团队代码质量工具包：Husky + lint-staged + ESLint + Prettier + Commitlint + TypeScript 类型检查，一键集成","directories":{},"_nodeVersion":"22.12.0","dependencies":{"husky":"^9.1.7","eslint":"^9.28.0","globals":"^16.2.0","prettier":"^3.5.3","tsc-files":"^1.1.4","@eslint/js":"^9.28.0","lint-staged":"^16.1.0","@commitlint/cli":"^19.8.0","typescript-eslint":"^8.33.1","eslint-config-prettier":"^10.1.5","eslint-plugin-prettier":"^5.4.1","@commitlint/config-conventional":"^19.8.0"},"_hasShrinkwrap":false,"peerDependencies":{"typescript":">=5.0.0"},"peerDependenciesMeta":{"typescript":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/code-quality-toolkit_1.0.3_1782874876740_0.15435928521095432","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@abctech001/code-quality-toolkit","version":"1.0.4","keywords":["eslint","prettier","husky","lint-staged","commitlint","typescript","code-quality","git-hooks"],"license":"MIT","_id":"@abctech001/code-quality-toolkit@1.0.4","maintainers":[{"name":"haha002","email":"sexmoringnak@gmail.com"}],"bin":{"team-dev-init":"bin/init.js","team-typecheck":"lib/scripts/typecheck.js"},"dist":{"shasum":"1414099e02c3c7bb7f90e66fd1ed36a628783f8c","tarball":"https://registry.npmjs.org/@abctech001/code-quality-toolkit/-/code-quality-toolkit-1.0.4.tgz","fileCount":17,"integrity":"sha512-NTtQPTVab4qycZBctIIJzTrh7CK0s/qezZKoUIiLu3tr6D98lcp2zgyollAu6JTqBL8GEur1j14QkmXV5UZ/QA==","signatures":[{"sig":"MEUCIGmFuD6L9ADyQ25Sy3HdGPViNe8PCl+PdLVogwTSUJK/AiEA2l72xIuXGCAaiFWTD/Lk3s0PAH8LwIr1SlGL8LmSzxE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":54740},"main":"./lib/index.js","type":"module","engines":{"node":">=18.18.0"},"exports":{".":"./lib/index.js","./eslint":"./configs/eslint.config.js","./prettier":"./configs/prettier.config.js","./commitlint":"./configs/commitlint.config.js","./lint-staged":"./configs/lint-staged.config.js"},"gitHead":"55949120c84f5e0e752a3c4d1daf45d0e99e00db","_npmUser":{"name":"haha002","email":"sexmoringnak@gmail.com"},"_npmVersion":"10.9.0","description":"团队代码质量工具包：Husky + lint-staged + ESLint + Prettier + Commitlint + TypeScript 类型检查，一键集成","directories":{},"_nodeVersion":"22.12.0","dependencies":{"husky":"^9.1.7","eslint":"^9.28.0","globals":"^16.2.0","prettier":"^3.5.3","tsc-files":"^1.1.4","@eslint/js":"^9.28.0","lint-staged":"^16.1.0","@commitlint/cli":"^19.8.0","typescript-eslint":"^8.33.1","eslint-config-prettier":"^10.1.5","eslint-plugin-prettier":"^5.4.1","@commitlint/config-conventional":"^19.8.0"},"_hasShrinkwrap":false,"peerDependencies":{"typescript":">=5.0.0"},"peerDependenciesMeta":{"typescript":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/code-quality-toolkit_1.0.4_1782887192908_0.700240175131633","host":"s3://npm-registry-packages-npm-production"}},"1.0.5":{"name":"@abctech001/code-quality-toolkit","version":"1.0.5","description":"团队代码质量工具包：Husky + lint-staged + ESLint + Prettier + Commitlint + TypeScript 类型检查，一键集成","type":"module","main":"./lib/index.js","bin":{"team-dev-init":"bin/init.js","team-typecheck":"lib/scripts/typecheck.js"},"exports":{".":"./lib/index.js","./eslint":"./configs/eslint.config.js","./prettier":"./configs/prettier.config.js","./commitlint":"./configs/commitlint.config.js","./lint-staged":"./configs/lint-staged.config.js"},"keywords":["eslint","prettier","husky","lint-staged","commitlint","typescript","code-quality","git-hooks"],"license":"MIT","engines":{"node":">=18.18.0"},"dependencies":{"@commitlint/cli":"^19.8.0","@commitlint/config-conventional":"^19.8.0","@eslint/js":"^9.28.0","eslint":"^9.28.0","eslint-config-prettier":"^10.1.5","eslint-plugin-prettier":"^5.4.1","globals":"^16.2.0","husky":"^9.1.7","lint-staged":"^16.1.0","prettier":"^3.5.3","tsc-files":"^1.1.4","typescript-eslint":"^8.33.1"},"peerDependencies":{"typescript":">=5.0.0"},"peerDependenciesMeta":{"typescript":{"optional":true}},"_id":"@abctech001/code-quality-toolkit@1.0.5","gitHead":"a66b83fff56761c0953d4d7195b3ded9cf3c7d16","_nodeVersion":"22.12.0","_npmVersion":"10.9.0","dist":{"integrity":"sha512-IsVvWFj+TzXE2VeEGOpxXCPXwOfCojVsngf9UzjFgsDMEYBN20o/ffNZTDXDmgABDpTZwXjN6HUBfZ1lxM3d9Q==","shasum":"d729c0444b749a23cf9506ab95abf257f74a8388","tarball":"https://registry.npmjs.org/@abctech001/code-quality-toolkit/-/code-quality-toolkit-1.0.5.tgz","fileCount":17,"unpackedSize":55177,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIESu/OXsbsRJS4rOCMQ2rT7H090oTsc2Ke8wWJbe/eHRAiEA606B6LU8KjFriQJth6gb9SXDtJ58ppoY6AGVpZ1mAAc="}]},"_npmUser":{"name":"haha002","email":"sexmoringnak@gmail.com"},"directories":{},"maintainers":[{"name":"haha002","email":"sexmoringnak@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/code-quality-toolkit_1.0.5_1782955459593_0.6148261635539436"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-01T01:00:36.984Z","modified":"2026-07-02T01:24:19.872Z","1.0.0":"2026-07-01T01:00:37.250Z","1.0.1":"2026-07-01T02:33:33.073Z","1.0.2":"2026-07-01T02:48:48.454Z","1.0.3":"2026-07-01T03:01:16.861Z","1.0.4":"2026-07-01T06:26:33.053Z","1.0.5":"2026-07-02T01:24:19.728Z"},"license":"MIT","keywords":["eslint","prettier","husky","lint-staged","commitlint","typescript","code-quality","git-hooks"],"description":"团队代码质量工具包：Husky + lint-staged + ESLint + Prettier + Commitlint + TypeScript 类型检查，一键集成","maintainers":[{"name":"haha002","email":"sexmoringnak@gmail.com"}],"readme":"# @abctech001/code-quality-toolkit\n\n团队代码质量工具包 — 一键集成 **Husky**、**lint-staged**、**ESLint**、**Prettier**、**Commitlint**，并**可选**启用 **TypeScript** 类型检查。\n\n团队成员只需 `npm install` + 一条初始化命令，即可在项目中启用统一的代码规范与 Git 提交校验，无需逐个工具手动配置。\n\n---\n\n## 功能概览\n\n| 能力 | 工具 | 触发时机 |\n|------|------|----------|\n| 代码规范检查 | ESLint | `git commit` 前（暂存文件） |\n| 自动格式化 | Prettier | `git commit` 前（暂存文件） |\n| 提交信息规范 | Commitlint | `git commit` 时 |\n| 增量类型检查 | tsc-files | `git commit` 前（仅 TS 项目，暂存 .ts/.tsx） |\n| 完整类型检查 | tsc --noEmit | CI / 本地 `npm run typecheck:ci`（无 TS 时自动跳过） |\n\n### 支持的 Commit 类型\n\n| type | 说明 | 适用场景 |\n|------|------|----------|\n| `feat` | 新功能 | 新增功能或模块 |\n| `fix` | 修复 Bug | 修复缺陷 |\n| `docs` | 文档变更 | README、注释、API 文档 |\n| `style` | 代码格式 | 空格、缩进、ESLint 修复（不影响逻辑） |\n| `refactor` | 重构 | 非新增、非修复的代码改动 |\n| `perf` | 性能优化 | 提升性能的改动 |\n| `test` | 测试相关 | 单元测试、集成测试 |\n| `build` | 构建系统 | webpack、vite 等构建配置 |\n| `ci` | CI/CD | GitHub Actions、Jenkins 等 |\n| `chore` | 杂务 | .gitignore、依赖升级等 |\n| `revert` | 回滚 | 回滚之前的提交 |\n| `hotfix` | 紧急热修复 | 线上紧急修复 |\n\n提交格式：\n\n```text\n<type>: <subject>\n\n<body>\n\n<footer>\n```\n\n示例：\n\n```bash\ngit commit -m \"feat: 新增用户注册接口\" -m \"- 支持手机号+验证码注册\" -m \"任务#123\"\n```\n\n---\n\n## 安装与使用\n\n### 前置条件\n\n| 要求 | 说明 |\n|------|------|\n| Node.js | >= 18.18.0 |\n| Git 仓库 | 项目根目录已执行 `git init`（Husky 依赖 `.git` 目录） |\n| package.json | 目标目录必须是 Node.js 项目根目录 |\n\n> **TypeScript 为可选依赖**：纯 JavaScript 项目无需安装 `typescript`；若项目有 `tsconfig.json` 且安装了 `typescript`，类型检查会自动启用。\n\n### 安装步骤\n\n在**目标项目根目录**依次执行以下命令：\n\n#### 第 1 步：安装 npm 包\n\n```bash\nnpm install -D @abctech001/code-quality-toolkit\n```\n\n使用 pnpm / yarn 亦可：\n\n```bash\npnpm add -D @abctech001/code-quality-toolkit\n# 或\nyarn add -D @abctech001/code-quality-toolkit\n```\n\n> 若包发布在私有 npm Registry，请先配置 `.npmrc` 后再安装。\n\n#### 第 2 步：一键初始化\n\n```bash\nnpx team-dev-init\n```\n\n初始化脚本会自动完成：\n\n| 操作 | 说明 |\n|------|------|\n| 生成配置文件 | `eslint.config.js`、`prettier.config.js`、`commitlint.config.js`、`lint-staged.config.js` |\n| 生成规范文档 | `CODE_STANDARDS.md`（团队代码规范、提交规范、使用与更新说明） |\n| 生成忽略文件 | `.gitignore`、`.prettierignore` |\n| 更新 package.json | 注入 `prepare`、`lint`、`format`、`typecheck` 等 scripts |\n| 启用 ESM | 若未设置 `\"type\": \"module\"`，会自动添加 |\n| 配置 Git Hooks | Husky `pre-commit`（lint-staged）+ `commit-msg`（commitlint） |\n| 安装根部依赖 | 自动检测 npm / pnpm / yarn / bun，补齐 `husky`、`lint-staged`、`@commitlint/cli` 等 |\n\n初始化成功后，每次 `git commit` 将自动执行代码检查与提交信息校验。\n\n#### 第 3 步：TypeScript 项目（可选）\n\n纯 JS 项目**跳过此步**。若项目使用 TypeScript，安装依赖并复制团队 `tsconfig` 模板：\n\n```bash\nnpm install -D typescript\ncp node_modules/@abctech001/code-quality-toolkit/templates/tsconfig.json ./tsconfig.json\n```\n\n#### 第 4 步：验证安装\n\n```bash\nnpm run lint          # ESLint 全量检查\nnpm run format:check  # Prettier 格式检查\nnpm run typecheck     # TypeScript 类型检查（无 TS 配置时自动跳过）\n```\n\n试一次提交，确认 Git Hooks 生效：\n\n```bash\ngit add .\ngit commit -m \"chore: 集成代码质量工具包\"\n```\n\n### 完整示例（从零开始）\n\n```bash\n# 1. 创建并进入项目\nmkdir my-app && cd my-app\nnpm init -y\ngit init\n\n# 2. 安装并初始化工具包\nnpm install -D @abctech001/code-quality-toolkit\nnpx team-dev-init\n\n# 3.（可选）TypeScript 项目\nnpm install -D typescript\ncp node_modules/@abctech001/code-quality-toolkit/templates/tsconfig.json ./tsconfig.json\n\n# 4. 验证\nnpm run lint\ngit add .\ngit commit -m \"chore: 初始化项目\"\n```\n\n### 已有项目接入\n\n若项目已存在 ESLint / Prettier 等配置，`team-dev-init` 默认**不会覆盖**已有文件。需要以团队规范替换时：\n\n```bash\nnpx team-dev-init --force\n```\n\n仅生成配置文件、不配置 Husky 时：\n\n```bash\nnpx team-dev-init --skip-husky\n```\n\n### 克隆仓库后的恢复\n\n团队成员克隆已接入的项目后，执行 `npm install` 即可。`prepare` 脚本会自动运行 `husky`，恢复 Git Hooks，无需再次执行 `team-dev-init`。\n\n阅读项目根目录的 **`CODE_STANDARDS.md`** 可了解代码规范、提交规范及工具包更新方式。\n\n### 版本更新\n\n```bash\n# 更新到最新版（规则类变更，通常只需这一步）\nnpm install -D @abctech001/code-quality-toolkit@latest\n\n# Hooks / 文档模板有变时，同步本地配置与 CODE_STANDARDS.md\nnpx team-dev-init --force\n```\n\n---\n\n## 自动注入的 npm scripts\n\n| 命令 | 说明 |\n|------|------|\n| `npm run lint` | ESLint 全量检查 |\n| `npm run lint:fix` | ESLint 自动修复 |\n| `npm run format` | Prettier 格式化全部文件 |\n| `npm run format:check` | Prettier 格式检查（CI 可用） |\n| `npm run typecheck` | TypeScript 类型检查（无 TS 配置时跳过） |\n| `npm run typecheck:ci` | CI 类型检查（无 TS 配置时跳过） |\n\n---\n\n## Git Hooks 行为\n\n初始化后，Husky 与项目根目录配置文件的关系如下：\n\n```text\ngit commit\n├── pre-commit\n│   └── npx lint-staged --config lint-staged.config.js\n│       ├── eslint --fix --config eslint.config.js\n│       ├── prettier --write --config prettier.config.js\n│       └── tsc-files --noEmit（仅 TS 项目）\n└── commit-msg\n    └── commitlint --config commitlint.config.js\n```\n\n以上 4 个 `*.config.js` 均由 `team-dev-init` 生成，内容继承自 `@abctech001/code-quality-toolkit` 包内团队规范。\n\n### pre-commit\n\n对 **暂存文件** 依次执行：\n\n1. **ESLint --fix** — 读取 `eslint.config.js`，代码规范检查与自动修复\n2. **Prettier --write** — 读取 `prettier.config.js`，代码格式化\n3. **tsc-files --noEmit** — TypeScript 增量类型检查（**仅 TS 项目**，检查暂存的 `.ts` / `.tsx`）\n\n### commit-msg\n\n使用 **Commitlint** 读取 `commitlint.config.js` 校验提交信息，不符合团队规范的提交将被拒绝。\n\n> 若 Hooks 未生效或仍是 `npm test`，请重新执行 `npx team-dev-init --force` 覆盖 `.husky` 目录。\n\n---\n\n## CI 集成示例\n\n### GitHub Actions\n\n```yaml\nname: Code Quality\n\non: [push, pull_request]\n\njobs:\n  quality:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n      - uses: actions/setup-node@v4\n        with:\n          node-version: 20\n          cache: npm\n      - run: npm ci\n      - run: npm run lint\n      - run: npm run format:check\n      - run: npm run typecheck:ci\n```\n\n---\n\n## 手动引用配置（高级用法）\n\n若不想使用 `team-dev-init`，也可在项目中手动引用：\n\n```js\n// eslint.config.js\nimport teamEslintConfig from '@abctech001/code-quality-toolkit/eslint';\nexport default [...teamEslintConfig];\n```\n\n```js\n// prettier.config.js\nimport teamPrettierConfig from '@abctech001/code-quality-toolkit/prettier';\nexport default teamPrettierConfig;\n```\n\n```js\n// commitlint.config.js\nimport teamCommitlintConfig from '@abctech001/code-quality-toolkit/commitlint';\nexport default teamCommitlintConfig;\n```\n\n```js\n// lint-staged.config.js\nimport teamLintStagedConfig from '@abctech001/code-quality-toolkit/lint-staged';\nexport default teamLintStagedConfig;\n```\n\n---\n\n## 发布到 npm\n\n修改 `package.json` 中的 `name` 为你的组织 scope（如 `@abctech001/code-quality-toolkit`），然后：\n\n```bash\n# 登录 npm（首次）\nnpm login\n\n# 发布\nnpm publish --access public\n```\n\n> scoped 包首次发布需加 `--access public`，否则默认为 private。\n\n---\n\n## 环境要求\n\n- Node.js >= 18.18.0\n- TypeScript >= 5.0.0（可选，TS 项目需要）\n- Git 仓库（Husky 需要）\n\n---\n\n## 规则一览\n\n### Prettier 格式化规则\n\n| 配置项 | 值 | 说明 |\n|--------|-----|------|\n| `printWidth` | `100` | 每行最大 100 字符 |\n| `tabWidth` | `2` | 缩进 2 空格 |\n| `useTabs` | `false` | 使用空格缩进，不用 Tab |\n| `semi` | `true` | 语句末尾加分号 |\n| `singleQuote` | `false` | **使用双引号** |\n| `jsxSingleQuote` | `false` | JSX 属性也使用双引号 |\n| `trailingComma` | `all` | 对象、数组等多行结构加尾随逗号 |\n| `bracketSpacing` | `true` | 对象大括号内侧加空格 `{ foo: bar }` |\n| `bracketSameLine` | `false` | JSX 闭合括号单独换行 |\n| `arrowParens` | `always` | 箭头函数单参数也加括号 `(x) => x` |\n| `endOfLine` | `lf` | 换行符统一 LF |\n\n示例：\n\n```javascript\nconst name = \"hello\";\nconst obj = { foo: \"bar\" };\nconst fn = (x) => x + 1;\n```\n\n### ESLint 自定义规则\n\n在 `@eslint/js` recommended 基础上，额外启用以下团队规则：\n\n| 规则 | 级别 | 说明 |\n|------|------|------|\n| `prefer-const` | error | 优先使用 `const` |\n| `no-var` | error | 禁止使用 `var` |\n| `no-console` | warn | 禁止 `console.log`，允许 `warn` / `error` |\n| `no-unused-vars` | error | 禁止未使用变量（纯 JS 项目，`_` 前缀可忽略） |\n| `@typescript-eslint/no-unused-vars` | error | 禁止未使用变量（TS 项目，`_` 前缀可忽略） |\n| `@typescript-eslint/no-explicit-any` | warn | 使用 `any` 时警告（仅 TS 项目） |\n| `@typescript-eslint/no-empty-function` | warn | 空函数警告（仅 TS 项目） |\n| `prettier/prettier` | error | 不符合 Prettier 格式时报错 |\n\n> TS 项目还会自动启用 `typescript-eslint` 的 **recommended** 推荐规则集。\n\n### Commitlint 提交规范\n\n完整格式：\n\n```text\n<type>: <subject>\n\n<body>\n\n<footer>\n```\n\n| 部分 | 必填 | 说明 |\n|------|------|------|\n| Header | 必填 | 第一行 `type: subject`，最长 **50** 字符 |\n| Body | 可选 | 详细描述，每行不超过 **72** 字符 |\n| Footer | 可选 | 禅道编号或不兼容变更 |\n\n**Footer 禅道编号格式：**\n\n| 类型 | 格式 | 示例 |\n|------|------|------|\n| 需求 | `需求#数字` | `需求#123` |\n| 任务 | `任务#数字` | `任务#456` |\n| Bug | `Bug#数字` | `Bug#789` |\n| 不兼容变更 | `BREAKING CHANGE: 说明` | `BREAKING CHANGE: 接口参数变更` |\n\n多个编号逗号分隔：`任务#123, Bug#456`\n\n**提交过滤规则（跳过校验）：**\n\n以下提交信息不会触发 Commitlint 校验：\n\n| 来源 | 匹配示例 | 说明 |\n|------|----------|------|\n| 内置 `defaultIgnores` | `Merge pull request #1` | Git 合并提交 |\n| 内置 `defaultIgnores` | `Merge branch 'main' into dev` | 分支合并 |\n| 内置 `defaultIgnores` | `Revert \"feat: xxx\"` | 回滚提交 |\n| 内置 `defaultIgnores` | `fixup! feat: xxx` | rebase 整理提交 |\n| 内置 `defaultIgnores` | `squash! feat: xxx` | rebase 压缩提交 |\n| 内置 `defaultIgnores` | `chore: 1.2.3` | 语义化版本发布 |\n| 团队自定义 | `WIP: 调试中` | 暂存提交（work in progress） |\n\n> 如需关闭内置过滤，在 `commitlint.config.js` 中设置 `defaultIgnores: false`。\n\n**校验规则：**\n\n| 规则 | 级别 | 说明 |\n|------|------|------|\n| `type-enum` | error | 12 种 type（含 hotfix、perf、build、ci、revert） |\n| `type-empty` | error | type 不能为空 |\n| `type-case` | error | type 必须小写 |\n| `scope-empty` | error | 禁止使用 scope，格式为 `type: subject` |\n| `subject-empty` | error | subject 不能为空 |\n| `subject-full-stop` | error | subject 不以 `.` 结尾 |\n| `subject-case` | error | subject 首字母小写（中文不受影响） |\n| `header-max-length` | error | Header 最长 50 字符 |\n| `body-leading-blank` | error | Body 前空一行 |\n| `body-max-line-length` | error | Body 每行最长 72 字符 |\n| `footer-leading-blank` | error | Footer 前空一行 |\n| `footer-max-line-length` | error | Footer 每行最长 72 字符 |\n| `zentao-footer` | error | Footer 须为禅道编号或 BREAKING CHANGE |\n\n**示例：**\n\n```text\nfeat: 新增用户注册接口\n\n- 支持手机号+验证码注册\n- 注册成功后自动生成默认头像\n\n任务#123\n```\n\n```text\nfix: 修复优惠券叠加计算错误\n\nBug#456\n```\n\n```text\nfeat: 升级 JWT 为 RS256 加密\n\nBREAKING CHANGE: 旧版令牌需重新登录\n\n任务#777\n```\n\n### lint-staged（提交前检查）\n\n| 文件类型 | 执行操作 |\n|----------|----------|\n| `*.{js,jsx,mjs,cjs}` | ESLint 修复 + Prettier 格式化 |\n| `*.{ts,tsx}` | ESLint 修复 + Prettier 格式化 + 增量类型检查（仅 TS 项目） |\n| `*.{json,md,yml,yaml,css,scss,less,html}` | Prettier 格式化 |\n\n### 忽略目录（ESLint / Git）\n\n| 工具 | 忽略项 |\n|------|--------|\n| ESLint | `node_modules`、`dist`、`build`、`coverage`、`.next`、`.nuxt`、`out` |\n| Git（`.gitignore`） | `node_modules`、构建产物、日志、`.env`、IDE 配置等 |\n\n`.gitignore` 由 `team-dev-init` 自动创建，确保 `node_modules` 等目录不会被提交到 Git 仓库。\n\n---\n\n## License\n\nMIT\n","readmeFilename":"README.md"}