Skip to content

Commit 5d9602c

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

File tree

12 files changed

+302
-302
lines changed

12 files changed

+302
-302
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ module.exports = {
99
sourceType: 'module',
1010
},
1111
rules: {
12-
strict: 2,
12+
strict: 'error',
1313
}
1414
};

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,59 +1,59 @@
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
29-
'dot-location': 0,
29+
'dot-location': 'off',
3030

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

3535
// make sure for-in loops have an if statement
36-
'guard-for-in': 2,
36+
'guard-for-in': 'error',
3737

3838
// disallow the use of alert, confirm, and prompt
39-
'no-alert': 1,
39+
'no-alert': 'warn',
4040

4141
// disallow use of arguments.caller or arguments.callee
42-
'no-caller': 2,
42+
'no-caller': 'error',
4343

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

4848
// disallow division operators explicitly at beginning of regular expression
49-
'no-div-regex': 0,
49+
'no-div-regex': 'off',
5050

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

5454
// disallow empty functions, except for standalone funcs/arrows
5555
// http://eslint.org/docs/rules/no-empty-function
56-
'no-empty-function': [2, {
56+
'no-empty-function': ['error', {
5757
allow: [
5858
'arrowFunctions',
5959
'functions',
@@ -63,161 +63,161 @@ module.exports = {
6363

6464
// disallow empty destructuring patterns
6565
// http://eslint.org/docs/rules/no-empty-pattern
66-
'no-empty-pattern': 2,
66+
'no-empty-pattern': 'error',
6767

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

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

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

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

8080
// disallow Unnecessary Labels
8181
// http://eslint.org/docs/rules/no-extra-label
82-
'no-extra-label': 2,
82+
'no-extra-label': 'error',
8383

8484
// disallow fallthrough of case statements
85-
'no-fallthrough': 2,
85+
'no-fallthrough': 'error',
8686

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

9090
// disallow the type conversions with shorter notations
91-
'no-implicit-coercion': 0,
91+
'no-implicit-coercion': 'off',
9292

9393
// disallow var and named functions in global scope
9494
// http://eslint.org/docs/rules/no-implicit-globals
95-
'no-implicit-globals': 0,
95+
'no-implicit-globals': 'off',
9696

9797
// disallow use of eval()-like methods
98-
'no-implied-eval': 2,
98+
'no-implied-eval': 'error',
9999

100100
// disallow this keywords outside of classes or class-like objects
101-
'no-invalid-this': 0,
101+
'no-invalid-this': 'off',
102102

103103
// disallow usage of __iterator__ property
104-
'no-iterator': 2,
104+
'no-iterator': 'error',
105105

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

109109
// disallow unnecessary nested blocks
110-
'no-lone-blocks': 2,
110+
'no-lone-blocks': 'error',
111111

112112
// disallow creation of functions within loops
113-
'no-loop-func': 2,
113+
'no-loop-func': 'error',
114114

115115
// disallow magic numbers
116116
// http://eslint.org/docs/rules/no-magic-numbers
117-
'no-magic-numbers': [0, {
117+
'no-magic-numbers': ['off', {
118118
ignore: [],
119119
ignoreArrayIndexes: true,
120120
enforceConst: true,
121121
detectObjects: false,
122122
}],
123123

124124
// disallow use of multiple spaces
125-
'no-multi-spaces': 2,
125+
'no-multi-spaces': 'error',
126126

127127
// disallow use of multiline strings
128-
'no-multi-str': 2,
128+
'no-multi-str': 'error',
129129

130130
// disallow reassignments of native objects
131-
'no-native-reassign': 2,
131+
'no-native-reassign': 'error',
132132

133133
// disallow use of new operator when not part of the assignment or comparison
134-
'no-new': 2,
134+
'no-new': 'error',
135135

136136
// disallow use of new operator for Function object
137-
'no-new-func': 2,
137+
'no-new-func': 'error',
138138

139139
// disallows creating new instances of String, Number, and Boolean
140-
'no-new-wrappers': 2,
140+
'no-new-wrappers': 'error',
141141

142142
// disallow use of (old style) octal literals
143-
'no-octal': 2,
143+
'no-octal': 'error',
144144

145145
// disallow use of octal escape sequences in string literals, such as
146146
// var foo = 'Copyright \251';
147-
'no-octal-escape': 2,
147+
'no-octal-escape': 'error',
148148

149149
// disallow reassignment of function parameters
150150
// disallow parameter object manipulation
151151
// rule: http://eslint.org/docs/rules/no-param-reassign.html
152-
'no-param-reassign': [2, { props: true }],
152+
'no-param-reassign': ['error', { props: true }],
153153

154154
// disallow usage of __proto__ property
155-
'no-proto': 2,
155+
'no-proto': 'error',
156156

157157
// disallow declaring the same variable more then once
158-
'no-redeclare': 2,
158+
'no-redeclare': 'error',
159159

160160
// disallow use of assignment in return statement
161-
'no-return-assign': 2,
161+
'no-return-assign': 'error',
162162

163163
// disallow use of `javascript:` urls.
164-
'no-script-url': 2,
164+
'no-script-url': 'error',
165165

166166
// disallow self assignment
167167
// http://eslint.org/docs/rules/no-self-assign
168-
'no-self-assign': 2,
168+
'no-self-assign': 'error',
169169

170170
// disallow comparisons where both sides are exactly the same
171-
'no-self-compare': 2,
171+
'no-self-compare': 'error',
172172

173173
// disallow use of comma operator
174-
'no-sequences': 2,
174+
'no-sequences': 'error',
175175

176176
// restrict what can be thrown as an exception
177-
'no-throw-literal': 2,
177+
'no-throw-literal': 'error',
178178

179179
// disallow unmodified conditions of loops
180180
// http://eslint.org/docs/rules/no-unmodified-loop-condition
181-
'no-unmodified-loop-condition': 0,
181+
'no-unmodified-loop-condition': 'off',
182182

183183
// disallow usage of expressions in statement position
184-
'no-unused-expressions': 2,
184+
'no-unused-expressions': 'error',
185185

186186
// disallow unused labels
187187
// http://eslint.org/docs/rules/no-unused-labels
188-
'no-unused-labels': 2,
188+
'no-unused-labels': 'error',
189189

190190
// disallow unnecessary .call() and .apply()
191-
'no-useless-call': 0,
191+
'no-useless-call': 'off',
192192

193193
// disallow useless string concatenation
194194
// http://eslint.org/docs/rules/no-useless-concat
195-
'no-useless-concat': 2,
195+
'no-useless-concat': 'error',
196196

197197
// disallow unnecessary string escaping
198198
// http://eslint.org/docs/rules/no-useless-escape
199-
'no-useless-escape': 2,
199+
'no-useless-escape': 'error',
200200

201201
// disallow use of void operator
202-
'no-void': 0,
202+
'no-void': 'off',
203203

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

207207
// disallow use of the with statement
208-
'no-with': 2,
208+
'no-with': 'error',
209209

210210
// require use of the second argument for parseInt()
211-
radix: 2,
211+
radix: 'error',
212212

213213
// requires to declare all vars on top of their containing scope
214-
'vars-on-top': 2,
214+
'vars-on-top': 'error',
215215

216216
// require immediate function invocation to be wrapped in parentheses
217217
// http://eslint.org/docs/rules/wrap-iife.html
218-
'wrap-iife': [2, 'outside'],
218+
'wrap-iife': ['error', 'outside'],
219219

220220
// require or disallow Yoda conditions
221-
yoda: 2
221+
yoda: 'error'
222222
}
223223
};

0 commit comments

Comments
 (0)