Skip to content

Commit c7ba1c3

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

File tree

12 files changed

+303
-303
lines changed

12 files changed

+303
-303
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,33 +65,33 @@ 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 implicit type conversions
9393
// http://eslint.org/docs/rules/no-implicit-coercion
94-
'no-implicit-coercion': [0, {
94+
'no-implicit-coercion': ['off', {
9595
boolean: false,
9696
number: true,
9797
string: true,
@@ -100,136 +100,136 @@ module.exports = {
100100

101101
// disallow var and named functions in global scope
102102
// http://eslint.org/docs/rules/no-implicit-globals
103-
'no-implicit-globals': 0,
103+
'no-implicit-globals': 'off',
104104

105105
// disallow use of eval()-like methods
106-
'no-implied-eval': 2,
106+
'no-implied-eval': 'error',
107107

108108
// disallow this keywords outside of classes or class-like objects
109-
'no-invalid-this': 0,
109+
'no-invalid-this': 'off',
110110

111111
// disallow usage of __iterator__ property
112-
'no-iterator': 2,
112+
'no-iterator': 'error',
113113

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

117117
// disallow unnecessary nested blocks
118-
'no-lone-blocks': 2,
118+
'no-lone-blocks': 'error',
119119

120120
// disallow creation of functions within loops
121-
'no-loop-func': 2,
121+
'no-loop-func': 'error',
122122

123123
// disallow magic numbers
124124
// http://eslint.org/docs/rules/no-magic-numbers
125-
'no-magic-numbers': [0, {
125+
'no-magic-numbers': ['off', {
126126
ignore: [],
127127
ignoreArrayIndexes: true,
128128
enforceConst: true,
129129
detectObjects: false,
130130
}],
131131

132132
// disallow use of multiple spaces
133-
'no-multi-spaces': 2,
133+
'no-multi-spaces': 'error',
134134

135135
// disallow use of multiline strings
136-
'no-multi-str': 2,
136+
'no-multi-str': 'error',
137137

138138
// disallow reassignments of native objects
139-
'no-native-reassign': 2,
139+
'no-native-reassign': 'error',
140140

141141
// disallow use of new operator when not part of the assignment or comparison
142-
'no-new': 2,
142+
'no-new': 'error',
143143

144144
// disallow use of new operator for Function object
145-
'no-new-func': 2,
145+
'no-new-func': 'error',
146146

147147
// disallows creating new instances of String, Number, and Boolean
148-
'no-new-wrappers': 2,
148+
'no-new-wrappers': 'error',
149149

150150
// disallow use of (old style) octal literals
151-
'no-octal': 2,
151+
'no-octal': 'error',
152152

153153
// disallow use of octal escape sequences in string literals, such as
154154
// var foo = 'Copyright \251';
155-
'no-octal-escape': 2,
155+
'no-octal-escape': 'error',
156156

157157
// disallow reassignment of function parameters
158158
// disallow parameter object manipulation
159159
// rule: http://eslint.org/docs/rules/no-param-reassign.html
160-
'no-param-reassign': [2, { props: true }],
160+
'no-param-reassign': ['error', { props: true }],
161161

162162
// disallow usage of __proto__ property
163-
'no-proto': 2,
163+
'no-proto': 'error',
164164

165165
// disallow declaring the same variable more then once
166-
'no-redeclare': 2,
166+
'no-redeclare': 'error',
167167

168168
// disallow use of assignment in return statement
169-
'no-return-assign': 2,
169+
'no-return-assign': 'error',
170170

171171
// disallow use of `javascript:` urls.
172-
'no-script-url': 2,
172+
'no-script-url': 'error',
173173

174174
// disallow self assignment
175175
// http://eslint.org/docs/rules/no-self-assign
176-
'no-self-assign': 2,
176+
'no-self-assign': 'error',
177177

178178
// disallow comparisons where both sides are exactly the same
179-
'no-self-compare': 2,
179+
'no-self-compare': 'error',
180180

181181
// disallow use of comma operator
182-
'no-sequences': 2,
182+
'no-sequences': 'error',
183183

184184
// restrict what can be thrown as an exception
185-
'no-throw-literal': 2,
185+
'no-throw-literal': 'error',
186186

187187
// disallow unmodified conditions of loops
188188
// http://eslint.org/docs/rules/no-unmodified-loop-condition
189-
'no-unmodified-loop-condition': 0,
189+
'no-unmodified-loop-condition': 'off',
190190

191191
// disallow usage of expressions in statement position
192-
'no-unused-expressions': [2, {
192+
'no-unused-expressions': ['error', {
193193
allowShortCircuit: false,
194194
allowTernary: false,
195195
}],
196196

197197
// disallow unused labels
198198
// http://eslint.org/docs/rules/no-unused-labels
199-
'no-unused-labels': 2,
199+
'no-unused-labels': 'error',
200200

201201
// disallow unnecessary .call() and .apply()
202-
'no-useless-call': 0,
202+
'no-useless-call': 'off',
203203

204204
// disallow useless string concatenation
205205
// http://eslint.org/docs/rules/no-useless-concat
206-
'no-useless-concat': 2,
206+
'no-useless-concat': 'error',
207207

208208
// disallow unnecessary string escaping
209209
// http://eslint.org/docs/rules/no-useless-escape
210-
'no-useless-escape': 2,
210+
'no-useless-escape': 'error',
211211

212212
// disallow use of void operator
213213
// http://eslint.org/docs/rules/no-void
214-
'no-void': 2,
214+
'no-void': 'error',
215215

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

219219
// disallow use of the with statement
220-
'no-with': 2,
220+
'no-with': 'error',
221221

222222
// require use of the second argument for parseInt()
223-
radix: 2,
223+
radix: 'error',
224224

225225
// requires to declare all vars on top of their containing scope
226-
'vars-on-top': 2,
226+
'vars-on-top': 'error',
227227

228228
// require immediate function invocation to be wrapped in parentheses
229229
// http://eslint.org/docs/rules/wrap-iife.html
230-
'wrap-iife': [2, 'outside'],
230+
'wrap-iife': ['error', 'outside'],
231231

232232
// require or disallow Yoda conditions
233-
yoda: 2
233+
yoda: 'error'
234234
}
235235
};

0 commit comments

Comments
 (0)