{"id":28433067,"url":"https://github.com/ice-lab/spec","last_synced_at":"2025-07-01T11:30:51.096Z","repository":{"id":34995772,"uuid":"194889071","full_name":"ice-lab/spec","owner":"ice-lab","description":":hatching_chick: easy to use eslint/stylelint/tslint/prettier/...","archived":false,"fork":false,"pushed_at":"2025-04-09T06:42:00.000Z","size":352,"stargazers_count":62,"open_issues_count":4,"forks_count":7,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-05-29T10:45:05.465Z","etag":null,"topics":["eslint","linter","prettier","stylelint","tslint"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ice-lab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2019-07-02T15:22:17.000Z","updated_at":"2023-09-20T02:51:40.000Z","dependencies_parsed_at":"2025-05-29T10:44:24.398Z","dependency_job_id":"4858f915-9f45-4815-9bf3-0cf94a79f0e2","html_url":"https://github.com/ice-lab/spec","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ice-lab%2Fspec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ice-lab%2Fspec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ice-lab%2Fspec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ice-lab%2Fspec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ice-lab","download_url":"https://codeload.github.com/ice-lab/spec/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ice-lab%2Fspec/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":258267332,"owners_count":22674445,"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":["eslint","linter","prettier","stylelint","tslint"],"created_at":"2025-06-05T17:36:53.044Z","updated_at":"2025-07-01T11:30:51.087Z","avatar_url":"https://github.com/ice-lab.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @iceworks/spec\n\nEasy to use **eslint**(support TypeScript) / **stylelint** / **prettier** / **commitlint** in [rax](https://rax.js.org/), [ice](https://ice.work/) and react project. And spec means specification.\n\n## Install\n\n```bash\n$ npm i --save-dev @iceworks/spec eslint stylelint prettier @commitlint/cli\n```\n\nPS: You don't need to install other eslint plugins and parsers.\n\n## Usage\n\n### ESLint\n\n#### 1. Create configuration file\n\nFirst create a `.eslintrc.js` file. Then edit your config.\n\n#### 2. Update config\n\n[rules](https://github.com/ice-lab/spec/tree/master/packages/spec/src/eslint/react.js) base on [eslint-config-ali](https://www.npmjs.com/package/eslint-config-ali) and [@iceworks/eslint-plugin-best-practices](https://www.npmjs.com/package/@iceworks/eslint-plugin-best-practices).\n\n```js\n// .eslintrc.js\nconst { getESLintConfig } = require('@iceworks/spec');\n\n// getESLintConfig(rule: 'common'|'rax'|'react'|'vue', customConfig?);\nmodule.exports = getESLintConfig('react');\n```\n\n### stylelint\n\n#### 1. Create configuration file\n\nFirst create a `.stylelintrc.js` file. Then edit your config.\n\n#### 2. Update config\n\n[rules](https://github.com/ice-lab/spec/tree/master/packages/spec/src/stylelint/react.js) base on [stylelint-config-ali](https://www.npmjs.com/package/stylelint-config-ali)\n\n```js\n// .stylelintrc.js\nconst { getStylelintConfig } = require('@iceworks/spec');\n\n// getStylelintConfig(rule: 'common'|'rax'|'react'|'vue', customConfig?);\nmodule.exports = getStylelintConfig('react');\n```\n\n### prettier [rules](https://github.com/ice-lab/spec/tree/master/packages/spec/src/prettier/react.js)\n\n#### 1. Create configuration file\n\nFirst create a `.prettierrc.js` file. Then edit your config.\n\n#### 2. Update config\n\n```js\n// .prettierrc.js\nconst { getPrettierConfig } = require('@iceworks/spec');\n\n// getPrettierConfig(rule: 'common'|'rax'|'react'|'vue', customConfig?);\nmodule.exports = getPrettierConfig('react');\n```\n\n### commitlint\n\n#### 1. Create configuration file\n\nFirst create a `.commitlintrc.js` file. Then edit your config.\n\n#### 2. Update config\n\n[rules](https://github.com/ice-lab/spec/tree/master/packages/spec/src/commitlint/react.js) base on [commitlint-config-ali](https://www.npmjs.com/package/commitlint-config-ali)\n\n```js\n// .commitlintrc.js\nconst { getCommitlintConfig } = require('@iceworks/spec');\n\n// getCommitlintConfig(rule: 'common'|'rax'|'react'|'vue', customConfig?);\nmodule.exports = getCommitlintConfig('react');\n```\n\n## FAQ\n\n### Custom config\n\n```js\n// .eslintrc.js\nconst { getESLintConfig } = require('@iceworks/spec');\n\n// getESLintConfig(rule: 'common'|'rax'|'react'|'vue', customConfig?);\nmodule.exports = getESLintConfig('rax', {\n  // custom config it will merge into main config\n  rules: {\n    // ...\n  },\n});\n```\n\n### package.json scripts\n\nAdd `scripts` in your `package.json`, example: \n\n```json\n\"scripts\": {\n  \"lint\": \"npm run eslint \u0026\u0026 npm run stylelint\",\n  \"eslint\": \"eslint --cache --ext .js,.jsx,.ts,.tsx ./\",\n  \"stylelint\": \"stylelint ./**/*.scss\",\n  \"prettier\": \"prettier **/* --write\"\n}\n```\n\nThen use `npm run lint` check your project, ues `npm run prettier` update your code.\n\n### Git hooks\n\nTo lint commits before they are created you can use Husky's Git hook.\n\nInstall in your project `npm install husky --save-dev` or `yarn add -D husky`.\n\nAfter that, we recommend you to see [husky docs](https://www.npmjs.com/package/husky), then create \"`commit-msg`\" and \"`pre-commit`\" config.\n\n### Update from @ice/spec\n\nIf you are using [@ice/spec](https://www.npmjs.com/package/@ice/spec) in your project, we recommend use `@iceworks/spec` to get better maintainability and faster response to lint rules support.\n\nBased on `@iceworks/spec`'s simple API you can quickly migrate your project,  install and update your lint config file, the mission  is completed 😁.\n\n## Develop\n\n### Run Test\n\n```\nnpm run test\n```\n\nrun test for specific component\n\n```\nnpm run test -- packages/spec\n```\n\n### Run Prettier\n\n```\nnpm run prettier\n```\n\n### Run Lint\n\n```\nnpm run lint\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fice-lab%2Fspec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fice-lab%2Fspec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fice-lab%2Fspec/lists"}