diff --git a/packages/eslint-config-ali/CHANGELOG.md b/packages/eslint-config-ali/CHANGELOG.md index 18e4c75..5171f67 100644 --- a/packages/eslint-config-ali/CHANGELOG.md +++ b/packages/eslint-config-ali/CHANGELOG.md @@ -1,5 +1,10 @@ # 更新日志 +## 15.0.0 - 2024-02-06 + +- **BREAKING CHANGE** `node` 和 `typescript/node` 不再提供 egg 相关的配置,请使用 `egg` 和 `typescript/egg` 替代 +- **BREAKING CHANGE** 升级 `vue-eslint-parser` 7.x 到 9.x + ## 14.2.1 (2023-12-18) - 修复 TypeScript 中 `no-undef` 误报的问题 diff --git a/packages/eslint-config-ali/README.md b/packages/eslint-config-ali/README.md index 864c698..8d6bfb8 100644 --- a/packages/eslint-config-ali/README.md +++ b/packages/eslint-config-ali/README.md @@ -2,27 +2,25 @@ 本包是[《阿里巴巴前端规约》](https://github.com/alibaba/f2e-spec)配套的 [ESLint 可共享配置](http://eslint.org/docs/developer-guide/shareable-configs.html),提供了多套配置文件以支持 JavaScript、TypeScript、React、Vue、Node.js 等多种项目类型。 -## 使用 +## f2elint 接入(推荐) -推荐使用《阿里巴巴前端规约》配套的 CLI 工具 [f2elint](https://www.npmjs.com/package/f2elint) 接入本包。如果想自己手动接入,可以在下方查找自己项目类型所需安装的依赖和 [ESLint 配置](https://eslint.org/docs/user-guide/configuring): - -### JavaScript 项目 - eslint-config-ali +```bash +npx f2elint +``` -针对未使用 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,是本包的默认配置。 +## 手动接入 -#### 依赖 +```bash +npm install --save-dev eslint eslint-config-ali +``` -- [@babel/core](https://www.npmjs.com/package/@babel/core)@^7.16.0 -- [@babel/eslint-parser](https://www.npmjs.com/package/@babel/eslint-parser)@^7.16.3 -- [eslint-plugin-import](https://www.npmjs.com/package/eslint-plugin-import)@^2.19.1 +## 项目配置 -#### 安装 +### 基础 JavaScript 项目 -``` -npm i -D eslint-config-ali @babel/core @babel/eslint-parser eslint-plugin-import -``` +针对未使用 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,是本包的默认配置。 -#### 配置 +ESLint 配置: ```json { @@ -30,26 +28,25 @@ npm i -D eslint-config-ali @babel/core @babel/eslint-parser eslint-plugin-import } ``` -### JavaScript + React 项目 - eslint-config-ali/react +### 基础 TypeScript 项目 -针对 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) 的规则。 +针对未使用 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。 -#### 依赖 +ESLint 配置: -- [@babel/core](https://www.npmjs.com/package/@babel/core)@^7.16.0 -- [@babel/eslint-parser](https://www.npmjs.com/package/@babel/eslint-parser)@^7.16.3 -- [eslint-plugin-import](https://www.npmjs.com/package/eslint-plugin-import)@^2.19.1 -- [eslint-plugin-react](https://www.npmjs.com/package/eslint-plugin-react)@^7.17.0 -- [eslint-plugin-react-hooks](https://www.npmjs.com/package/eslint-plugin-react-hooks)@^4.0.4 -- [eslint-plugin-jsx-a11y](https://www.npmjs.com/package/eslint-plugin-jsx-a11y)@^6.3.1(可选) +```json +{ + "extends": ["eslint-config-ali/typescript"] +} +``` -#### 安装 +注意:需要保证项目安装了 `typescript@5` 依赖,同时根目录下有 `tsconfig.json` 文件。 -``` -npm i -D eslint-config-ali @babel/core @babel/eslint-parser eslint-plugin-import eslint-plugin-react eslint-plugin-react-hooks -``` +### React JavaScript 项目 + +针对 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) 的规则。 -#### 配置 +ESLint 配置: ```json { @@ -59,251 +56,104 @@ npm i -D eslint-config-ali @babel/core @babel/eslint-parser eslint-plugin-import 如果需要无障碍能力: -``` -npm i -D eslint-plugin-jsx-a11y -``` - ```json { "extends": ["eslint-config-ali/react", "eslint-config-ali/jsx-a11y"] } ``` -### JavaScript + Rax 项目 - eslint-config-ali/rax - -针对 JS [Rax](https://rax.js.org/) 项目,Rax 和 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) 的规则,并通过 [eslint-plugin-jsx-plus](https://www.npmjs.com/package/eslint-plugin-jsx-plus) 校验 JSX+ 语法。 - -#### 依赖 +### TypeScript + React 项目 -- [@babel/core](https://www.npmjs.com/package/@babel/core)@^7.16.0 -- [@babel/eslint-parser](https://www.npmjs.com/package/@babel/eslint-parser)@^7.16.3 -- [eslint-plugin-import](https://www.npmjs.com/package/eslint-plugin-import)@^2.19.1 -- [eslint-plugin-react](https://www.npmjs.com/package/eslint-plugin-react)@^7.17.0 -- [eslint-plugin-react-hooks](https://www.npmjs.com/package/eslint-plugin-react-hooks)@^4.0.4 -- [eslint-plugin-jsx-plus](https://www.npmjs.com/package/eslint-plugin-jsx-plus)@^0.1.0 - -#### 安装 - -``` -npm i -D eslint-config-ali @babel/core @babel/eslint-parser eslint-plugin-import eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-jsx-plus -``` +针对 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。 -#### 配置 +ESLint 配置: ```json { - "extends": ["eslint-config-ali/rax"] + "extends": ["eslint-config-ali/typescript/react"] } ``` -### JavaScript + Vue 项目 - eslint-config-ali/vue - -针对 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。 - -#### 依赖 - -- [@babel/core](https://www.npmjs.com/package/@babel/core)@^7.16.0 -- [@babel/eslint-parser](https://www.npmjs.com/package/@babel/eslint-parser)@^7.16.3 -- [eslint-plugin-import](https://www.npmjs.com/package/eslint-plugin-import)@^2.19.1 -- [vue-eslint-parser](https://www.npmjs.com/package/vue-eslint-parser)@^7.0.0 -- [eslint-plugin-vue](https://www.npmjs.com/package/eslint-plugin-vue)@^7.3.0 - -#### 安装 - -``` -npm i -D eslint-config-ali @babel/core @babel/eslint-parser eslint-plugin-import vue-eslint-parser eslint-plugin-vue -``` - -#### 配置 +如果需要无障碍能力: ```json { - "extends": ["eslint-config-ali/vue"] + "extends": [ + "eslint-config-ali/typescript/react", + "eslint-config-ali/jsx-a11y" + ] } ``` -### JavaScript (Node.js) + Egg 项目 - eslint-config-ali/node - -针对 Node.js 项目,继承了默认配置和 [egg-config-egg 的 node 规则](https://github.com/eggjs/eslint-config-egg/blob/master/lib/rules/node.js),规则由 ESLint 原生规则和 [eslint-plugin-node](https://github.com/mysticatea/eslint-plugin-node) 提供。 +### Vue JavaScript 项目 -#### 依赖 - -- [@babel/core](https://www.npmjs.com/package/@babel/core)@^7.16.0 -- [@babel/eslint-parser](https://www.npmjs.com/package/@babel/eslint-parser)@^7.16.3 -- [eslint-plugin-import](https://www.npmjs.com/package/eslint-plugin-import)@^2.19.1 -- [eslint-config-egg](https://www.npmjs.com/package/eslint-config-egg)@^10.0.0 - -#### 安装 - -``` -npm i -D eslint-config-ali @babel/core @babel/eslint-parser eslint-plugin-import eslint-config-egg -``` +针对 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。 -#### 配置 +ESLint 配置: ```json { - "extends": ["eslint-config-ali/node"] + "extends": ["eslint-config-ali/vue"] } ``` -### TypeScript 项目 - eslint-config-ali/typescript - -针对未使用 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。 - -#### 依赖 +### Vue TypeScript -- [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser)@^5.0.0 -- [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin)@^5.0.0 -- [eslint-plugin-import](https://www.npmjs.com/package/eslint-plugin-import)@^2.19.1 -- [eslint-import-resolver-typescript](https://www.npmjs.com/package/eslint-import-resolver-typescript)@2 - -#### 安装 - -``` -npm i -D eslint-config-ali @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-import eslint-import-resolver-typescript -``` - -#### 配置 - -```json -{ - "extends": ["eslint-config-ali/typescript"] -} -``` +针对 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。 -需保证项目已安装 `typescript` 依赖,另外如果项目的 TS 配置文件不是 `./tsconfig.json`,则需要设置 `.eslintrc` 中的 [parserOptions.project](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser#parseroptionsproject) 字段 ,例如: +ESLint 配置: ```json { - "extends": "eslint-config-ali/typescript", - "parserOptions": { - "project": "./tsconfig.eslint.json" - } + "extends": ["eslint-config-ali/typescript/vue"] } ``` -### TypeScript + React 项目 - eslint-config-ali/typescript/react - -针对 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。 +### Node.js JavaScript 项目 -#### 依赖 +针对 Node.js 项目,规则由 ESLint 原生规则和 [eslint-plugin-node](https://github.com/mysticatea/eslint-plugin-node) 提供。 -- [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser)@^5.0.0 -- [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin)@^5.0.0 -- [eslint-plugin-import](https://www.npmjs.com/package/eslint-plugin-import)@^2.19.1 -- [eslint-import-resolver-typescript](https://www.npmjs.com/package/eslint-import-resolver-typescript)@2 -- [eslint-plugin-react](https://www.npmjs.com/package/eslint-plugin-react)@^7.17.0 -- [eslint-plugin-react-hooks](https://www.npmjs.com/package/eslint-plugin-react-hooks)@^4.0.4 -- [eslint-plugin-jsx-a11y](https://www.npmjs.com/package/eslint-plugin-jsx-a11y)@^6.3.1(可选) - -#### 安装 - -``` -npm i -D eslint-config-ali @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-import eslint-import-resolver-typescript eslint-plugin-react eslint-plugin-react-hooks -``` - -#### 配置 - -```json -{ - "extends": ["eslint-config-ali/typescript/react"] -} -``` - -如果需要无障碍能力: - -``` -npm i -D eslint-plugin-jsx-a11y -``` +ESLint 配置: ```json { - "extends": [ - "eslint-config-ali/typescript/react", - "eslint-config-ali/jsx-a11y" - ] + "extends": ["eslint-config-ali/node"] } ``` -### TypeScript + Rax 项目 - eslint-config-ali/typescript/rax - -针对 TS [Rax](https://rax.js.org/) 项目,继承了 JS Rax 的配置,并启用了 [@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。 - -#### 依赖 - -- [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser)@^5.0.0 -- [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin)@^5.0.0 -- [eslint-plugin-import](https://www.npmjs.com/package/eslint-plugin-import)@^2.19.1 -- [eslint-import-resolver-typescript](https://www.npmjs.com/package/eslint-import-resolver-typescript)@2 -- [eslint-plugin-react](https://www.npmjs.com/package/eslint-plugin-react)@^7.17.0 -- [eslint-plugin-react-hooks](https://www.npmjs.com/package/eslint-plugin-react-hooks)@^4.0.4 -- [eslint-plugin-jsx-plus](https://www.npmjs.com/package/eslint-plugin-jsx-plus)@^0.1.0 - -#### 安装 +### Node.js TypeScript 项目 -``` -npm i -D eslint-config-ali @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-import eslint-import-resolver-typescript eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-jsx-plus -``` +针对未使用 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。 -#### 配置 +ESLint 配置: ```json { - "extends": ["eslint-config-ali/typescript/rax"] + "extends": ["eslint-config-ali/typescript/node"] } ``` -### TypeScript + Vue 项目 - eslint-config-ali/typescript/vue - -针对 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。 - -#### 依赖 +### Egg.js JavaScript 项目 -- [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser)@^5.0.0 -- [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin)@^5.0.0 -- [eslint-plugin-import](https://www.npmjs.com/package/eslint-plugin-import)@^2.19.1 -- [eslint-import-resolver-typescript](https://www.npmjs.com/package/eslint-import-resolver-typescript)@2 -- [vue-eslint-parser](https://www.npmjs.com/package/vue-eslint-parser)@^7.0.0 -- [eslint-plugin-vue](https://www.npmjs.com/package/eslint-plugin-vue)@^7.3.0 +针对 Egg.js 项目,继承了 Node.js 配置和 [egg-config-egg 的 node 规则](https://github.com/eggjs/eslint-config-egg/blob/master/lib/rules/node.js)。 -#### 安装 - -``` -npm i -D eslint-config-ali @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-import eslint-import-resolver-typescript vue-eslint-parser eslint-plugin-vue -``` - -#### 配置 +ESLint 配置: ```json { - "extends": ["eslint-config-ali/typescript/vue"] + "extends": ["eslint-config-ali/egg"] } ``` -### TypeScript (Node.js) + Egg 项目 - eslint-config-ali/typescript/node +### Egg.js TypeScript 项目 针对未使用 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。 -#### 依赖 - -- [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser)@^5.0.0 -- [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin)@^5.0.0 -- [eslint-plugin-import](https://www.npmjs.com/package/eslint-plugin-import)@^2.19.1 -- [eslint-import-resolver-typescript](https://www.npmjs.com/package/eslint-import-resolver-typescript)@2 -- [eslint-config-egg](https://www.npmjs.com/package/eslint-config-egg)@^10.0.0 - -#### 安装 - -``` -npm i -D eslint-config-ali @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-import eslint-import-resolver-typescript eslint-config-egg -``` - -#### 配置 +ESLint 配置: ```json { - "extends": ["eslint-config-ali/typescript/node"] + "extends": ["eslint-config-ali/typescript/egg"] } ``` @@ -311,24 +161,20 @@ npm i -D eslint-config-ali @typescript-eslint/parser @typescript-eslint/eslint-p 如果你的项目使用 [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): -#### 安装 +安装依赖: ```sh npm install --save-dev eslint-config-prettier eslint-plugin-prettier ``` -#### 配置 - -并修改 `.eslintrc` 的 `extends` 配置,增加 `prettier`,如下(以 TS React 项目为例): +ESLint 配置: ```json { - "extends": ["eslint-config-ali/typescript/react", "prettier"] + "extends": ["eslint-config-ali/typescript/react", "plugin:prettier/recommended"] } ``` -了解更多请阅读 [Prettier - Integrating with Linters](https://prettier.io/docs/en/integrating-with-linters.html)。 - ## 将风格问题降级 为了保证一致的编码风格,本包中大量风格相关的规则被设为了 error 级别,以引起开发者的足够重视。如果你觉得风格问题不足以是 error 级别(有些用户根据 ESLint error 进行流程卡点),本包还提供了一套名为 'essential' 的配置文件,这套配置将所有风格问题降级为 warn 级别,仅将必要问题报告为 error,引用方式为在相应配置的 `eslint-config-ali` 后面加上 `/essential`,如对 JS React 项目为 `eslint-config-ali/essential/react`、对 TS Vue 项目为 `eslint-config-ali/essential/typescript/vue` diff --git a/packages/eslint-config-ali/egg.js b/packages/eslint-config-ali/egg.js new file mode 100644 index 0000000..3b5512a --- /dev/null +++ b/packages/eslint-config-ali/egg.js @@ -0,0 +1,6 @@ +module.exports = { + extends: [ + './node', + './rules/egg', + ].map(require.resolve), +}; diff --git a/packages/eslint-config-ali/package.json b/packages/eslint-config-ali/package.json index 43c71f4..4dc2b33 100644 --- a/packages/eslint-config-ali/package.json +++ b/packages/eslint-config-ali/package.json @@ -46,25 +46,24 @@ "eslint": ">=6.8.0" }, "dependencies": { - "@babel/core": "^7.23.6", - "@babel/eslint-parser": "^7.23.3", + "@babel/core": "^7.23.9", + "@babel/eslint-parser": "^7.23.10", "@babel/preset-react": "^7.23.3", - "@typescript-eslint/eslint-plugin": "^6.14.0", - "@typescript-eslint/parser": "^6.14.0", + "@typescript-eslint/eslint-plugin": "^6.21.0", + "@typescript-eslint/parser": "^6.21.0", + "eslint-config-egg": "^13.1.0", "eslint-import-resolver-typescript": "^3.6.1", "eslint-plugin-import": "^2.29.1", + "eslint-plugin-jsx-a11y": "^6.8.0", "eslint-plugin-react": "^7.33.2", "eslint-plugin-react-hooks": "^4.6.0", - "eslint-config-egg": "^13.0.0" + "vue-eslint-parser": "^9.4.2" }, "devDependencies": { - "@types/node": "^14.14.11", - "eslint": "^8.7.0", - "eslint-plugin-jsx-a11y": "^6.3.1", - "eslint-plugin-jsx-plus": "^0.1.0", - "eslint-plugin-vue": "^7.3.0", - "mocha": "^8.2.1", - "typescript": "^4.1.2", - "vue-eslint-parser": "^7.3.0" + "@types/node": "^20.0.0", + "eslint": "^8.56.0", + "eslint-plugin-vue": "^7.20.0", + "mocha": "^8.4.0", + "typescript": "^4.9.5" } -} \ No newline at end of file +} diff --git a/packages/eslint-config-ali/rules/egg.js b/packages/eslint-config-ali/rules/egg.js new file mode 100644 index 0000000..353e7ad --- /dev/null +++ b/packages/eslint-config-ali/rules/egg.js @@ -0,0 +1,11 @@ +/** + * 本文件继承了 egg-config-egg 的 node 规则,规则由 eslint-plugin-node 提供 + * @link https://github.com/eggjs/eslint-config-egg/blob/master/lib/rules/node.js + * @link https://github.com/mysticatea/eslint-plugin-node + */ + +module.exports = { + extends: [ + 'eslint-config-egg/lib/rules/node', + ], +}; diff --git a/packages/eslint-config-ali/rules/node.js b/packages/eslint-config-ali/rules/node.js index 353e7ad..7be35b6 100644 --- a/packages/eslint-config-ali/rules/node.js +++ b/packages/eslint-config-ali/rules/node.js @@ -1,11 +1,2 @@ -/** - * 本文件继承了 egg-config-egg 的 node 规则,规则由 eslint-plugin-node 提供 - * @link https://github.com/eggjs/eslint-config-egg/blob/master/lib/rules/node.js - * @link https://github.com/mysticatea/eslint-plugin-node - */ - module.exports = { - extends: [ - 'eslint-config-egg/lib/rules/node', - ], }; diff --git a/packages/eslint-config-ali/typescript/egg.js b/packages/eslint-config-ali/typescript/egg.js new file mode 100644 index 0000000..3b5512a --- /dev/null +++ b/packages/eslint-config-ali/typescript/egg.js @@ -0,0 +1,6 @@ +module.exports = { + extends: [ + './node', + './rules/egg', + ].map(require.resolve), +}; diff --git a/packages/f2elint/package.json b/packages/f2elint/package.json index 8120932..355f21a 100644 --- a/packages/f2elint/package.json +++ b/packages/f2elint/package.json @@ -94,24 +94,16 @@ "@types/fs-extra": "^9.0.13", "@types/glob": "^7.2.0", "@types/lodash": "^4.14.202", - "@types/node": "^14.18.63", + "@types/node": "^20.0.0", "@types/react": "^18.2.52", "@types/react-dom": "^18.2.18", - "@types/stylelint": "^14.0.0", "@types/text-table": "^0.2.5", - "copyfiles": "^2.4.1", "gh-pages": "^5.0.0", - "jest": "^27.5.1", - "nyc": "^15.1.0", "react": "^18.2.0", "react-doc-ui": "^2.2.1", "react-dom": "^18.2.0", - "stylelint": "^14.16.1", + "stylelint": "^16.2.1", "stylelint-config-ali": "workspace:^", - "stylelint-scss": "^4.7.0", - "terminal-link": "^2.1.1", - "text-table": "^0.2.0", - "vue-eslint-parser": "^7.11.0", "rive": "^2.0.22", "typescript": "^5.3.3" },