-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.cjs
37 lines (37 loc) · 1.76 KB
/
.eslintrc.cjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': [
'warn',
{
// 禁用 alert、confirm、prompt、console、debugger
'no-alert': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'eqeqeq':'warn', // 要求使用 === 和 !==
'no-dupe-args': 'error', // 禁止 function 定义中出现重名参数
'no-dupe-keys': 'error', // 禁止对象字面量中出现重复的 key
'no-eval': 'error', // 禁用 eval()
'no-self-compare': 'error', // 禁止自身比较
'no-self-assign': 'error', // 禁止自我赋值
'no-unused-vars': 'error', // 禁止出现未使用过的变量
'no-const-assign': 'error', // 禁止修改 const 声明的变量
'no-func-assign': 'error', // 禁止对 function 声明重新赋值
'camelcase': 'error', // 强制使用骆驼拼写法命名约定
'no-mixed-spaces-and-tabs': 'error', //禁止混用tab和空格
'indent': ['warn', 2], //缩进风格这里不做硬性规定,但是产品组内要达成统一
'quotes': ['warn', 'single'], //要求引号类型 `` ' ''
'semi': ['error', 'always'], //语句强制分号结尾
},
],
},
}