-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
61 lines (61 loc) · 1.65 KB
/
index.js
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
module.exports = {
parser: '@typescript-eslint/parser',
extends: [
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:@typescript-eslint/recommended',
'prettier/@typescript-eslint',
'plugin:prettier/recommended',
], //使用推荐的React代码检测规范
plugins: ['@typescript-eslint'],
env: {
browser: true,
node: true,
},
settings: {
//自动发现React的版本,从而进行规范react代码
react: {
pragma: 'React',
// version: 'detect',
version: '999.999.999',
},
},
parserOptions: {
//指定ESLint可以解析JSX语法
ecmaVersion: 2020,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
rules: {
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-var-requires': 0,
'react/react-in-jsx-scope': 0,
'@typescript-eslint/explicit-function-return-type': 0,
'@typescript-eslint/no-empty-function': 0,
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/no-unused-vars': 0,
'@typescript-eslint/no-use-before-define': 0,
'@typescript-eslint/class-name-casing': 0,
'@typescript-eslint/triple-slash-reference': 0,
'react-hooks/rules-of-hooks': 'warn',
'react-hooks/exhaustive-deps': 'off',
'prettier/prettier': [
'error',
{
printWidth: 120,
semi: false,
singleQuote: true,
trailingComma: 'all',
bracketSpacing: false,
// jsxBracketSameLine: true,
arrowParens: 'avoid',
insertPragma: false,
tabWidth: 2,
useTabs: false,
endOfLine: 'auto',
},
],
},
}