{"_id":"@coolh/eslint-config","_rev":"2-01960f48cbc9a3e2561201a63b367fba","name":"@coolh/eslint-config","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@coolh/eslint-config","version":"1.0.0","description":"eslint配置规则","main":"index.js","scripts":{"lint-staged":"lint-staged","lint":"eslint --ext .js,.jsx,.ts,.tsx ./test","lint:fix":"eslint --ext .js,.jsx,.ts,.tsx ./test --fix","major":"standard-version -r major","minor":"standard-version -r minor","patch":"standard-version -r patch --skip.tag","init":"standard-version  --first-release --skip.tag","cz":"git-cz"},"lint-staged":{"src/**/*.{jsx,tsx,ts,js,json,md}":["prettier --write","yarn style","eslint --fix","git add ."]},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"repository":{"type":"git","url":"https://github.com/frontend/base/eslint-config.git"},"keywords":["eslint","style"],"license":"MIT","engines":{"node":">= 6"},"devDependencies":{"@commitlint/cli":"^14.1.0","@commitlint/config-conventional":"^14.1.0","@types/react":"^17.0.8","@typescript-eslint/eslint-plugin":"^4.23.0","@typescript-eslint/parser":"^4.23.0","babel-eslint":"^10.1.0","commitizen":"^4.2.4","eslint":"^7.26.0","eslint-plugin-react":"^7.23.2","eslint-plugin-react-hooks":"^4.2.0","husky":"^7.0.4","lint-staged":"^11.0.0","prettier":"^2.3.0","react":"^17.0.2","standard-version":"^9.3.2","typescript":"^4.2.4"},"dependencies":{"eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0"},"peerDependencies":{"eslint":"^7.26.0","prettier":"^2.3.0"},"author":{"name":"guoyanhong","email":"guoyanhong@cnstrong.cn"},"gitHead":"520dc09ee590679d34355d43bfdbb4d2f86899e6","_id":"@coolh/eslint-config@1.0.0","_nodeVersion":"12.18.2","_npmVersion":"7.24.0","dist":{"integrity":"sha512-L6aPtp5oGWM+Wxx26XaEG127MdgNRVobdogDyPAECRgIwJ6oRRtPcQDqqM6il4BhuyCX3jJa+7DLS2SPFO3bbA==","shasum":"c69feafdaefa5cc54fff60f55abccec3c4ac3b1f","tarball":"https://registry.npmjs.org/@coolh/eslint-config/-/eslint-config-1.0.0.tgz","fileCount":14,"unpackedSize":26593,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhzd0KCRA9TVsSAnZWagAAUKcP/2bIGsH1LRwWa0N9twhp\nuVnB3vZQ2Xc96VpsZcur1a64xpGxXTsGNBiFygP3ECKiQ4H1jfCCTuanBI8K\n3Y6Qh8u/HESN3DDn53jWLG/N6e1mljTvD7HbSYJ6fDKTIWHP+NQciR3li8GL\nGyTR4IHZ7Q6fL/Nj0YphGnOFE52DhuKVkiwIBkV9JpvRAXE98JZd7vlQTzoW\nP8tMTGLzU/U+4W8ad6jSVA6ShDcsv3Qn8KE3raXOG1GsC48gCUTPuuZ7d9dV\nkL8/9EheFdI3w5yOOIwvVwNXhhJeA8ocSBkK6lrOzYonn1X/ZG8qQawdYhWn\nVLyYrcwVOJzAQK+xoh3fbKRF2UTOEu8PWo+rlMMVYuL74/Def0FVrx/GvMER\nYpYfOaohg5hh+swFMyj2JFS2Ot7SL3ZIaB6lQGYOWWRygvXzJfzidHQwR0Gf\nvvmaI3uHp7bA1YExFXMr7yVeTcf6ueqbOxpbPU8D/KSxiiRaTU7TqdoYQFbn\niUyhGHUC51CUOfoaxjcZg+5No+do0fHUUTy5MRtbu7swAWeiQOo1oN4rPm7N\n61RuvkqWTJ3xCj3T1WGzCYvItBPBqzQbo2uOJJKZvVicdm6uxqXEydU4XATN\nNbTRqfqsH6JdxrlrMN4XtP6vYWr85ScqDgFRJmnUh7hp+SluaXf9aBN1VIwK\nqGPB\r\n=UPfU\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIH0nBjqbvlXsTk4GVT5RlVLSFyxbCU+yctjlO6IxsqrPAiACB4NMZWunQLSrXmjHxWkqSsIiR1cmdKstzB6XRNOFUw=="}]},"_npmUser":{"name":"gyh","email":"1352118502@qq.com"},"directories":{},"maintainers":[{"name":"gyh","email":"1352118502@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eslint-config_1.0.0_1636095206329_0.4903606163354226"},"_hasShrinkwrap":false}},"time":{"created":"2021-11-05T06:53:26.281Z","1.0.0":"2021-11-05T06:53:26.528Z","modified":"2022-04-05T01:16:22.665Z"},"maintainers":[{"name":"gyh","email":"1352118502@qq.com"}],"description":"eslint配置规则","keywords":["eslint","style"],"repository":{"type":"git","url":"https://github.com/frontend/base/eslint-config.git"},"author":{"name":"guoyanhong","email":"guoyanhong@cnstrong.cn"},"license":"MIT","readme":"# eslint-config\n\neslint 配置规则\n\n## 使用方法\n\n### 快速使用（推荐）\n\n使用 npm:\n\n```shell\n  npm install --save-dev eslint prettier babel-eslint typescript @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-react eslint-plugin-react-hooks @coolh/eslint-config\n```\n\n使用 yarn:\n\n```shell\n  yarn add --dev eslint prettier babel-eslint typescript @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-react eslint-plugin-react-hooks @coolh/eslint-config\n```\n\n配置 `.eslintrc` :\n\n```json\n{\n  \"extends\": [\"@trip/eslint-config\"]\n}\n```\n\n该规则支持自动识别`.js`、`.jsx`、`.ts`、`.tsx`文件并启用对应的规则，大部分项目使用此种配置即可。\n\n### JavaScript\n\n若你希望开仅启针对 `.js` 文件的校验，使用方法如下\n使用 npm:\n\n```shell\n  npm install --save-dev eslint prettier babel-eslint @coolh/eslint-config\n```\n\n使用 yarn:\n\n```shell\n  yarn add --dev eslint prettier babel-eslint @coolh/eslint-config\n```\n\n配置 `.eslintrc` :\n\n```json\n{\n  \"extends\": [\"@eslint-config/javascript\"]\n}\n```\n\n### TypeScript\n\n若你希望仅开启针对 `.ts` 文件的校验，使用方法如下\n使用 npm:\n\n```shell\n  npm install --save-dev eslint prettier typescript @typescript-eslint/parser @typescript-eslint/eslint-plugin @coolh/eslint-config\n```\n\n使用 yarn:\n\n```shell\n  yarn add --dev eslint prettier typescript @typescript-eslint/parser @typescript-eslint/eslint-plugin @coolh/eslint-config\n```\n\n配置 `.eslintrc` :\n\n```json\n{\n  \"extends\": [\"@coolh/eslint-config/typescript\"]\n}\n```\n\n### React\n\n如果项目中使用到 `react`，那么可以按照如下方式启用 `react` 相关规则\n使用 npm:\n\n```shell\n  npm install --save-dev eslint prettier babel-eslint eslint-plugin-react eslint-plugin-react-hooks @coolh/eslint-config\n```\n\n使用 yarn:\n\n```shell\n  yarn add --dev eslint prettier babel-eslint eslint-plugin-react eslint-plugin-react-hooks @coolh/eslint-config\n```\n\n配置 `.eslintrc` :\n\n```json\n{\n  \"extends\": [\n    \"@coolh/eslint-config/javascript\", //或是 \"@coolh/eslint-config/typescript\"\n    \"@coolh/eslint-config/react\"\n  ]\n}\n```\n\n最后配置 `package.json` 的 scripts:\n\n```json\n{\n  \"scripts\": {\n    \"lint\": \"eslint *.js lib test xxx\",\n    \"lintfix\": \"eslint --fix *.js lib test xxx\"\n  }\n}\n```\n\n运行:\n\n```shell\n  npm run lint\n```\n\n## 扩展\n\n### 搭配 VSCode 使用\n\nvscode 扩展-搜索 eslint-安装并重启 vscode\n\n### 开启 ESLint 错误提示\n\n在 VSCode 中，ESLint 无法识别 `.ts` 或 `.tsx` 等文件，需要在设置的 json 文件添加以下配置：\n\n```json\n{\n  \"eslint.validate\": [\n    \"javascript\",\n    \"javascriptreact\",\n    \"typescript\",\n    \"typescriptreact\"\n  ]\n}\n```\n\n### 保存时自动修复`ESLint`错误(推荐)\n\n如果想要开启「保存时自动修复」的功能，额外配置以下条件：\n\n```json\n{\n  \"eslint.validate\": [\n    \"javascript\",\n    \"javascriptreact\",\n    \"typescript\",\n    \"typescriptreact\"\n  ],\n  \"editor.codeActionsOnSave\": {\n    \"source.fixAll.eslint\": true\n  }\n}\n```\n\n> 注意：如果已安装 Prettier 等插件并开启了自动格式化，请将其关闭，否则存在冲突的可能\n\n[文档链接](https://github.com/npm/coolh-eslint-config/-/blob/release/docs/README.md)\n","readmeFilename":"README.md"}