forked from didi/KnowStreaming
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
35 lines (35 loc) · 1.02 KB
/
.eslintrc.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
module.exports = {
env: {
browser: true,
node: true,
es2021: true,
},
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended', // 如果同时使用了eslint和prettier发生冲突了,会关闭掉与prettier有冲突的规则,也就是使用prettier认为对的规则
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 12,
sourceType: 'module',
},
plugins: [
'react',
'react-hooks',
'@typescript-eslint',
'prettier', // eslint 会使用pretter的规则对代码格式化
],
rules: {
'react-hooks/rules-of-hooks': 'error', // Checks rules of Hooks
'@typescript-eslint/no-var-requires': 0,
'prettier/prettier': 2, // 这项配置 对于不符合prettier规范的写法,eslint会提示报错
'no-console': 1,
'react/display-name': 0,
'@typescript-eslint/explicit-module-boundary-types': 'off',
},
};