-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy path.eslintrc.js
113 lines (110 loc) · 2.91 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
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/**
* eslint中文规则网站
*
* https://cn.eslint.org/docs/rules/
*
*/
// 使用例子 eslint fix
// yarn eslint --fix packages/award/src/**/*.tsx
module.exports = {
extends: ['alloy', 'alloy/react', 'alloy/typescript', 'prettier'],
root: true,
plugins: ['prettier', 'jest'],
rules: {
'prettier/prettier': ['error'],
/**
* eslint-config-alloy
* https://github.com/AlloyTeam/eslint-config-alloy/blob/master/index.js
*/
'max-params': ['off'],
'no-throw-literal': ['off'],
'no-param-reassign': ['off'],
indent: ['off'],
'no-async-promise-executor': ['off'],
semi: ['error', 'always'],
'spaced-comment': [
'error',
'always',
{
markers: ['/']
}
],
'comma-dangle': ['error', 'never'],
'no-unused-vars': ['off'],
'require-atomic-updates': ['off'],
'react/no-unescaped-entities': ['off'],
/**
* eslint-config-alloy/react
* https://github.com/AlloyTeam/eslint-config-alloy/blob/master/react.js
*/
'react/jsx-indent': ['off'],
'react/jsx-indent-props': ['off'],
'react/sort-comp': ['off'],
/**
* eslint-config-alloy/typescript
* https://github.com/AlloyTeam/eslint-config-alloy/blob/master/typescript.js
*/
'@typescript-eslint/no-unused-vars': ['error'],
'@typescript-eslint/indent': ['off'],
'@typescript-eslint/no-var-requires': ['off'],
'@typescript-eslint/no-this-alias': [
'error',
{
allowDestructuring: true, // Allow `const { props, state } = this`; false by default
allowedNames: ['self'] // Allow `const self = this`; `[]` by default
}
],
'@typescript-eslint/no-angle-bracket-type-assertion': ['off'],
'@typescript-eslint/no-triple-slash-reference': ['off'],
'@typescript-eslint/prefer-interface': ['off'],
'@typescript-eslint/no-object-literal-type-assertion': ['off'],
'@typescript-eslint/member-ordering': ['off'],
'@typescript-eslint/no-require-imports': ['off'],
'@typescript-eslint/no-unused-expressions': ['off']
},
overrides: [
{
// 覆盖测试示例
files: ['__tests__/**/*.{ts,tsx}'],
rules: {
// https://github.com/jest-community/eslint-plugin-jest
'jest/no-focused-tests': 2,
'no-promise-executor-return': 'off'
},
env: {
jest: true
}
},
{
// 源代码
files: ['{packages,tools}/**/src/**/*.{ts,tsx}'],
rules: {
'no-undef': 'off'
}
},
{
files: ['**/*.js'],
globals: {
React: true
},
rules: {
'@typescript-eslint/no-unused-vars': ['off'],
'@typescript-eslint/explicit-member-accessibility': ['off']
}
}
],
parserOptions: {
ecmaVersion: 6,
sourceType: 'module',
ecmaFeatures: {
modules: true,
jsx: true
}
},
settings: {
react: {
pragma: 'React',
version: '16.9.0'
}
}
};