Skip to content

Commit 000db1e

Browse files
authored
feat: migrate eslint config eslint/all into dedicated rules for better semver support (#30)
1 parent 818fb54 commit 000db1e

File tree

2 files changed

+209
-31
lines changed

2 files changed

+209
-31
lines changed

configs/eslint.js

+207-29
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,217 @@
11
module.exports = {
2-
extends: ['eslint:all', 'prettier'],
32
rules: {
4-
'one-var': ['error', 'never'],
5-
'no-magic-numbers': 'off',
6-
'sort-keys': 'off',
7-
'sort-imports': 'off',
3+
// https://eslint.org/docs/latest/rules
4+
5+
// Possible Problems
6+
'array-callback-return': 'error',
7+
'constructor-super': 'error',
8+
'for-direction': 'error',
9+
'getter-return': 'error',
10+
'no-async-promise-executor': 'error',
11+
'no-await-in-loop': 'error',
12+
'no-class-assign': 'error',
13+
'no-compare-neg-zero': 'error',
14+
'no-cond-assign': 'error',
15+
'no-const-assign': 'error',
16+
'no-constant-binary-expression': 'error',
17+
'no-constant-condition': 'error',
18+
'no-constructor-return': 'error',
19+
'no-control-regex': 'error',
20+
'no-debugger': 'error',
21+
'no-dupe-args': 'error',
22+
'no-dupe-class-members': 'error',
23+
'no-dupe-else-if': 'error',
24+
'no-dupe-keys': 'error',
25+
'no-duplicate-case': 'error',
26+
'no-duplicate-imports': 'error',
27+
'no-empty-character-class': 'error',
28+
'no-empty-pattern': 'error',
29+
'no-ex-assign': 'error',
30+
'no-fallthrough': 'error',
31+
'no-func-assign': 'error',
32+
'no-import-assign': 'error',
33+
'no-inner-declarations': 'error',
34+
'no-invalid-regexp': 'error',
35+
'no-irregular-whitespace': 'error',
36+
'no-loss-of-precision': 'error',
37+
'no-misleading-character-class': 'error',
38+
'no-new-native-nonconstructor': 'error',
39+
'no-new-symbol': 'error',
40+
'no-obj-calls': 'error',
41+
'no-promise-executor-return': 'error',
42+
'no-prototype-builtins': 'error',
43+
'no-self-assign': 'error',
44+
'no-self-compare': 'error',
45+
'no-setter-return': 'error',
46+
'no-sparse-arrays': 'error',
47+
'no-template-curly-in-string': 'error',
48+
'no-this-before-super': 'error',
49+
'no-undef': 'error',
50+
'no-unexpected-multiline': 'off', // conflicts with prettier
51+
'no-unmodified-loop-condition': 'error',
52+
'no-unreachable': 'error',
53+
'no-unreachable-loop': 'error',
54+
'no-unsafe-finally': 'error',
55+
'no-unsafe-negation': 'error',
56+
'no-unsafe-optional-chaining': 'error',
57+
'no-unused-private-class-members': 'error',
58+
'no-unused-vars': 'error',
59+
'no-use-before-define': 'error',
60+
'no-useless-backreference': 'error',
61+
'require-atomic-updates': 'error',
62+
'use-isnan': 'error',
63+
'valid-typeof': 'error',
64+
65+
// Suggestions
66+
'accessor-pairs': 'error',
67+
'arrow-body-style': 'off',
68+
'block-scoped-var': 'error',
69+
camelcase: 'off',
70+
'capitalized-comments': 'off',
71+
'class-methods-use-this': 'off',
72+
complexity: 'error',
73+
'consistent-return': 'off',
74+
'consistent-this': 'error',
75+
curly: ['error', 'all'],
76+
'default-case': 'error',
77+
'default-case-last': 'error',
78+
'default-param-last': 'error',
79+
'dot-notation': 'error',
80+
eqeqeq: 'error',
81+
'func-name-matching': 'error',
82+
'func-names': 'error',
83+
'func-style': 'error',
84+
'grouped-accessor-pairs': 'error',
85+
'guard-for-in': 'error',
86+
'id-denylist': 'error',
87+
'id-length': 'off',
88+
'id-match': 'error',
89+
'init-declarations': 'off',
90+
'logical-assignment-operators': 'error',
91+
'max-classes-per-file': 'off',
92+
'max-depth': 'error',
93+
'max-lines': 'off',
894
'max-lines-per-function': 'off',
95+
'max-nested-callbacks': 'error',
96+
'max-params': 'error',
997
'max-statements': 'off',
10-
'max-lines': 'off',
11-
'max-params': 'off',
12-
'max-classes-per-file': 'off',
13-
'id-length': 'off',
14-
'no-warning-comments': 'off',
15-
'no-ternary': 'off',
98+
'multiline-comment-style': 'off',
99+
'new-cap': 'off',
100+
'no-alert': 'error',
101+
'no-array-constructor': 'error',
102+
'no-bitwise': 'error',
103+
'no-caller': 'error',
104+
'no-case-declarations': 'error',
105+
'no-confusing-arrow': 'off', // conflicts with prettier
106+
'no-console': 'error',
16107
'no-continue': 'off',
17-
'no-undefined': 'off',
18-
'no-await-in-loop': 'off',
108+
'no-delete-var': 'error',
109+
'no-div-regex': 'error',
110+
'no-else-return': 'error',
111+
'no-empty': 'error',
112+
'no-empty-function': ['error', { allow: ['arrowFunctions'] }],
113+
'no-empty-static-block': 'error',
114+
'no-eq-null': 'error',
115+
'no-eval': 'error',
116+
'no-extend-native': 'error',
117+
'no-extra-bind': 'error',
118+
'no-extra-boolean-cast': 'error',
119+
'no-extra-label': 'error',
120+
'no-extra-semi': 'off', // conflicts with prettier
121+
'no-floating-decimal': 'off', // conflicts with prettier
122+
'no-global-assign': 'error',
123+
'no-implicit-coercion': 'error',
124+
'no-implicit-globals': 'error',
125+
'no-implied-eval': 'error',
126+
'no-inline-comments': 'off',
127+
'no-invalid-this': 'error',
128+
'no-iterator': 'error',
129+
'no-label-var': 'error',
130+
'no-labels': 'error',
131+
'no-lone-blocks': 'error',
132+
'no-lonely-if': 'error',
133+
'no-loop-func': 'error',
134+
'no-magic-numbers': 'off', // not sure about it
135+
'no-mixed-operators': 'off', // conflicts with prettier
136+
'no-multi-assign': 'error',
137+
'no-multi-str': 'error',
138+
'no-negated-condition': 'error',
139+
'no-nested-ternary': 'error',
140+
'no-new': 'error',
141+
'no-new-func': 'error',
142+
'no-new-object': 'error',
143+
'no-new-wrappers': 'error',
144+
'no-nonoctal-decimal-escape': 'error',
145+
'no-octal': 'error',
146+
'no-octal-escape': 'error',
147+
'no-param-reassign': 'error',
19148
'no-plusplus': 'off',
149+
'no-proto': 'error',
150+
'no-redeclare': 'error',
151+
'no-regex-spaces': 'error',
152+
'no-restricted-exports': 'error',
153+
'no-restricted-globals': 'error',
154+
'no-restricted-imports': 'error',
155+
'no-restricted-properties': 'error',
156+
'no-restricted-syntax': 'error',
157+
'no-return-assign': 'error',
158+
'no-return-await': 'error',
159+
'no-script-url': 'error',
160+
'no-sequences': 'error',
161+
'no-shadow': 'off',
162+
'no-shadow-restricted-names': 'error',
163+
'no-ternary': 'off',
164+
'no-throw-literal': 'error',
165+
'no-undef-init': 'error',
166+
'no-undefined': 'off',
167+
'no-underscore-dangle': 'error',
168+
'no-unneeded-ternary': 'error',
169+
'no-unused-expressions': 'error',
170+
'no-unused-labels': 'error',
171+
'no-useless-call': 'error',
172+
'no-useless-catch': 'error',
173+
'no-useless-computed-key': 'error',
174+
'no-useless-concat': 'error',
20175
'no-useless-constructor': 'off',
21-
'new-cap': 'off',
22-
camelcase: 'off',
23-
'capitalized-comments': 'off',
24-
'lines-between-class-members': 'off',
25-
'require-unicode-regexp': 'off',
26-
'init-declarations': 'off',
27-
'multiline-comment-style': 'off',
28-
'consistent-return': 'off',
176+
'no-useless-escape': 'error',
177+
'no-useless-rename': 'error',
178+
'no-useless-return': 'error',
179+
'no-var': 'error',
180+
'no-void': 'error',
181+
'no-warning-comments': 'off',
182+
'no-with': 'error',
183+
'object-shorthand': 'error',
184+
'one-var': ['error', 'never'],
185+
'one-var-declaration-per-line': 'off', // conflicts with prettier
186+
'operator-assignment': 'error',
187+
'prefer-arrow-callback': 'error',
188+
'prefer-const': 'error',
189+
'prefer-destructuring': 'error',
190+
'prefer-exponentiation-operator': 'error',
29191
'prefer-named-capture-group': 'off',
30-
'class-methods-use-this': 'off',
31-
'no-shadow': 'off',
32-
'no-empty-function': [
33-
'error',
34-
{
35-
allow: ['arrowFunctions'],
36-
},
37-
],
192+
'prefer-numeric-literals': 'error',
193+
'prefer-object-has-own': 'error',
194+
'prefer-object-spread': 'error',
195+
'prefer-promise-reject-errors': 'error',
196+
'prefer-regex-literals': 'error',
197+
'prefer-rest-params': 'error',
198+
'prefer-spread': 'error',
199+
'prefer-template': 'error',
200+
'quote-props': 'off', // conflicts with prettier
201+
radix: 'error',
202+
'require-await': 'error',
203+
'require-unicode-regexp': 'off', // not sure about it
204+
'require-yield': 'error',
205+
'sort-imports': 'off',
206+
'sort-keys': 'off',
207+
'sort-vars': 'off',
208+
'spaced-comment': 'error',
209+
strict: 'error',
210+
'symbol-description': 'error',
211+
'vars-on-top': 'error',
212+
yoda: 'error',
213+
214+
// Layout & formatting
215+
// it should be handled by prettier
38216
},
39217
};

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "0.9.0",
44
"description": "ESLint's configuration of Mobile Reality Team",
55
"engines": {
6-
"node": "^16.13 || ^18.15.0"
6+
"node": "^16.13.0 || ^18.15.0"
77
},
88
"repository": "https://github.com/MobileReality/eslint-config",
99
"author": "Mobile Reality <biuro@mobilereality.pl> (https://mobilereality.pl)",
@@ -55,7 +55,7 @@
5555
"peerDependencies": {
5656
"@typescript-eslint/eslint-plugin": "~5.31.0",
5757
"@typescript-eslint/parser": "~5.31.0",
58-
"eslint": "~8.20.0",
58+
"eslint": "^8.37.0",
5959
"eslint-plugin-jest": "^26.1.5",
6060
"eslint-plugin-jsx-a11y": "^6.5.1",
6161
"eslint-plugin-prettier": "^4.2.0",

0 commit comments

Comments
 (0)