eslint config
uiw-admin 内置 eslint 规则配置
安装
npm i eslint-config-uiw-admin -D # yarn add eslint-config-uiw-admin -D
用法
- 第一种:项目的根文件夹中创建一个名为
.eslintrc.json
以下内容的文件:
module.exports ={
// ...
"extends": "uiw-admin"
}
- 第二种:项目的
package.json
加入以下内容
// ...
"eslintConfig": {
"extends": [
"uiw-admin"
]
}
// ...
React17以上的版本配合babel可以单独使用 JSX 而无需引入 React https://zh-hans.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html
移除未使用的 React 引入
cd your_project
npx react-codemod update-react-imports
如果使用ts修改tsconfig.json文件
"jsx": "react-jsx",
eslint-config-uiw-admin
您可以通过编辑.eslintrc.json
文件来覆盖设置。在 ESLint 网站上了解更多关于配置 ESLint的信息。
默认规则
- no-const-assign: 'error',
- eqeqeq: 'error',
- max-lines: ['error', { max: 500 }],
- max-depth: ['error', 4],
- no-empty-function: 'error',
- no-empty: 'error',
- no-var: 'error',
- no-use-before-define: 'off',
- @typescript-eslint/no-use-before-define: ['error']