{"versions":{"1.0.6":{"name":"eslint-config-encode","version":"1.0.6","main":"index.js","description":"印客学院 JavaScript TypeScript Node 规范","keywords":["encode","javaScript","typescript","node","lint"],"scripts":{"lint":"eslint ./","test":"mocha ./__tests__/*.test.js --timeout 5000","print-config":"eslint --print-config ./index.js > ./print-config.json"},"author":{"name":"chenghuai"},"homepage":"https://github.com/encode-studio-fe/fe-spec#readme","license":"ISC","repository":{"type":"git","url":"git+https://github.com/encode-studio-fe/fe-spec.git"},"bugs":{"url":"https://github.com/encode-studio-fe/fe-spec/issues"},"devDependencies":{"@babel/core":"^7.16.0","@babel/eslint-parser":"^7.16.3","@babel/preset-react":"^7.16.0","@typescript-eslint/eslint-plugin":"^5.0.0","@typescript-eslint/parser":"^5.0.0","eslint":"^8.7.0","eslint-config-egg":"^10.0.0","eslint-import-resolver-typescript":"^2.5.0","eslint-plugin-import":"^2.25.3","eslint-plugin-jsx-a11y":"^6.3.1","eslint-plugin-jsx-plus":"^0.1.0","eslint-plugin-react":"^7.17.0","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-vue":"^7.3.0","lodash":"^4.17.21","mocha":"^8.2.1","typescript":"^4.1.2","vue-eslint-parser":"^7.3.0"},"gitHead":"cc1d3302696f9e22182df35ba96dba581a072eae","_id":"eslint-config-encode@1.0.6","_nodeVersion":"16.18.0","_npmVersion":"lerna/6.6.2/node@v16.18.0+x64 (win32)","dist":{"integrity":"sha512-LKYTzARihHOVwcsf5JpD8d13Rqq7GV2WbDqH8/l5s/+UPGYa7dypy7/Al0V3uacztOq6aH4r/Cdj1OUzKP1h9Q==","shasum":"4e58c2974f18b821ef6de3cf7d11cc36ef719ec0","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/eslint-config-encode/-/eslint-config-encode-1.0.6.tgz","fileCount":57,"unpackedSize":138088,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAc2UtT0g2BclF7p8Cir2ojgYeeLrpYcDG/QsrgO7l/hAiAjxBXirzltZ/Mfdj+rzfFW8tGl+cjE8DiBs2X0jANQTA=="}],"size":32916},"_npmUser":{"name":"anonymous","email":"encode_studio@163.com"},"directories":{},"maintainers":[{"name":"anonymous","email":"encode_studio@163.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eslint-config-encode_1.0.6_1698068842612_0.3063933320183079"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-10-23T13:47:22.822Z","publish_time":1698068842822,"_source_registry_name":"default","contributors":[]},"1.0.8":{"name":"eslint-config-encode","version":"1.0.8","main":"index.js","description":"印客学院 JavaScript TypeScript Node 规范","keywords":["encode","javaScript","typescript","node","lint"],"scripts":{"lint":"eslint ./","test":"mocha ./__tests__/*.test.js --timeout 5000","print-config":"eslint --print-config ./index.js > ./print-config.json"},"author":{"name":"chenghuai"},"homepage":"https://github.com/encode-studio-fe/fe-spec#readme","license":"ISC","repository":{"type":"git","url":"git+https://github.com/encode-studio-fe/fe-spec.git"},"bugs":{"url":"https://github.com/encode-studio-fe/fe-spec/issues"},"devDependencies":{"@babel/core":"^7.16.0","@babel/eslint-parser":"^7.16.3","@babel/preset-react":"^7.16.0","@typescript-eslint/eslint-plugin":"^5.0.0","@typescript-eslint/parser":"^5.0.0","eslint":"^8.7.0","eslint-config-egg":"^10.0.0","eslint-import-resolver-typescript":"^2.5.0","eslint-plugin-import":"^2.25.3","eslint-plugin-jsx-a11y":"^6.3.1","eslint-plugin-jsx-plus":"^0.1.0","eslint-plugin-react":"^7.17.0","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-vue":"^7.3.0","lodash":"^4.17.21","mocha":"^8.2.1","typescript":"^4.1.2","vue-eslint-parser":"^7.3.0"},"gitHead":"f62d3614141362dd5606bd6d32d9b013b5ebf431","_id":"eslint-config-encode@1.0.8","_nodeVersion":"16.18.0","_npmVersion":"lerna/6.6.2/node@v16.18.0+x64 (win32)","dist":{"integrity":"sha512-2bl1ljL1azeq4MQPKHD8m/oo8Ly2oLr+g8i7F0le9f661JxQIblbw8pCNDacYvDVZ3/2K1OQPik/oiGvJ/0zPw==","shasum":"74dc52856485bed262741622f0dc3c2e8d7b97bb","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/eslint-config-encode/-/eslint-config-encode-1.0.8.tgz","fileCount":57,"unpackedSize":138088,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCiKXA+9ooOMVYBTUUSZ4INyG8nsAu9Aj56EFdTpjgIggIhAJsoBx+Sc2JWuZys7iQaAtzmf7gwfis3CChiDBLP0C46"}],"size":32916},"_npmUser":{"name":"anonymous","email":"encode_studio@163.com"},"directories":{},"maintainers":[{"name":"anonymous","email":"encode_studio@163.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eslint-config-encode_1.0.8_1698247382713_0.4970839554941564"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-10-25T15:23:02.925Z","publish_time":1698247382925,"_source_registry_name":"default","contributors":[]}},"dist-tags":{"latest":"1.0.8"},"name":"eslint-config-encode","time":{"created":"2023-10-23T13:52:59.265Z","modified":"2023-10-25T16:16:04.062Z","1.0.6":"2023-10-23T13:47:22.822Z","1.0.8":"2023-10-25T15:23:02.925Z"},"readme":"# eslint-config-encode\r\n\r\n> 印客学院 JavaScript TypeScript Node 规范\r\n\r\n提供了多套配置文件以支持 `JavaScript`、`TypeScript`、`React`、`Vue`、`Node.js` 等多种项目类型。\r\n\r\n## JavaScript 项目 - eslint-config-encode\r\n\r\n针对未使用 `React` 或 `Vue` 的原生 `JavaScript` 项目，使用 `ESLint` 原生规则和 [eslint-plugin-import](https://www.npmjs.com/package/eslint-plugin-import) 规则，使用 [@babel/eslint-parser](https://www.npmjs.com/package/@babel/eslint-parser) 作为 `parser`，是本包的默认配置。\r\n\r\n### 依赖\r\n\r\n- [@babel/core](https://www.npmjs.com/package/@babel/core)@^7.16.0\r\n- [@babel/eslint-parser](https://www.npmjs.com/package/@babel/eslint-parser)@^7.16.3\r\n- [eslint-plugin-import](https://www.npmjs.com/package/eslint-plugin-import)@^2.25.3\r\n\r\n### 安装\r\n\r\n```shell\r\nnpm i -D eslint-config-encode @babel/core @babel/eslint-parser eslint-plugin-import\r\n```\r\n\r\n### 配置\r\n\r\n```json\r\n{\r\n  \"extends\": [\"eslint-config-encode\"]\r\n}\r\n```\r\n\r\n## JavaScript + React 项目 - eslint-config-encode/react\r\n\r\n针对 JS React 项目，继承了默认配置，并启用了 [eslint-plugin-react](https://www.npmjs.com/package/eslint-plugin-react) 和 [eslint-plugin-react-hooks](https://www.npmjs.com/package/eslint-plugin-react-hooks) 的规则。\r\n\r\n### 依赖\r\n\r\n- [@babel/core](https://www.npmjs.com/package/@babel/core)@^7.16.0\r\n- [@babel/eslint-parser](https://www.npmjs.com/package/@babel/eslint-parser)@^7.16.3\r\n- [eslint-plugin-import](https://www.npmjs.com/package/eslint-plugin-import)@^2.25.3\r\n- [eslint-plugin-react](https://www.npmjs.com/package/eslint-plugin-react)@^7.17.0\r\n- [eslint-plugin-react-hooks](https://www.npmjs.com/package/)@^4.2.0\r\n- [eslint-plugin-jsx-a11y](https://www.npmjs.com/package/eslint-plugin-jsx-a11y)@^6.3.1（可选）\r\n\r\n### 安装\r\n\r\n```shell\r\nnpm i -D eslint-config-encode @babel/core @babel/eslint-parser eslint-plugin-import eslint-plugin-react eslint-plugin-react-hooks\r\n```\r\n\r\n### 配置\r\n\r\n```json\r\n{\r\n  \"extends\": [\"eslint-config-encode/react\"]\r\n}\r\n```\r\n\r\n如果需要无障碍能力：\r\n\r\n```shell\r\nnpm i -D eslint-plugin-jsx-a11y\r\n```\r\n\r\n```json\r\n{\r\n  \"extends\": [\"eslint-config-encode/react\", \"eslint-config-encode/jsx-a11y\"]\r\n}\r\n```\r\n\r\n## JavaScript + Vue 项目 - eslint-config-encode/vue\r\n\r\n针对 `JS Vue` 的项目，继承了默认配置，并启用了 [eslint-plugin-vue](https://www.npmjs.com/package/eslint-plugin-vue) 插件的规则，使用 [vue-eslint-parser](https://www.npmjs.com/package/vue-eslint-parser) 作为 parser。\r\n\r\n### 依赖\r\n\r\n- [@babel/core](https://www.npmjs.com/package/@babel/core)@^7.16.0\r\n- [@babel/eslint-parser](https://www.npmjs.com/package/@babel/eslint-parser)@^7.16.3\r\n- [eslint-plugin-import](https://www.npmjs.com/package/eslint-plugin-import)@^2.25.3\r\n- [vue-eslint-parser](https://www.npmjs.com/package/vue-eslint-parser)@^7.0.0\r\n- [eslint-plugin-vue](https://www.npmjs.com/package/eslint-plugin-vue)@^7.3.0\r\n\r\n### 安装\r\n\r\n```shell\r\nnpm i -D eslint-config-encode @babel/core @babel/eslint-parser eslint-plugin-import vue-eslint-parser eslint-plugin-vue\r\n```\r\n\r\n### 配置\r\n\r\n```json\r\n{\r\n  \"extends\": [\"eslint-config-encode/vue\"]\r\n}\r\n```\r\n\r\n## JavaScript (Node.js) 项目 - eslint-config-encode/node\r\n\r\n针对 Node.js 项目，继承了默认配置和 [eslint-config-egg 的规则](https://github.com/eggjs/eslint-config-egg/blob/master/lib/rules/node.js)，规则由 ESLint 原生规则和 [eslint-plugin-node](https://github.com/mysticatea/eslint-plugin-node) 提供。\r\n\r\n### 依赖\r\n\r\n- [@babel/core](https://www.npmjs.com/package/@babel/core)@^7.16.0\r\n- [@babel/eslint-parser](https://www.npmjs.com/package/@babel/eslint-parser)@^7.16.3\r\n- [eslint-plugin-import](https://www.npmjs.com/package/eslint-plugin-import)@^2.25.3\r\n- [eslint-config-egg](https://www.npmjs.com/package/eslint-config-egg)@^10.0.0\r\n\r\n### 安装\r\n\r\n```shell\r\nnpm i -D eslint-config-encode @babel/core @babel/eslint-parser eslint-plugin-import eslint-config-egg\r\n```\r\n\r\n### 配置\r\n\r\n```json\r\n{\r\n  \"extends\": [\"eslint-config-encode/node\"]\r\n}\r\n```\r\n\r\n## TypeScript 项目 - eslint-config-encode/typescript\r\n\r\n针对未使用 `React` 或 `Vue` 的 `TypeScript` 项目，继承了默认配置，并启用了 [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin) 插件的规则，使用 [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser) 作为 parser。\r\n\r\n### 依赖\r\n\r\n- [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser)@^5.0.0\r\n- [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin)@^5.0.0\r\n- [eslint-plugin-import](https://www.npmjs.com/package/eslint-plugin-import)@^2.25.3\r\n- [eslint-import-resolver-typescript](https://www.npmjs.com/package/eslint-import-resolver-typescript)@2\r\n\r\n### 安装\r\n\r\n```shell\r\nnpm i -D eslint-config-encode @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-import eslint-import-resolver-typescript\r\n```\r\n\r\n### 配置\r\n\r\n```json\r\n{\r\n  \"extends\": [\"eslint-config-encode/typescript\"]\r\n}\r\n```\r\n\r\n需保证项目已安装 `typescript` 依赖，另外如果项目的 `TS` 配置文件不是 `./tsconfig.json`，则需要设置 `.eslintrc` 中的 [parserOptions.project](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser#parseroptionsproject) 字段 ，例如：\r\n\r\n```json\r\n{\r\n  \"extends\": \"eslint-config-encode/typescript\",\r\n  \"parserOptions\": {\r\n    \"project\": \"./tsconfig.eslint.json\"\r\n  }\r\n}\r\n```\r\n\r\n## TypeScript + React 项目 - eslint-config-encode/typescript/react\r\n\r\n针对 `TS React` 项目，继承了 `JS React` 的配置，并启用了 [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin) 插件的规则，使用 [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser) 作为 parser。\r\n\r\n### 依赖\r\n\r\n- [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser)@^5.0.0\r\n- [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin)@^5.0.0\r\n- [eslint-plugin-import](https://www.npmjs.com/package/eslint-plugin-import)@^2.25.3\r\n- [eslint-import-resolver-typescript](https://www.npmjs.com/package/eslint-import-resolver-typescript)@2\r\n- [eslint-plugin-react](https://www.npmjs.com/package/eslint-plugin-react)@^7.17.0\r\n- [eslint-plugin-react-hooks](https://www.npmjs.com/package/eslint-plugin-react-hooks)@^4.2.0\r\n- [eslint-plugin-jsx-a11y](https://www.npmjs.com/package/eslint-plugin-jsx-a11y)@^6.3.1（可选）\r\n\r\n### 安装\r\n\r\n```\r\nnpm i -D eslint-config-encode @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-import eslint-import-resolver-typescript eslint-plugin-react eslint-plugin-react-hooks\r\n```\r\n\r\n### 配置\r\n\r\n```json\r\n{\r\n  \"extends\": [\"eslint-config-encode/typescript/react\"]\r\n}\r\n```\r\n\r\n如果需要无障碍能力：\r\n\r\n```shell\r\nnpm i -D  eslint-plugin-jsx-a11y\r\n```\r\n\r\n```json\r\n{\r\n  \"extends\": [\"eslint-config-encode/typescript/react\", \"eslint-config-encode/jsx-a11y\"]\r\n}\r\n```\r\n\r\n## TypeScript + Vue 项目 - eslint-config-encode/typescript/vue\r\n\r\n针对 `TS Vue` 项目，继承了 `JS Vue` 的配置，并启用了 [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin) 插件的规则，使用 [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser) 作为 `parser`。\r\n\r\n### 依赖\r\n\r\n- [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser)@^5.0.0\r\n- [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin)@^5.0.0\r\n- [eslint-plugin-import](https://www.npmjs.com/package/eslint-plugin-import)@^2.25.3\r\n- [eslint-import-resolver-typescript](https://www.npmjs.com/package/eslint-import-resolver-typescript)@2\r\n- [vue-eslint-parser](https://www.npmjs.com/package/vue-eslint-parser)@^7.0.0\r\n- [eslint-plugin-vue](https://www.npmjs.com/package/eslint-plugin-vue)@^7.3.0\r\n\r\n### 安装\r\n\r\n```shell\r\nnpm i -D eslint-config-encode @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-import eslint-import-resolver-typescript vue-eslint-parser eslint-plugin-vue\r\n```\r\n\r\n### 配置\r\n\r\n```json\r\n{\r\n  \"extends\": [\"eslint-config-encode/typescript/vue\"]\r\n}\r\n```\r\n\r\n## TypeScript (Node.js) 项目 - eslint-config-encode/typescript/node\r\n\r\n针对未使用 `React` 和 `Vue` 的 `TypeScript(Node)` 项目，继承了 `JS Node.js` 配置，并启用了 [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin) 插件的规则，使用 [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser) 作为 parser。\r\n\r\n### 依赖\r\n\r\n- [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser)@^5.0.0\r\n- [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin)@^5.0.0\r\n- [eslint-plugin-import](https://www.npmjs.com/package/eslint-plugin-import)@^2.25.3\r\n- [eslint-import-resolver-typescript](https://www.npmjs.com/package/eslint-import-resolver-typescript)@2\r\n- [eslint-config-egg](https://www.npmjs.com/package/eslint-config-egg)@^10.0.0\r\n\r\n### 安装\r\n\r\n```\r\nnpm i -D eslint-config-encode @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-import eslint-import-resolver-typescript eslint-config-egg\r\n```\r\n\r\n### 配置\r\n\r\n```json\r\n{\r\n  \"extends\": [\"eslint-config-encode/typescript/node\"]\r\n}\r\n```\r\n\r\n## 配合 Prettier 使用\r\n\r\n如果你的项目使用 [Prettier](https://prettier.io/) 进行代码格式化，本包的一些规则可能会跟 Prettier 格式化结果有冲突，[例如这条规则](https://github.com/typescript-eslint/typescript-eslint/issues/372)。为了避免冲突，你需要手动安装 [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) 和 [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier)：\r\n\r\n### 安装\r\n\r\n```sh\r\nnpm install --save-dev eslint-config-prettier eslint-plugin-prettier\r\n```\r\n\r\n### 配置\r\n\r\n并修改 `.eslintrc` 的 `extends` 配置，增加 `prettier`，如下（以 TS React 项目为例）：\r\n\r\n```json\r\n{\r\n  \"extends\": [\"eslint-config-encode/typescript/react\", \"prettier\"]\r\n}\r\n```\r\n\r\n了解更多请阅读 [Prettier - Integrating with Linters](https://prettier.io/docs/en/integrating-with-linters.html)。\r\n\r\n## 将风格问题降级\r\n\r\n为了保证一致的编码风格，本包中大量风格相关的规则被设为了 `error` 级别，以引起开发者的足够重视。如果你觉得风格问题不足以是 `error` 级别（有些用户根据 ESLint error 进行流程卡点），本包还提供了一套名为 'essential' 的配置文件，这套配置将所有风格问题降级为 `warn` 级别，仅将必要问题报告为 `error`，引用方式为在相应配置的 `eslint-config-encode` 后面加上 `/essential`，如对 `JS React` 项目为 `eslint-config-encode/essential/react`、对 `TS Vue` 项目为 `eslint-config-encode/essential/typescript/vue`\r\n\r\n## 了解更多\r\n\r\n- 如果你对 ESLint 还不熟悉，可以阅读官网的 [Getting Started](https://eslint.org/docs/user-guide/getting-started) 快速入门。\r\n- 了解如何为 IDE 配置 ESLint，可以参考官网的 [Integrations](http://eslint.org/docs/user-guide/integrations)。\r\n- 了解如何在继承本包的基础上对项目 ESLint 进行个性化配置，可参考官网的 [Configuring ESLint](https://eslint.org/docs/user-guide/configuring)。下面简介下 ESLint 配置中的几个常用字段：\r\n  - `extends`: 继承一组规则集。`\"extends\": \"eslint-config-encode\",` 表示继承本包定义的规则配置。\r\n  - `rules`: 配置规则，这里定义的规则会覆盖 `extends` 的规则。如果觉得本包开启的某条规则过于严格，你可以暂时在这里将其关闭。\r\n  - `parser`: 设置 ESLint 的解析器。ESLint 使用 espree 作为默认的解析器，可以通过这个参数指定其他的解析器。比如指定为 [@babel/eslint-parser](https://npmjs.com/package/@babel/eslint-parser)，以解析 Babel 支持但 ESLint 默认解析器不支持的语法（本包不同配置文件使用的解析器可在简介表格中的「依赖 parser」一列查看）。\r\n  - `globals`: 指定代码中可能用到的全局变量，以免全局变量被 [no-undef](http://eslint.org/docs/rules/no-undef) 规则报错。\r\n  - `env`: 指定代码的运行环境，每个环境预定义了一组对应的全局变量，本包已开启的环境有 browser、node、jquery、es6 及几个测试框架的环境。\r\n- 了解常用的 ESLint 命令，如 `--fix`、`--ext`，可参考官网的 [Command Line Interface](http://eslint.org/docs/user-guide/command-line-interface)。","users":{}}