-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc
203 lines (199 loc) · 8.58 KB
/
.eslintrc
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
191
192
193
194
195
196
197
198
199
200
201
202
203
{
//github.com/eslint/eslint/blob/main/conf/eslint-recommended.js
"extends": "eslint:recommended",
"env": {
"browser": true,
"es6": true, // sets parserOptions.ecmaVersion = 6
"jquery": true
},
"plugins": [
"dollar-sign"
],
//eslint.org/docs/rules/
"rules": {
//eslint.org/docs/latest/rules#possible-problems
"array-callback-return": ["error"],
"no-await-in-loop": ["error"],
"no-constant-binary-expression": ["warn"],
"no-constructor-return": ["warn"],
"no-duplicate-imports": ["warn"],
"no-new-native-nonconstructor": ["warn"],
"no-self-compare": ["warn"],
"no-template-curly-in-string": ["error"],
"no-unmodified-loop-condition": ["warn"],
"no-unreachable-loop": ["warn"],
"no-unused-private-class-members": ["warn"],
"no-unused-vars": ["warn", { "vars": "local", "args": "none", "ignoreRestSiblings": true }],
"no-use-before-define": ["warn", { "functions": false }], // functions allowed client-side
"require-atomic-updates": ["warn"],
//eslint.org/docs/latest/rules#suggestions
"accessor-pairs": ["warn"],
//"arrow-body-style": ["warn", "as-needed"], // conflicts with no-confusing-arrow, ignores comments
"block-scoped-var": ["warn"],
"camelcase": ["warn", { "properties": "never" }],
"class-methods-use-this": ["warn"],
"complexity": ["warn", 40],
//"consistent-return": ["warn"], // false positives
//"consistent-this": ["warn", "self", "that"], // warns if self is assigned to anything other than `this`
//"curly": ["warn", "multi-line", "consistent"], // false positives
"default-case": ["warn"], // allows "no default" comment
"default-case-last": ["warn"],
"default-param-last": ["warn"],
"dot-notation": ["warn", { "allowPattern": "^[a-z]+(_[a-z]+)+$" }],
"eqeqeq": ["warn"],
"func-name-matching": ["warn"],
"grouped-accessor-pairs": ["warn", "getBeforeSet"],
"guard-for-in": ["warn"],
"id-denylist": ["warn"],
//"logical-assignment-operators": ["warn", "always", { "enforceForIfStatements": true }], // future
"max-classes-per-file": ["warn", 8],
"max-depth": ["warn", 8],
"max-lines": ["warn", { "max": 1000, "skipBlankLines": true, "skipComments": true }],
"max-lines-per-function": ["warn", { "max": 350, "skipBlankLines": true, "skipComments": true }], // default 50, disable in gruntfile
"max-nested-callbacks": ["warn", 10], // default 10
"max-params": ["warn", 10],
"max-statements": ["warn", 100],
//"new-cap": ["warn"], // necessary for some third-party modules
"no-array-constructor": ["warn"],
"no-bitwise": ["warn"],
"no-caller": ["error"],
"no-confusing-arrow": ["warn"],
"no-div-regex": ["warn"],
"no-else-return": ["warn"],
"no-empty": ["warn"],
"no-empty-function": ["warn"],
"no-empty-static-block": ["warn"],
"no-eq-null": ["warn"],
"no-eval": ["error"],
"no-extend-native": ["warn"],
"no-extra-bind": ["warn"],
"no-extra-label": ["warn"],
"no-floating-decimal": ["warn"],
"no-global-assign": ["warn", { "exceptions": ["location"] }],
"no-implicit-coercion": ["warn", { "boolean": true, "string": false, "number": true }],
"no-implied-eval": ["warn"],
"no-invalid-this": ["warn"],
"no-iterator": ["warn"],
"no-label-var": ["warn"],
"no-labels": ["warn"], //["warn", { "allowLoop": true }],
"no-lone-blocks": ["warn"],
"no-lonely-if": ["warn"],
"no-loop-func": ["warn"],
"no-mixed-operators": ["warn"],
"no-multi-assign": ["warn"],
"no-multi-str": ["warn"],
"no-negated-condition": ["warn"],
"no-new": ["warn"],
"no-new-func": ["error"],
"no-new-object": ["warn"],
"no-new-wrappers": ["warn"],
"no-octal-escape": ["warn"],
"no-param-reassign": ["warn"],
"no-proto": ["warn"],
"no-restricted-exports": ["warn"],
"no-restricted-globals": ["warn"],
"no-restricted-imports": ["warn"],
"no-restricted-properties": ["warn"],
"no-restricted-syntax": ["warn"],
"no-return-assign": ["warn"],
"no-return-await": ["warn"],
"no-script-url": ["warn"],
"no-sequences": ["warn"],
"no-throw-literal": ["warn"],
"no-undef-init": ["warn"],
"no-undefined": ["warn"],
"no-unneeded-ternary": ["warn"],
"no-unused-expressions": ["warn"],
"no-useless-call": ["warn"],
"no-useless-computed-key": ["warn"],
"no-useless-concat": ["error"],
"no-useless-constructor": ["warn"],
"no-useless-rename": ["warn"],
"no-useless-return": ["warn"],
"no-void": ["warn"],
"no-warning-comments": ["warn", { "terms": ["fixme", "hack"] }],
"one-var": ["warn", { "const": "never", "let": "never", "separateRequires": true }],
"operator-assignment": ["warn"],
"prefer-destructuring": ["off"], // BUG: supposedly not included in eslint:recommended, but warns even when off
"prefer-exponentiation-operator": ["warn"],
//"prefer-named-capture-group": ["warn"], // future?
"prefer-promise-reject-errors": ["warn"],
"prefer-regex-literals": ["warn"],
"quote-props": ["warn", "as-needed"],
"radix": ["warn", "as-needed"],
"require-await": ["warn"],
"sort-imports": ["warn", { "ignoreCase": true, "ignoreDeclarationSort": true }],
"symbol-description": ["warn"],
"yoda": ["warn"],
//eslint.org/docs/latest/rules/#layout--formatting
"array-bracket-spacing": ["warn", "never"],
"arrow-parens": ["warn"],
"arrow-spacing": ["warn"],
"block-spacing": ["warn"],
"brace-style": ["warn", "1tbs"],
"comma-dangle": ["warn", "only-multiline"],
"comma-spacing": ["warn", { "before": false, "after": true }],
"comma-style": ["warn", "last"],
"computed-property-spacing": ["warn", "never"],
"dot-location": ["warn", "property"],
"eol-last": ["error"],
"func-call-spacing": ["warn", "never"],
"function-call-argument-newline": ["warn", "consistent"],
"function-paren-newline": ["warn", "consistent"],
"generator-star-spacing": ["warn"],
"implicit-arrow-linebreak": ["warn"],
"indent": ["warn", 2, {
"FunctionExpression": { "parameters": "first" },
"MemberExpression": 1,
"SwitchCase": 1,
"VariableDeclarator": { "var": 2, "let": 2, "const": 3 }
}],
"key-spacing": ["warn", { "beforeColon": false, "afterColon": true }],
"linebreak-style": ["warn", "unix"],
"lines-between-class-members": ["warn"],
"max-len": ["warn", { "code": 180, "ignoreTemplateLiterals": true, "ignoreUrls": true }],
"max-statements-per-line": ["warn", { "max": 2 }],
"multiline-ternary": ["warn", "always-multiline"],
"new-parens": ["warn"],
//"no-extra-parens": ["warn", "all", { "conditionalAssign": false, "enforceForArrowConditionals": false, "ignoreJSX": "all", "nestedBinaryExpressions": false, "returnAssign": false }],
"no-multi-spaces": ["warn", { "ignoreEOLComments": true, "exceptions": { "ImportDeclaration": true, "Property": true, "VariableDeclarator": true } }],
"no-multiple-empty-lines": ["warn", { "max": 3, "maxEOF": 0 }],
//"no-tabs": ["warn"], // warns about tabs in comments
"no-trailing-spaces": ["warn"],
"no-whitespace-before-property": ["warn"],
"object-curly-spacing": ["warn", "always"],
"operator-linebreak": ["warn", "after", { "overrides": { "?": "before", ":": "before" } }],
"padded-blocks": ["warn", { "blocks": "never", "switches": "never" }],
"padding-line-between-statements": ["warn"],
"quotes": ["warn", "single", { "avoidEscape": true, "allowTemplateLiterals": true }],
"rest-spread-spacing": ["warn"],
"semi": ["warn", "always"],
"semi-spacing": ["warn", { "before": false, "after": true }],
"semi-style": ["warn"],
"space-before-blocks": ["warn"],
"space-before-function-paren": ["warn", { "anonymous": "always", "named": "never", "asyncArrow": "always" }],
"space-in-parens": ["warn"],
"space-infix-ops": ["warn"],
"space-unary-ops": ["warn", { "words": true, "nonwords": false }],
"switch-colon-spacing": ["warn"],
"template-curly-spacing": ["warn"],
"template-tag-spacing": ["warn"],
"unicode-bom": ["warn"],
"wrap-iife": ["warn"],
"wrap-regex": ["warn"],
"yield-star-spacing": ["warn"],
//eslint.org/docs/rules/#deprecated
"callback-return": ["warn"],
"no-buffer-constructor": ["warn"],
"no-mixed-requires": ["warn"],
"no-new-require": ["warn"],
"no-path-concat": ["warn"],
"no-process-exit": ["warn"],
"no-prototype-builtins": ["error"],
"no-restricted-modules": ["warn"],
"no-sync": ["warn"],
// PLUGINS //
//www.npmjs.com/package/eslint-plugin-dollar-sign
"dollar-sign/dollar-sign": ["warn", "ignoreProperties"]
}
}