-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.json
190 lines (190 loc) · 7.47 KB
/
.eslintrc.json
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
{
"extends": [
"plugin:@typescript-eslint/recommended",
"plugin:import/typescript",
"airbnb-base"
],
"env": {
"node": true,
"es6": true,
"jest": true
},
"plugins": [
"@typescript-eslint"
],
"settings": {
"import/resolver": {
"typescript": {
"alwaysTryTypes": true // always try to resolve types under `<roo/>@types` directory even it doesn't contain any source code, like `@types/unist`
}
}
},
"rules": {
"@typescript-eslint/no-unused-vars": ["warn", { "args": "all", "varsIgnorePattern": "React", "argsIgnorePattern": "event" } ],
"accessor-pairs": "off",
"array-bracket-spacing": ["warn", "always"],
"brace-style": ["warn", "1tbs", { "allowSingleLine": true }],
"camelcase": ["warn", { "properties": "always" }],
"class-methods-use-this": "off", //sometimes we use class methods to create singletons, with typescript these should be static methods
"comma-dangle": ["warn", "only-multiline"],
"comma-spacing": ["warn", { "before": false, "after": true }],
"comma-style": ["warn", "last"],
"complexity": "off",
"computed-property-spacing": ["warn", "never"],
"consistent-return": "off",
"consistent-this": "off",
"constructor-super": "warn",
"curly": ["warn", "multi-line"],
"default-case": "error",
"dot-location": ["warn", "property"],
"dot-notation": ["warn", { "allowKeywords": true, "allowPattern": "" }],
"eol-last": "warn",
"eqeqeq": "warn",
"func-names": "off",
"func-style": "off",
"function-paren-newline": ["warn", "multiline"],
"guard-for-in": "off",
"handle-callback-err": "warn",
"import/extensions": ["warn", "never"],
"import/newline-after-import": "warn",
"import/no-absolute-path": "off", // eslint does not parse path aliases properly
"import/no-unresolved": "warn",
"import/no-useless-path-segments": "warn",
"import/order": "warn",
"import/prefer-default-export": "off", // named exports are better and make aliasing explicit
"indent": ["warn", 2],
"key-spacing": ["warn", { "beforeColon": false, "afterColon": true }],
"keyword-spacing": "warn",
"linebreak-style": "off",
"lines-between-class-members": "warn",
"max-depth": ["warn", 5], // Due to common use of objects as configuration and templates
"max-nested-callbacks": ["off", 3],
"max-params": "off",
"max-statements": "off",
"new-cap": "error",
"new-parens": "warn",
"no-alert": "warn",
"no-array-constructor": "warn",
"no-await-in-loop": "warn",
"no-bitwise": "warn",
"no-caller": "warn",
"no-case-declarations": "warn",
"no-cond-assign": ["warn", "except-parens"],
"no-console": "off",
"no-constant-condition": "warn",
"no-continue": "warn",
"no-control-regex": "warn",
"no-debugger": "warn",
"no-delete-var": "warn",
"no-div-regex": "warn",
"no-dupe-args": "warn",
"no-dupe-keys": "warn",
"no-duplicate-case": "error",
"no-else-return": "warn",
"no-empty-character-class": "warn",
"no-empty": "warn",
"no-eq-null": "off", // ==null is useful to check for undefined or null vals
"no-eval": "warn",
"no-ex-assign": "warn",
"no-extend-native": "warn",
"no-extra-bind": "warn",
"no-extra-boolean-cast": "warn",
"no-extra-parens": "off",
"no-extra-semi": "warn",
"no-fallthrough": "error",
"no-floating-decimal": "warn",
"no-func-assign": "warn",
"no-implied-eval": "warn",
"no-inline-comments": "off", // keep these to a minimum
"no-inner-declarations": ["warn", "functions"],
"no-invalid-regexp": "warn",
"no-irregular-whitespace": "warn",
"no-iterator": "warn",
"no-label-var": "warn",
"no-labels": "warn",
"no-lone-blocks": "warn",
"no-lonely-if": "off", // this is a design pattern which is sometimes necessary
"no-loop-func": "warn",
"no-mixed-requires": "warn",
"no-mixed-spaces-and-tabs": "warn",
"no-multi-spaces": "warn",
"no-multi-str": "warn",
"no-multiple-empty-lines": ["warn", { "max": 1 }],
"no-nested-ternary": "error", // nesting ternaries is very very confusing and usually lazy
"no-new-func": "warn",
"no-new-object": "warn",
"no-new-require": "warn",
"no-new-wrappers": "warn",
"no-new": "warn",
"no-obj-calls": "warn",
"no-octal-escape": "warn",
"no-octal": "warn",
"no-param-reassign": "warn",
"no-path-concat": "warn",
"no-plusplus": "warn",
"no-process-env": "warn",
"no-process-exit": "warn",
"no-proto": "warn",
"no-redeclare": "warn",
"no-regex-spaces": "warn",
"no-restricted-modules": ["warn", ""],
"no-restricted-syntax": "off", // We are not performance restricted
"no-return-assign": "warn",
"no-script-url": "warn",
"no-self-compare": "warn",
"no-sequences": "warn",
"no-shadow-restricted-names": "warn",
"no-shadow": ["warn", { "allow": ["reject", "resolve", "error", "err", "e"] } ],
"no-sparse-arrays": "warn",
"no-sync": "off", // sync methods are useful
"no-ternary": "off", // ternaries are useful
"no-this-before-super": "warn",
"no-throw-literal": "warn",
"no-trailing-spaces": "warn",
"no-undef-init": "warn",
"no-undef": "warn",
"no-undefined": "warn",
"no-underscore-dangle": "off", // many api calls set the variable names for us and _ dangle is required
"no-unexpected-multiline": "warn",
"no-unneeded-ternary": "warn",
"no-unreachable": "warn",
"no-unused-expressions": "warn",
"no-unused-vars": ["warn", { "vars": "local", "args": "after-used" }],
"no-useless-rename": "warn",
"no-var": "warn",
"no-void": "warn",
"no-warning-comments": ["off", { "terms": ["todo", "tofix"], "location": "start" }],
"no-with": "warn",
"object-curly-newline": [ "warn", { "multiline": true } ],
"object-curly-spacing": ["warn", "always"],
"object-shorthand": "warn",
"operator-assignment": ["off", "never"],
"padded-blocks": ["off", "never"],
"prefer-const": "warn",
"prefer-destructuring": "warn",
"prefer-template": "off", // --fix incorrectly parses these very often
"quote-props": ["warn", "as-needed"],
"quotes": ["warn", "single", {"avoidEscape": true ,"allowTemplateLiterals": true}],
"radix": "off", // This is overkill
"semi-spacing": ["warn", { "before": false, "after": true }],
"semi": ["warn", "never"],
"sort-vars": "off", // variables should be initialized in the order they are used
"space-before-blocks": ["warn", "always"],
"space-before-function-paren": ["warn", { "anonymous": "always", "named": "never", "asyncArrow": "always" } ],
"space-in-parens": ["warn", "never"],
"space-infix-ops": "warn",
"space-unary-ops": "warn",
"spaced-comment": ["warn", "always"],
"strict": ["warn", "global"],
"use-isnan": "warn",
"valid-typeof": "warn",
"vars-on-top": "warn",
"wrap-iife": ["warn", "inside"],
"wrap-regex": "warn",
"yoda": ["warn", "never"],
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-inferrable-types": "warn",
"@typescript-eslint/no-use-before-define": "warn",
"@typescript-eslint/no-var-requires": "off"
}
}