{"id":27158079,"url":"https://github.com/yhtml5/check-list","last_synced_at":"2025-04-08T21:54:52.592Z","repository":{"id":43496209,"uuid":"191860980","full_name":"yhtml5/check-list","owner":"yhtml5","description":"Checklist is an automated detection tool that ensures code quality. It can be used with Husky to implement code pre-commit checks. It can also be integrated into automated deployment scripts.","archived":false,"fork":false,"pushed_at":"2023-07-12T11:31:13.000Z","size":170,"stargazers_count":3,"open_issues_count":9,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-14T22:12:57.492Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/yhtml5.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-06-14T02:10:07.000Z","updated_at":"2023-11-22T14:56:20.000Z","dependencies_parsed_at":"2023-01-31T19:15:55.743Z","dependency_job_id":null,"html_url":"https://github.com/yhtml5/check-list","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yhtml5%2Fcheck-list","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yhtml5%2Fcheck-list/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yhtml5%2Fcheck-list/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yhtml5%2Fcheck-list/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yhtml5","download_url":"https://codeload.github.com/yhtml5/check-list/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247934789,"owners_count":21020725,"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":[],"created_at":"2025-04-08T21:54:51.941Z","updated_at":"2025-04-08T21:54:52.573Z","avatar_url":"https://github.com/yhtml5.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Check List\n\n## 概念\ncheck list 是一个自动化检测工具, 补充了 eslint/单元测试 等工具之外的功能.\n确保代码的质量, 它可以集成到自动化部署脚本中, 也可以配合husky, 实现代码提交前检测\n\n在一个多人协作过程的项目中, 我们会遇到许多问题\n- 删除关键性文件, 造成严重问题\n- 引入过大的包, 造成性能问题: `import _ from lodash`\n- 提交了错误代码: git冲突 `\u003c\u003c\u003c\u003c\u003c\u003c\u003c`\n- 使用了特殊兼容性代码, babel只配置es6: `Date.now, [].includes`\n- 调试代码未关闭, 使用了 mock数据, debugger, alert\n- 部署后, 提醒后续操作内容\n\n## Process\n\nconfig =\u003e rule =\u003e ruleHandler\n\nnpm run check\n=\u003e check()\n=\u003e rule: handler[type]\n=\u003e handler: title/regex/require/limit\n=\u003e lib: checkCode/getDirSize/checkRequiredFiles\n=\u003e ask\n=\u003e console result\n\n## 命令行\n\n在项目根目录下增加config.js\n\n\u003e $ npm i @yhtml5/check-list -g\n\u003e $ check ./demo/config.js\n\n## JavaScript API (support soon)\n**@yhtml5/check-list** 提供 JavaScript 接口那样可以通过 Node.js 来使用。\n\n\u003e $ npm i @yhtml5/check-list -D\n\n```js\nconst check = require('@yhtml5/check-list')\ncheck(config)\n```\n\n## 配置文件(Configuration files)\n\n配置文件是一个commonjs模块，它对外暴露一个对象，这个对象包含了一些 **@yhtml5/check-list** 需要的一些选项。通常，我们把这个配置文件叫做config.js，它通常位于项目的根目录\n\n### rules\n参考 `@yhtml5/check-list/demo/config.js`\nconfig.checkList.rules 是一个规则数组\n\n### type: title\n不检查, 输出 describe, 用作分割线\n```js\n{\n  type: 'title',\n  describe: 'Check List Rules:',\n}\n```\n\n### type: require\n检查关键性文件是否丢失\n```js\n{\n  type: 'require',\n  describe: '检查文件完整性: 关键性文件',\n  paths: [__dirname]\n}\n```\n\n### type: limit\n检查文件大小限制\n```js\n{\n  type: 'limit',\n  describe: '检查文件大小限制: dist',\n  paths: [__dirname],\n  min: 10,\n  max: 100\n}\n```\n\n### type: regex\n正则匹配文件内容, 返回 buffer, 需要考虑 [空格, 多行, 注释] 等情况\n```js\n  type: 'regex',\n  describe: '检查是否存在: 冲突代码',\n  paths: [__dirname],\n  regex: /^\u003c\u003c\u003c\u003c\u003c|^\u003e\u003e\u003e\u003e\u003e/gm,\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyhtml5%2Fcheck-list","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyhtml5%2Fcheck-list","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyhtml5%2Fcheck-list/lists"}