Skip to content

Commit e49c4c4

Browse files
committed
rework eslint config
- use explicit config that only enables rules - upgrade eslint to 7.1.0 - add new plugins with selected rules enabled - fix discovered issues, remove global wipPrefixes
1 parent aaff47a commit e49c4c4

File tree

9 files changed

+528
-166
lines changed

9 files changed

+528
-166
lines changed

.eslintrc

Lines changed: 184 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
root: true
2-
3-
extends:
4-
- eslint-config-airbnb-base
5-
- eslint:recommended
2+
reportUnusedDisableDirectives: true
63

74
ignorePatterns:
85
- /web_src/js/vendor
96

107
parserOptions:
8+
sourceType: module
119
ecmaVersion: 2020
1210

11+
plugins:
12+
- eslint-plugin-unicorn
13+
- eslint-plugin-import
14+
- eslint-plugin-sonarjs
15+
1316
env:
1417
browser: true
1518
es6: true
@@ -28,47 +31,197 @@ overrides:
2831
- files: ["web_src/**/*.worker.js", "web_src/js/serviceworker.js"]
2932
env:
3033
worker: true
31-
rules:
32-
no-restricted-globals: [0]
3334

3435
rules:
35-
arrow-body-style: [0]
36+
accessor-pairs: [2]
37+
array-bracket-spacing: [2, never]
3638
arrow-parens: [2, always]
37-
camelcase: [0]
39+
arrow-spacing: [2, {before: true, after: true}]
40+
block-scoped-var: [2]
41+
brace-style: [2, 1tbs, {allowSingleLine: true}]
3842
comma-dangle: [2, only-multiline]
39-
consistent-return: [0]
40-
default-case: [0]
41-
func-names: [0]
43+
comma-spacing: [2, {before: false, after: true}]
44+
comma-style: [2, last]
45+
computed-property-spacing: [2, never]
46+
constructor-super: [2]
47+
default-case-last: [2]
48+
dot-location: [2, property]
49+
eol-last: [2]
50+
eqeqeq: [2]
51+
for-direction: [2]
52+
func-call-spacing: [2, never]
53+
func-name-matching: [2]
54+
getter-return: [2]
55+
grouped-accessor-pairs: [2]
56+
import/export: [2]
4257
import/extensions: [2, always, {ignorePackages: true}]
43-
import/prefer-default-export: [0]
44-
max-len: [0]
58+
import/first: [2]
59+
import/named: [2]
60+
import/no-extraneous-dependencies: [2]
61+
import/no-mutable-exports: [2]
62+
import/no-named-as-default: [2]
63+
import/no-self-import: [2]
64+
import/no-unresolved: [2, {commonjs: true}]
65+
import/no-useless-path-segments: [2, {commonjs: true}]
66+
import/no-webpack-loader-syntax: [2]
67+
indent: [2, 2, {ignoreComments: true, SwitchCase: 1}]
68+
key-spacing: [2]
69+
keyword-spacing: [2]
70+
linebreak-style: [2, unix]
4571
multiline-comment-style: [2, separate-lines]
46-
newline-per-chained-call: [0]
47-
no-alert: [0]
72+
new-parens: [2]
73+
no-array-constructor: [2]
74+
no-async-promise-executor: [2]
75+
no-caller: [2]
76+
no-case-declarations: [2]
77+
no-class-assign: [2]
78+
no-compare-neg-zero: [2]
4879
no-cond-assign: [2, except-parens]
4980
no-console: [1, {allow: [info, warn, error]}]
50-
no-continue: [0]
81+
no-const-assign: [2]
82+
no-constructor-return: [2]
83+
no-debugger: [1]
84+
no-delete-var: [2]
85+
no-dupe-args: [2]
86+
no-dupe-class-members: [2]
87+
no-dupe-else-if: [2]
88+
no-dupe-keys: [2]
89+
no-duplicate-case: [2]
90+
no-duplicate-imports: [2]
91+
no-empty-character-class: [2]
92+
no-empty-pattern: [2]
5193
no-empty: [2, {allowEmptyCatch: true}]
5294
no-eq-null: [2]
53-
no-mixed-operators: [0]
54-
no-multi-assign: [0]
55-
no-new: [0]
56-
no-param-reassign: [0]
57-
no-plusplus: [0]
58-
no-restricted-syntax: [0]
59-
no-return-await: [0]
60-
no-shadow: [0]
61-
no-underscore-dangle: [0]
62-
no-unused-vars: [2, {args: all, argsIgnorePattern: ^_, varsIgnorePattern: ^_, ignoreRestSiblings: true}]
63-
no-use-before-define: [0]
95+
no-eval: [2]
96+
no-ex-assign: [2]
97+
no-extend-native: [2]
98+
no-extra-bind: [2]
99+
no-extra-boolean-cast: [2]
100+
no-extra-semi: [2]
101+
no-fallthrough: [2]
102+
no-func-assign: [2]
103+
no-global-assign: [2]
104+
no-implied-eval: [2]
105+
no-import-assign: [2]
106+
no-inner-declarations: [2]
107+
no-invalid-regexp: [2]
108+
no-irregular-whitespace: [2]
109+
no-iterator: [2]
110+
no-label-var: [2]
111+
no-labels: [2]
112+
no-lone-blocks: [2]
113+
no-loss-of-precision: [2]
114+
no-misleading-character-class: [2]
115+
no-mixed-spaces-and-tabs: [2]
116+
no-multi-spaces: [2, {ignoreEOLComments: true, exceptions: {Property: true, VariableDeclarator: true}}]
117+
no-multi-str: [2]
118+
no-new-func: [2]
119+
no-new-object: [2]
120+
no-new-symbol: [2]
121+
no-new-wrappers: [2]
122+
no-obj-calls: [2]
123+
no-octal-escape: [2]
124+
no-octal: [2]
125+
no-proto: [2]
126+
no-prototype-builtins: [2]
127+
no-redeclare: [2]
128+
no-regex-spaces: [2]
129+
no-restricted-syntax: [2, WithStatement, ForInStatement, LabeledStatement]
130+
no-script-url: [2]
131+
no-self-assign: [2, {props: true}]
132+
no-self-compare: [2]
133+
no-sequences: [2]
134+
no-setter-return: [2]
135+
no-shadow-restricted-names: [2]
136+
no-sparse-arrays: [2]
137+
no-tabs: [2]
138+
no-template-curly-in-string: [2]
139+
no-this-before-super: [2]
140+
no-throw-literal: [2]
141+
no-trailing-spaces: [2]
142+
no-undef-init: [2]
143+
no-undef: [2, {typeof: true}]
144+
no-unexpected-multiline: [2]
145+
no-unmodified-loop-condition: [2]
146+
no-unreachable: [2]
147+
no-unsafe-finally: [2]
148+
no-unsafe-negation: [2]
149+
no-unused-expressions: [2]
150+
no-unused-labels: [2]
151+
no-unused-vars: [2, {args: all, argsIgnorePattern: ^_, varsIgnorePattern: ^_, caughtErrorsIgnorePattern: ^_, ignoreRestSiblings: false}]
152+
no-use-before-define: [2, nofunc]
153+
no-useless-call: [2]
154+
no-useless-catch: [2]
155+
no-useless-computed-key: [2]
156+
no-useless-concat: [2]
157+
no-useless-constructor: [2]
158+
no-useless-escape: [2]
159+
no-useless-rename: [2]
64160
no-var: [2]
65-
object-curly-newline: [0]
161+
no-void: [2]
162+
no-whitespace-before-property: [2]
163+
no-with: [2]
164+
nonblock-statement-body-position: [2]
66165
object-curly-spacing: [2, never]
67-
one-var-declaration-per-line: [0]
68-
one-var: [0]
166+
object-shorthand: [2, always]
167+
operator-assignment: [2, always]
69168
operator-linebreak: [2, after]
169+
padded-blocks: [2, never]
170+
prefer-arrow-callback: [2, {allowNamedFunctions: true, allowUnboundThis: true}]
70171
prefer-const: [2, {destructuring: all}]
71-
prefer-destructuring: [0]
172+
prefer-exponentiation-operator: [2]
173+
prefer-numeric-literals: [2]
174+
prefer-promise-reject-errors: [2, {allowEmptyReject: false}]
175+
prefer-regex-literals: [2]
176+
prefer-rest-params: [2]
177+
prefer-spread: [2]
178+
prefer-template: [2]
72179
quotes: [2, single, {avoidEscape: true, allowTemplateLiterals: true}]
73180
radix: [2, as-needed]
181+
require-yield: [2]
182+
rest-spread-spacing: [2, never]
183+
semi-spacing: [2, {before: false, after: true}]
184+
semi-style: [2, last]
74185
semi: [2, always, {omitLastInOneLineBlock: true}]
186+
sonarjs/no-all-duplicated-branches: [2]
187+
sonarjs/no-collection-size-mischeck: [2]
188+
sonarjs/no-element-overwrite: [2]
189+
sonarjs/no-identical-conditions: [2]
190+
sonarjs/no-inverted-boolean-check: [2]
191+
sonarjs/no-one-iteration-loop: [2]
192+
sonarjs/no-redundant-boolean: [2]
193+
sonarjs/no-same-line-conditional: [2]
194+
sonarjs/no-unused-collection: [2]
195+
sonarjs/no-use-of-empty-return-value: [2]
196+
sonarjs/prefer-object-literal: [2]
197+
sonarjs/prefer-while: [2]
198+
space-before-blocks: [2, always]
199+
space-in-parens: [2, never]
200+
space-infix-ops: [2]
201+
space-unary-ops: [2]
202+
spaced-comment: [2, always]
203+
switch-colon-spacing: [2]
204+
symbol-description: [2]
205+
template-curly-spacing: [2, never]
206+
template-tag-spacing: [2, never]
207+
unicode-bom: [2, never]
208+
unicorn/consistent-function-scoping: [2]
209+
unicorn/new-for-builtins: [2]
210+
unicorn/no-reduce: [2]
211+
unicorn/no-unused-properties: [2]
212+
unicorn/no-zero-fractions: [2]
213+
unicorn/prefer-add-event-listener: [2]
214+
unicorn/prefer-dataset: [2]
215+
unicorn/prefer-event-key: [2]
216+
unicorn/prefer-includes: [2]
217+
unicorn/prefer-negative-index: [2]
218+
unicorn/prefer-optional-catch-binding: [2]
219+
unicorn/prefer-starts-ends-with: [2]
220+
unicorn/prefer-text-content: [2]
221+
unicorn/prefer-trim-start-end: [2]
222+
unicorn/throw-new-error: [2]
223+
use-isnan: [2]
224+
valid-typeof: [2, {requireStringLiterals: true}]
225+
wrap-iife: [2, inside]
226+
yield-star-spacing: [2, after]
227+
yoda: [2, never]

0 commit comments

Comments
 (0)