Skip to content

Commit d16994e

Browse files
committed
fix(config): no-magic-number now ignores -1,0,1
1 parent 52c598d commit d16994e

File tree

2 files changed

+42
-9
lines changed

2 files changed

+42
-9
lines changed

.eslintrc

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"env":{
2+
"env": {
33
"es6": true
44
},
55
"rules": {
@@ -83,7 +83,14 @@
8383
"no-labels": 2,
8484
"no-lone-blocks": 2,
8585
"no-loop-func": 2,
86-
"no-magic-numbers": [2, {"ignoreArrayIndexes": true, "enforceConst": true }],
86+
"no-magic-numbers": [
87+
2,
88+
{
89+
"ignore": [0,1,-1],
90+
"ignoreArrayIndexes": true,
91+
"enforceConst": true
92+
}
93+
],
8794
"no-multi-spaces": 2,
8895
"no-multi-str": 2,
8996
"no-native-reassign": 2,
@@ -128,7 +135,13 @@
128135
"no-undef-init": 2,
129136
"no-undefined": 2,
130137
"no-unused-vars": 2,
131-
"no-use-before-define": [2, {"functions": false, "classes": true}],
138+
"no-use-before-define": [
139+
2,
140+
{
141+
"functions": false,
142+
"classes": true
143+
}
144+
],
132145
// node.js and commonjs
133146
"callback-return": 2,
134147
"global-require": 2,
@@ -177,15 +190,23 @@
177190
],
178191
"lines-around-comment": 2,
179192
"max-depth": 2,
180-
"max-len": [2, 120],
193+
"max-len": [
194+
2,
195+
120
196+
],
181197
"max-nested-callbacks": 2,
182198
"max-params": 2,
183199
"max-statements": 2,
184200
"new-cap": 2,
185201
"new-parens": 2,
186202
"newline-after-var": 2,
187203
"newline-before-return": 0,
188-
"newline-per-chained-call": [2, {"ignoreChainWithDepth": 3}],
204+
"newline-per-chained-call": [
205+
2,
206+
{
207+
"ignoreChainWithDepth": 3
208+
}
209+
],
189210
"no-array-constructor": 2,
190211
"no-bitwise": 2,
191212
"no-continue": 2,
@@ -223,22 +244,34 @@
223244
"keywords": true
224245
}
225246
],
226-
"quotes": [2, "single"],
247+
"quotes": [
248+
2,
249+
"single"
250+
],
227251
"require-jsdoc": 0,
228252
"semi": 2,
229253
"semi-spacing": 2,
230254
"sort-imports": 2,
231255
"sort-vars": 2,
232256
"space-before-blocks": 2,
233-
"space-before-function-paren": [2, { "anonymous": "always", "named": "never" }],
257+
"space-before-function-paren": [
258+
2,
259+
{
260+
"anonymous": "always",
261+
"named": "never"
262+
}
263+
],
234264
"space-in-parens": 2,
235265
"space-infix-ops": 2,
236266
"space-unary-ops": 2,
237267
"spaced-comment": 0,
238268
"wrap-regex": 0,
239269
// ECMAScript 6
240270
"arrow-body-style": 2,
241-
"arrow-parens": [2, "as-needed"],
271+
"arrow-parens": [
272+
2,
273+
"as-needed"
274+
],
242275
"arrow-spacing": 2,
243276
"constructor-super": 2,
244277
"generator-star-spacing": 2,

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
- `one-var` - `never` use one `var|let|const` per block
6666
- `padded-blocks` - `never` add useless padding
6767
- `quote-props` - quote properties only `as-needed` and `keywords`
68-
- `no-magic-numbers` - enabled `ignoreArrayIndexes` and `enforceConst`
68+
- `no-magic-numbers` - `ignore` `-1,0,1` as most often used numbers and `ignoreArrayIndexes`, `enforceConst` are enabled
6969

7070
## Contribution
7171
- what I really appreciate is configs for IDEs

0 commit comments

Comments
 (0)