-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
151 lines (151 loc) · 4.05 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
// Note: A lot of this is copied from react-native, with modifications to not use prettier
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
extends: [
"airbnb",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
],
plugins: [
'@typescript-eslint',
'eslint-comments',
'import',
'react',
'react-hooks',
'jest',
],
parserOptions: {
project: "./tsconfig.json",
},
overrides: [
{
files: [
'*.{spec,test}.{js,ts,tsx}',
'**/__{mocks,tests}__/**/*.{js,ts,tsx}',
],
env: {
jest: true,
'jest/globals': true,
},
},
],
rules: {
// This project uses snake_case
"@typescript-eslint/camelcase": "off",
// Tooling support is enough
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-member-accessibility": ["error"],
// To allow extracting sub-objects using spread operator
"@typescript-eslint/no-unused-vars": [
"error",
{
"ignoreRestSiblings": true
}
],
"@typescript-eslint/no-var-requires": "off",
// Style
"arrow-parens": ["error", "as-needed"],
// Style
"brace-style": [
1,
"stroustrup"
],
curly: [
"warn",
"multi-or-nest"
],
// Not all class methods should need to have this.xxx somewhere
"class-methods-use-this": "off",
"import/extensions": [
"error",
"ignorePackages",
{
"js": "never",
"jsx": "never",
"ts": "never",
"tsx": "never"
}
],
"import/no-duplicates": "off", // Broken now???????????????????????
"import/no-extraneous-dependencies": ["error", { "packageDir": './' }],
// A lot of the import stuff seems overly strict
"import/no-named-as-default": "off",
"import/no-named-as-default-member": "off",
"import/prefer-default-export": "off",
// No space after flow control keywords ( if(), for(), while()... )
"keyword-spacing": [
"warn",
{
"before": true,
"after": true,
"overrides": {
"if": {
"after": false
},
"while": {
"after": false
},
"for": {
"after": false
},
"switch": {
"after": false
},
"catch": {
"after": false
}
}
}
],
// Git standard: use local and commit unix line endings
"linebreak-style": "off",
// Allow spacing
"lines-between-class-members": "off",
"max-classes-per-file": "off", // Counts inner classes for some reason
// Increased max len for modern computers
"max-len": [
"warn",
140
],
// react allows state override
"no-dupe-class-members": "off",
// Better readability sometimes
"no-else-return": "off",
"no-undef": 0,
"no-restricted-syntax": "off",
"no-useless-constructor": "off", // Typescript got this one
"nonblock-statement-body-position": [
"error",
"below",
],
"object-curly-newline": "off", // Style
"react/destructuring-assignment": "off", // Shouldn't always need destructuring
"react/prop-types": "off", // We use typescript, already typed.
"react/jsx-filename-extension": [1, { "extensions": [".tsx", ".jsx"] }],
"react/jsx-props-no-spreading": "off", // Typing provides good enough readability
"react/sort-comp": "off", // render, as a public method, should go above private methods
"react/state-in-constructor": "off",
"react/static-property-placement": ["error", "static public field"],
},
settings: {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
},
"import/extensions": [".js", ".jsx", ".ts", ".tsx"],
"import/resolver": {
typescript: {
"alwaysTryTypes": true,
"directory": "./tsconfig.json",
},
node: {
extensions: [
".js",
".jsx",
".ts",
".tsx"
]
},
},
},
};