{"id":23602824,"url":"https://github.com/lzwme/fed-lint-helper","last_synced_at":"2025-05-08T21:49:06.359Z","repository":{"id":38689445,"uuid":"397289178","full_name":"lzwme/fed-lint-helper","owner":"lzwme","description":"前端项目编码质量 Lint 检测辅助工具。","archived":false,"fork":false,"pushed_at":"2025-01-17T07:10:55.000Z","size":1743,"stargazers_count":5,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-08T21:49:00.515Z","etag":null,"topics":["commitlint","eslint","git","jest","jira","linters","lzwme","prettier","typescript"],"latest_commit_sha":null,"homepage":"https://lzwme.github.io/fed-lint-helper/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lzwme.png","metadata":{"files":{"readme":"README.MD","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-08-17T14:35:36.000Z","updated_at":"2025-03-31T01:30:36.000Z","dependencies_parsed_at":"2024-01-17T09:35:05.516Z","dependency_job_id":"ff9821b5-9ce7-4446-aee8-65b884576c36","html_url":"https://github.com/lzwme/fed-lint-helper","commit_stats":{"total_commits":296,"total_committers":1,"mean_commits":296.0,"dds":0.0,"last_synced_commit":"970f7be50640ce1c9c4e4ceaa44faab3ce6f5fd4"},"previous_names":[],"tags_count":68,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lzwme%2Ffed-lint-helper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lzwme%2Ffed-lint-helper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lzwme%2Ffed-lint-helper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lzwme%2Ffed-lint-helper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lzwme","download_url":"https://codeload.github.com/lzwme/fed-lint-helper/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253154954,"owners_count":21862618,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["commitlint","eslint","git","jest","jira","linters","lzwme","prettier","typescript"],"created_at":"2024-12-27T12:13:22.807Z","updated_at":"2025-05-08T21:49:06.309Z","avatar_url":"https://github.com/lzwme.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![@lzwme/fed-lint-helper](https://nodei.co/npm/@lzwme/fed-lint-helper.png)][npm-url]\n\n# @lzwme/fed-lint-helper\n\n[![NPM version][npm-badge]][npm-url]\n[![node version][node-badge]][node-url]\n![license MIT](https://img.shields.io/github/license/lzwme/fed-lint-helper)\n\n[![build status](https://github.com/lzwme/fed-lint-helper/actions/workflows/node-ci.yml/badge.svg)](https://github.com/lzwme/fed-lint-helper/actions/workflows/node-ci.yml)\n[![npm download][download-badge]][download-url]\n[![GitHub issues][issues-badge]][issues-url]\n[![GitHub forks][forks-badge]][forks-url]\n[![GitHub stars][stars-badge]][stars-url]\n\n一个前端项目编码质量静态检查（`Lint`）辅助工具。用于辅助长期研发的大型前端项目渐进式的升级、迁移或改进编码规范约束规则。\n\n## 功能特性(Features)\n\n- 白名单机制。升级新版本、引入新规则时开启白名单模式，技术栈更新改造影响成本低\n- 可选的多线程、多进程执行模式。多项静态检查并行执行效率更高\n- 支持缓存能力。开启缓存二次执行效率显著提升，避免重复执行浪费时间\n\n已支持的 `Lint` 能力：\n\n- `eslint` 自定义 ESLint 检测执行\n- `tscheck` 自定义 TypeScript 检测执行\n- `jest` 自定义 jest 单元测试的执行\n- `prettier` 自定义 prettier 编码风格检测与格式化\n- `commitlint` 自定义遵循 Angular commit style 的 git 提交规范（用于 git hooks）\n- `jira` 自定义关联 jira 的检测逻辑（TODO: 方案说明）\n- more...\n\n![](./assets/img/flh.png)\n\n\u003cp style=\"text-align: center\"\u003e方案流程图\u003c/p\u003e\n\n## 安装(Install)\n\n```bash\n# use pnpm\npnpm add -D @lzwme/fed-lint-helper\n# use yarn\nyarn add -D @lzwme/fed-lint-helper\n# use npm\nnpm i -D @lzwme/fed-lint-helper\n```\n\n## 使用(Useage)\n\n### 命令行方式(Command Line Interface)\n\n```bash\nflh --help\n\n# 在当前目录下生成默认的配置文件 .flh.config.cjs\nflh init --config\n\n# typescript check\nflh --tscheck\n# eslint check\nflh --eslint\n# jest check\nflh --jest\n# git commit lint\nflh --commitlint\n# prettier fix\nflh --prettier --fix\n\n# Multitask parallel execution\nflh --tscheck --eslint --jest\n```\n\n其他辅助工具命令(Others)：\n\n```bash\n# 目录删除\nflh rm --help\n# 示例：删除目录 a 和 dist\nflh rm ./a ./dist -f\n\n# 消息通知\nflh notify --help\n# 示例：企业微信机器人消息通知\nflh notify \"任务执行失败！@all\" --wx-work \u003cweb hook key1\u003e \u003cweb hook key2\u003e\n```\n\n### 结合 `husky` 与 `git hooks` 使用\n\n推荐结合 `husky` 配置本地 `git hooks`。参考示例：\n\n```bash\n# .husky/commit-msg\nnpm exec flh --commitlint\n\n# .husky/pre-commit\nnpm exec flh -- --eslint --tscheck --jest --only-staged\nnpm exec flh -- --prettier --only-staged --fix\n# git add --update\n```\n\n在 `CI` 持续集成过程中可视具体需求配置。\n\n### API 调用\n\n提供了 `TsCheck`、`ESLintCheck` 等类对象供 API 方式调用，以便自定义处理逻辑在 CI 构建中的集成。\n\n```ts\nimport { TsCheck, ESLintCheck } from '@lzwme/fed-lint-helper';\n\n// typescript check\nconst tsCheck = new TsCheck({\n  exitOnError: false,\n  src: ['src'],\n  // checkOnInit: false,\n  // debug: true,\n  // toWhiteList: true,\n  // cache: true,\n  // removeCache: false,\n  // tsConfigFileName: 'tsconfig.eslint.json',\n  // silent: false,\n});\nconst res = await tsCheck.start();\nconsole.log(res);\n\n// eslint check\nconst eslintCheck = new ESLintCheck({\n  exitOnError: false,\n  src: ['src'],\n  eslintOptions: {\n    overrideConfig: {\n      rules: { eqeqeq: 'warn' },\n      // rulePaths: ['./eslint-rules/'],\n      // errorOnUnmatchedPattern: true,\n    },\n  },\n  // checkOnInit: false,\n  // cache: argv.includes('cache'),\n  // removeCache: argv.includes('nocache'),\n  // silent: argv.includes('silent'),\n  // debug: argv.includes('debug'),\n  // toWhiteList: true,\n  // fix: argv.includes('fix'),\n});\n\nlet res = await eslintCheck.start();\nconsole.log(res);\nres = await eslintCheck.start(['test/test/test-cases/ts-check-test-1.ts', 'src/ts-check.ts']);\nconsole.log(res);\n```\n\n更多细节可参考 [API 文档](https://lzw.me/doc/fed-lint-helper)。\n\n## API 文档\n\n- [https://lzwme.github.io/fed-lint-helper/](https://lzwme.github.io/fed-lint-helper/)\n\n## 开发(Development)\n\n本地二次开发：\n\n```bash\ngit clone https://github.com/lzwme/fed-lint-helper\npnpm install\npnpm dev\n# npm link\n```\n\n或者 [fork](https://github.com/lzwme/fed-lint-helper) 本项目进行代码贡献。\n\n**欢迎贡献想法与代码。**\n\n## License\n\n`@lzwme/fed-lint-helper` is released under the MIT license.\n\n该插件由[志文工作室](https://lzw.me)开发和维护。\n\n[stars-badge]: https://img.shields.io/github/stars/lzwme/fed-lint-helper.svg\n[stars-url]: https://github.com/lzwme/fed-lint-helper/stargazers\n[forks-badge]: https://img.shields.io/github/forks/lzwme/fed-lint-helper.svg\n[forks-url]: https://github.com/lzwme/fed-lint-helper/network\n[issues-badge]: https://img.shields.io/github/issues/lzwme/fed-lint-helper.svg\n[issues-url]: https://github.com/lzwme/fed-lint-helper/issues\n[npm-badge]: https://img.shields.io/npm/v/@lzwme/fed-lint-helper.svg?style=flat-square\n[npm-url]: https://npmjs.com/package/@lzwme/fed-lint-helper\n[node-badge]: https://img.shields.io/badge/node.js-%3E=_14.18.0-green.svg?style=flat-square\n[node-url]: https://nodejs.org/download/\n[download-badge]: https://img.shields.io/npm/dm/@lzwme/fed-lint-helper.svg?style=flat-square\n[download-url]: https://npmjs.com/package/@lzwme/fed-lint-helper\n[bundlephobia-url]: https://bundlephobia.com/result?p=@lzwme/fed-lint-helper@latest\n[bundlephobia-badge]: https://badgen.net/bundlephobia/minzip/@lzwme/fed-lint-helper@latest\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flzwme%2Ffed-lint-helper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flzwme%2Ffed-lint-helper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flzwme%2Ffed-lint-helper/lists"}