{"id":17584721,"url":"https://github.com/cssmagic/stylelint-config","last_synced_at":"2025-07-03T20:33:56.761Z","repository":{"id":57681761,"uuid":"492667860","full_name":"cssmagic/stylelint-config","owner":"cssmagic","description":"Stylelint config for daily development.","archived":false,"fork":false,"pushed_at":"2022-05-26T07:18:58.000Z","size":23,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-13T23:01:54.298Z","etag":null,"topics":["css","scss","stylelint"],"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/cssmagic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-05-16T03:12:06.000Z","updated_at":"2022-06-24T04:21:30.000Z","dependencies_parsed_at":"2022-09-03T19:50:56.741Z","dependency_job_id":null,"html_url":"https://github.com/cssmagic/stylelint-config","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/cssmagic/stylelint-config","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cssmagic%2Fstylelint-config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cssmagic%2Fstylelint-config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cssmagic%2Fstylelint-config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cssmagic%2Fstylelint-config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cssmagic","download_url":"https://codeload.github.com/cssmagic/stylelint-config/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cssmagic%2Fstylelint-config/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261766575,"owners_count":23206650,"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":["css","scss","stylelint"],"created_at":"2024-10-22T02:07:52.783Z","updated_at":"2025-07-03T20:33:56.732Z","avatar_url":"https://github.com/cssmagic.png","language":"JavaScript","readme":"# stylelint-config\n\n## 安装\n\n在你的项目中安装 Stylelint 和本项目的 npm 包（以下简称 “本包”）：\n\n```sh\nnpm i -D stylelint\nnpm i -D @cmcm/stylelint-config\n```\n\n## 使用方法\n\n1. 在你的项目的根目录添加 `.stylelintrc.js` 文件：\n\n\t```js\n\tmodule.exports = {\n\t\textends: [\n\t\t\t'@cmcm/stylelint-config',\n\t\t],\n\t}\n\t```\n\n \t* 在 `extends` 字段指定预设的配置包，各配置包的具体含义参见下面的 [“配置包”](#preset) 段落。\n\n\t* 如果你的项目需要禁用或覆盖配置包中的某条规则，可以添加 `rules` 字段并写入你自己的规则配置：\n\n\t\t```js\n\t\t\trules: {\n\t\t\t\t'block-no-empty': null,     // 禁用某条规则\n\t\t\t\t'color-hex-case': 'lower',  // 覆盖某条规则\n\t\t\t},\n\t\t```\n\n\t* 如果你需要把特定文件排除在校验范围之外，可添加 `ignoreFiles` 字段：\n\n\t\t```js\n\t\t\tignoreFiles: [\n\t\t\t\t'./src/vendor/**/*.*',\n\t\t\t],\n\t\t```\n\n1. 在你的项目的 `package.json` 文件中添加脚本：\n\n\t```json\n\t{\n\t  \"scripts\": {\n\t    \"lint-css\": \"stylelint src/**/*.scss src/**/*.vue\"\n\t  }\n\t}\n\t```\n\n1. 执行以下命令开始校验 CSS 代码：\n\n\t```sh\n\tnpm run lint-css\n\t```\n\n\t如果需要 Stylelint 帮忙修复，执行以下命令：（注意：只有部分问题可以自动修复）\n\n\t```sh\n\tnpm run lint-css -- --fix\n\t```\n\n\t如有必要，你可以把上述命令整合到 CI、Git hook 等工作流中。\n\n\n## 规则\n\n* [本包的所有规则配置](doc/rule.md)\n\n\u003c!-- --\u003e\n\n* 附：[Stylelint 规则官方文档](https://stylelint.io/user-guide/rules)\n* 附：[Stylelint 官方推荐的规则集（核心规则）](https://github.com/stylelint/stylelint-config-recommended/blob/main/index.js)\n* 附：[Stylelint 官方推荐的规则集（含代码风格）](https://github.com/stylelint/stylelint-config-standard/blob/main/index.js)\n\n\n## 配置包 \u003ca name=\"preset\"\u003e\u0026nbsp;\u003c/a\u003e\n\n本包包含了多个预设的配置包，可以搭配使用。它们的含义分别如下：\n\n配置包 | 含义 | 备注\n---|---|---\n`'@cmcm/stylelint-config'` | 包含 [所有规则](doc/rule.md) | 相当于同时启用以下三个配置包\n`'@cmcm/stylelint-config/preset/essential'` | 包含 [“疑似写错” 类型的规则](doc/rule.md#possible-errors) | **强制**所有项目使用\n`'@cmcm/stylelint-config/preset/recommended'` | 包含 [“限制语言特性” 类型的规则](doc/rule.md#limit-language-features) | 强烈推荐所有项目使用\n`'@cmcm/stylelint-config/preset/stylistic'` | 包含 [“代码风格约定” 类型的规则](doc/rule.md#stylistic-issues) | 推荐使用\n\n我们可以在 `.stylelintrc.js` 文件的 `extends` 字段同时指定多个配置包：\n\n```js\n\textends: [\n\t\t'@cmcm/stylelint-config/preset/essential',\n\t\t'@cmcm/stylelint-config/preset/recommended',\n\t],\n```\n\n\n## 开发计划\n\n本包版本 | 适配 Stylelint 版本 | 状态 | 备注\n---:|---:|:---:|---\nv0.3.x | v11.x | Done\nv0.4.x | v14.x | (WIP)\n\n\n***\n\n## License\n\n[MIT License](http://www.opensource.org/licenses/mit-license.php)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcssmagic%2Fstylelint-config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcssmagic%2Fstylelint-config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcssmagic%2Fstylelint-config/lists"}