Skip to content

Commit 2e69472

Browse files
author
Yang Su
committed
Changed ESLint rule configs to use 'off', 'warn', and 'error' instead of numbers for better readability
1 parent f1fedfa commit 2e69472

File tree

12 files changed

+324
-324
lines changed

12 files changed

+324
-324
lines changed

packages/eslint-config-airbnb-base/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ module.exports = {
1313
sourceType: 'module',
1414
},
1515
rules: {
16-
strict: 2,
16+
strict: 'error',
1717
}
1818
};

packages/eslint-config-airbnb-base/legacy.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ module.exports = {
1616
ecmaFeatures: {},
1717
globals: {},
1818
rules: {
19-
'comma-dangle': [2, 'never']
19+
'comma-dangle': ['error', 'never']
2020
}
2121
};
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,61 @@
11
module.exports = {
22
rules: {
33
// enforces getter/setter pairs in objects
4-
'accessor-pairs': 0,
4+
'accessor-pairs': 'off',
55

66
// enforces return statements in callbacks of array's methods
77
// http://eslint.org/docs/rules/array-callback-return
8-
'array-callback-return': 2,
8+
'array-callback-return': 'error',
99

1010
// treat var statements as if they were block scoped
11-
'block-scoped-var': 2,
11+
'block-scoped-var': 'error',
1212

1313
// specify the maximum cyclomatic complexity allowed in a program
14-
complexity: [0, 11],
14+
complexity: ['off', 11],
1515

1616
// require return statements to either always or never specify values
17-
'consistent-return': 2,
17+
'consistent-return': 'error',
1818

1919
// specify curly brace conventions for all control statements
20-
curly: [2, 'multi-line'],
20+
curly: ['error', 'multi-line'],
2121

2222
// require default case in switch statements
23-
'default-case': [2, { commentPattern: '^no default$' }],
23+
'default-case': ['error', { commentPattern: '^no default$' }],
2424

2525
// encourages use of dot notation whenever possible
26-
'dot-notation': [2, { allowKeywords: true }],
26+
'dot-notation': ['error', { allowKeywords: true }],
2727

2828
// enforces consistent newlines before or after dots
2929
// http://eslint.org/docs/rules/dot-location
30-
'dot-location': [2, 'property'],
30+
'dot-location': ['error', 'property'],
3131

3232
// require the use of === and !==
3333
// http://eslint.org/docs/rules/eqeqeq
34-
eqeqeq: [2, 'allow-null'],
34+
eqeqeq: ['error', 'allow-null'],
3535

3636
// make sure for-in loops have an if statement
37-
'guard-for-in': 2,
37+
'guard-for-in': 'error',
3838

3939
// disallow the use of alert, confirm, and prompt
40-
'no-alert': 1,
40+
'no-alert': 'warn',
4141

4242
// disallow use of arguments.caller or arguments.callee
43-
'no-caller': 2,
43+
'no-caller': 'error',
4444

4545
// disallow lexical declarations in case/default clauses
4646
// http://eslint.org/docs/rules/no-case-declarations.html
47-
'no-case-declarations': 2,
47+
'no-case-declarations': 'error',
4848

4949
// disallow division operators explicitly at beginning of regular expression
5050
// http://eslint.org/docs/rules/no-div-regex
51-
'no-div-regex': 0,
51+
'no-div-regex': 'off',
5252

5353
// disallow else after a return in an if
54-
'no-else-return': 2,
54+
'no-else-return': 'error',
5555

5656
// disallow empty functions, except for standalone funcs/arrows
5757
// http://eslint.org/docs/rules/no-empty-function
58-
'no-empty-function': [2, {
58+
'no-empty-function': ['error', {
5959
allow: [
6060
'arrowFunctions',
6161
'functions',
@@ -65,37 +65,37 @@ module.exports = {
6565

6666
// disallow empty destructuring patterns
6767
// http://eslint.org/docs/rules/no-empty-pattern
68-
'no-empty-pattern': 2,
68+
'no-empty-pattern': 'error',
6969

7070
// disallow comparisons to null without a type-checking operator
71-
'no-eq-null': 0,
71+
'no-eq-null': 'off',
7272

7373
// disallow use of eval()
74-
'no-eval': 2,
74+
'no-eval': 'error',
7575

7676
// disallow adding to native types
77-
'no-extend-native': 2,
77+
'no-extend-native': 'error',
7878

7979
// disallow unnecessary function binding
80-
'no-extra-bind': 2,
80+
'no-extra-bind': 'error',
8181

8282
// disallow Unnecessary Labels
8383
// http://eslint.org/docs/rules/no-extra-label
84-
'no-extra-label': 2,
84+
'no-extra-label': 'error',
8585

8686
// disallow fallthrough of case statements
87-
'no-fallthrough': 2,
87+
'no-fallthrough': 'error',
8888

8989
// disallow the use of leading or trailing decimal points in numeric literals
90-
'no-floating-decimal': 2,
90+
'no-floating-decimal': 'error',
9191

9292
// disallow reassignments of native objects or read-only globals
9393
// http://eslint.org/docs/rules/no-global-assign
94-
'no-global-assign': [2, { exceptions: [] }],
94+
'no-global-assign': ['error', { exceptions: [] }],
9595

9696
// disallow implicit type conversions
9797
// http://eslint.org/docs/rules/no-implicit-coercion
98-
'no-implicit-coercion': [0, {
98+
'no-implicit-coercion': ['off', {
9999
boolean: false,
100100
number: true,
101101
string: true,
@@ -104,137 +104,137 @@ module.exports = {
104104

105105
// disallow var and named functions in global scope
106106
// http://eslint.org/docs/rules/no-implicit-globals
107-
'no-implicit-globals': 0,
107+
'no-implicit-globals': 'off',
108108

109109
// disallow use of eval()-like methods
110-
'no-implied-eval': 2,
110+
'no-implied-eval': 'error',
111111

112112
// disallow this keywords outside of classes or class-like objects
113-
'no-invalid-this': 0,
113+
'no-invalid-this': 'off',
114114

115115
// disallow usage of __iterator__ property
116-
'no-iterator': 2,
116+
'no-iterator': 'error',
117117

118118
// disallow use of labels for anything other then loops and switches
119-
'no-labels': [2, { allowLoop: false, allowSwitch: false }],
119+
'no-labels': ['error', { allowLoop: false, allowSwitch: false }],
120120

121121
// disallow unnecessary nested blocks
122-
'no-lone-blocks': 2,
122+
'no-lone-blocks': 'error',
123123

124124
// disallow creation of functions within loops
125-
'no-loop-func': 2,
125+
'no-loop-func': 'error',
126126

127127
// disallow magic numbers
128128
// http://eslint.org/docs/rules/no-magic-numbers
129-
'no-magic-numbers': [0, {
129+
'no-magic-numbers': ['off', {
130130
ignore: [],
131131
ignoreArrayIndexes: true,
132132
enforceConst: true,
133133
detectObjects: false,
134134
}],
135135

136136
// disallow use of multiple spaces
137-
'no-multi-spaces': 2,
137+
'no-multi-spaces': 'error',
138138

139139
// disallow use of multiline strings
140-
'no-multi-str': 2,
140+
'no-multi-str': 'error',
141141

142142
// disallow reassignments of native objects
143143
// TODO: deprecated in favor of no-global-assign
144-
'no-native-reassign': 0,
144+
'no-native-reassign': 'off',
145145

146146
// disallow use of new operator when not part of the assignment or comparison
147-
'no-new': 2,
147+
'no-new': 'error',
148148

149149
// disallow use of new operator for Function object
150-
'no-new-func': 2,
150+
'no-new-func': 'error',
151151

152152
// disallows creating new instances of String, Number, and Boolean
153-
'no-new-wrappers': 2,
153+
'no-new-wrappers': 'error',
154154

155155
// disallow use of (old style) octal literals
156-
'no-octal': 2,
156+
'no-octal': 'error',
157157

158158
// disallow use of octal escape sequences in string literals, such as
159159
// var foo = 'Copyright \251';
160-
'no-octal-escape': 2,
160+
'no-octal-escape': 'error',
161161

162162
// disallow reassignment of function parameters
163163
// disallow parameter object manipulation
164164
// rule: http://eslint.org/docs/rules/no-param-reassign.html
165-
'no-param-reassign': [2, { props: true }],
165+
'no-param-reassign': ['error', { props: true }],
166166

167167
// disallow usage of __proto__ property
168-
'no-proto': 2,
168+
'no-proto': 'error',
169169

170170
// disallow declaring the same variable more then once
171-
'no-redeclare': 2,
171+
'no-redeclare': 'error',
172172

173173
// disallow use of assignment in return statement
174-
'no-return-assign': 2,
174+
'no-return-assign': 'error',
175175

176176
// disallow use of `javascript:` urls.
177-
'no-script-url': 2,
177+
'no-script-url': 'error',
178178

179179
// disallow self assignment
180180
// http://eslint.org/docs/rules/no-self-assign
181-
'no-self-assign': 2,
181+
'no-self-assign': 'error',
182182

183183
// disallow comparisons where both sides are exactly the same
184-
'no-self-compare': 2,
184+
'no-self-compare': 'error',
185185

186186
// disallow use of comma operator
187-
'no-sequences': 2,
187+
'no-sequences': 'error',
188188

189189
// restrict what can be thrown as an exception
190-
'no-throw-literal': 2,
190+
'no-throw-literal': 'error',
191191

192192
// disallow unmodified conditions of loops
193193
// http://eslint.org/docs/rules/no-unmodified-loop-condition
194-
'no-unmodified-loop-condition': 0,
194+
'no-unmodified-loop-condition': 'off',
195195

196196
// disallow usage of expressions in statement position
197-
'no-unused-expressions': [2, {
197+
'no-unused-expressions': ['error', {
198198
allowShortCircuit: false,
199199
allowTernary: false,
200200
}],
201201

202202
// disallow unused labels
203203
// http://eslint.org/docs/rules/no-unused-labels
204-
'no-unused-labels': 2,
204+
'no-unused-labels': 'error',
205205

206206
// disallow unnecessary .call() and .apply()
207-
'no-useless-call': 0,
207+
'no-useless-call': 'off',
208208

209209
// disallow useless string concatenation
210210
// http://eslint.org/docs/rules/no-useless-concat
211-
'no-useless-concat': 2,
211+
'no-useless-concat': 'error',
212212

213213
// disallow unnecessary string escaping
214214
// http://eslint.org/docs/rules/no-useless-escape
215-
'no-useless-escape': 2,
215+
'no-useless-escape': 'error',
216216

217217
// disallow use of void operator
218218
// http://eslint.org/docs/rules/no-void
219-
'no-void': 2,
219+
'no-void': 'error',
220220

221221
// disallow usage of configurable warning terms in comments: e.g. todo
222-
'no-warning-comments': [0, { terms: ['todo', 'fixme', 'xxx'], location: 'start' }],
222+
'no-warning-comments': ['off', { terms: ['todo', 'fixme', 'xxx'], location: 'start' }],
223223

224224
// disallow use of the with statement
225-
'no-with': 2,
225+
'no-with': 'error',
226226

227227
// require use of the second argument for parseInt()
228-
radix: 2,
228+
radix: 'error',
229229

230230
// requires to declare all vars on top of their containing scope
231-
'vars-on-top': 2,
231+
'vars-on-top': 'error',
232232

233233
// require immediate function invocation to be wrapped in parentheses
234234
// http://eslint.org/docs/rules/wrap-iife.html
235-
'wrap-iife': [2, 'outside'],
235+
'wrap-iife': ['error', 'outside'],
236236

237237
// require or disallow Yoda conditions
238-
yoda: 2
238+
yoda: 'error'
239239
}
240240
};

0 commit comments

Comments
 (0)