Skip to content

Commit ca9c322

Browse files
committed
[eslint config] [base] [breaking] enable overlooked rules:
- `linebreak-style` - `new-parens` - `no-continue` - `no-lonely-if` - `operator-assignment` - `space-unary-ops` - `dot-location` - `no-extra-boolean-cast` - `no-this-before-super` - `require-yield` - `no-path-concat` - `no-label-var`
1 parent 762177e commit ca9c322

File tree

6 files changed

+48
-15
lines changed

6 files changed

+48
-15
lines changed

packages/eslint-config-airbnb-base/rules/best-practices.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ module.exports = {
2626
'dot-notation': [2, { allowKeywords: true }],
2727

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

3132
// require the use of === and !==
3233
// http://eslint.org/docs/rules/eqeqeq
@@ -46,6 +47,7 @@ module.exports = {
4647
'no-case-declarations': 2,
4748

4849
// disallow division operators explicitly at beginning of regular expression
50+
// http://eslint.org/docs/rules/no-div-regex
4951
'no-div-regex': 0,
5052

5153
// disallow else after a return in an if
@@ -87,8 +89,14 @@ module.exports = {
8789
// disallow the use of leading or trailing decimal points in numeric literals
8890
'no-floating-decimal': 2,
8991

90-
// disallow the type conversions with shorter notations
91-
'no-implicit-coercion': 0,
92+
// disallow implicit type conversions
93+
// http://eslint.org/docs/rules/no-implicit-coercion
94+
'no-implicit-coercion': [0, {
95+
boolean: false,
96+
number: true,
97+
string: true,
98+
allow: [],
99+
}],
92100

93101
// disallow var and named functions in global scope
94102
// http://eslint.org/docs/rules/no-implicit-globals
@@ -199,6 +207,8 @@ module.exports = {
199207
'no-useless-escape': 2,
200208

201209
// disallow use of void operator
210+
// http://eslint.org/docs/rules/no-void
211+
// TODO: enable
202212
'no-void': 0,
203213

204214
// disallow usage of configurable warning terms in comments: e.g. todo

packages/eslint-config-airbnb-base/rules/errors.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ module.exports = {
3737
'no-ex-assign': 2,
3838

3939
// disallow double-negation boolean casts in a boolean context
40-
'no-extra-boolean-cast': 0,
40+
// http://eslint.org/docs/rules/no-extra-boolean-cast
41+
'no-extra-boolean-cast': 2,
4142

4243
// disallow unnecessary parentheses
4344
// http://eslint.org/docs/rules/no-extra-parens
@@ -79,6 +80,8 @@ module.exports = {
7980
'no-sparse-arrays': 2,
8081

8182
// Avoid code that looks like two expressions but is actually one
83+
// http://eslint.org/docs/rules/no-unexpected-multiline
84+
// TODO: enable?
8285
'no-unexpected-multiline': 0,
8386

8487
// disallow unreachable statements after a return, throw, continue, or break statement

packages/eslint-config-airbnb-base/rules/es6.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ module.exports = {
6060
'no-restricted-imports': 0,
6161

6262
// disallow to use this/super before super() calling in constructors.
63-
'no-this-before-super': 0,
63+
// http://eslint.org/docs/rules/no-this-before-super
64+
'no-this-before-super': 2,
6465

6566
// disallow useless computed property keys
6667
// http://eslint.org/docs/rules/no-useless-computed-key
@@ -101,21 +102,25 @@ module.exports = {
101102
}],
102103

103104
// suggest using Reflect methods where applicable
105+
// http://eslint.org/docs/rules/prefer-reflect
106+
// TODO: enable
104107
'prefer-reflect': 0,
105108

106109
// use rest parameters instead of arguments
107110
// http://eslint.org/docs/rules/prefer-rest-params
108111
'prefer-rest-params': 2,
109112

110113
// suggest using the spread operator instead of .apply()
114+
// http://eslint.org/docs/rules/prefer-spread
111115
'prefer-spread': 0,
112116

113117
// suggest using template literals instead of string concatenation
114118
// http://eslint.org/docs/rules/prefer-template
115119
'prefer-template': 2,
116120

117121
// disallow generator functions that do not have yield
118-
'require-yield': 0,
122+
// http://eslint.org/docs/rules/require-yield
123+
'require-yield': 2,
119124

120125
// enforce spacing between object rest-spread
121126
// http://eslint.org/docs/rules/rest-spread-spacing

packages/eslint-config-airbnb-base/rules/node.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ module.exports = {
2121
'no-new-require': 0,
2222

2323
// disallow string concatenation with __dirname and __filename
24-
'no-path-concat': 0,
24+
// http://eslint.org/docs/rules/no-path-concat
25+
'no-path-concat': 2,
2526

2627
// disallow use of process.env
2728
'no-process-env': 0,
@@ -33,6 +34,6 @@ module.exports = {
3334
'no-restricted-modules': 0,
3435

3536
// disallow use of synchronous methods (off by default)
36-
'no-sync': 0
37+
'no-sync': 0,
3738
}
3839
};

packages/eslint-config-airbnb-base/rules/style.js

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ module.exports = {
6868
}],
6969

7070
// disallow mixed 'LF' and 'CRLF' as linebreaks
71-
'linebreak-style': 0,
71+
// http://eslint.org/docs/rules/linebreak-style
72+
'linebreak-style': [2, 'unix'],
7273

7374
// enforces empty lines around comments
7475
'lines-around-comment': 0,
@@ -108,7 +109,8 @@ module.exports = {
108109
'new-cap': [2, { newIsCap: true }],
109110

110111
// disallow the omission of parentheses when invoking a constructor with no arguments
111-
'new-parens': 0,
112+
// http://eslint.org/docs/rules/new-parens
113+
'new-parens': 2,
112114

113115
// allow/disallow an empty newline after var statement
114116
'newline-after-var': 0,
@@ -125,16 +127,20 @@ module.exports = {
125127
'no-array-constructor': 2,
126128

127129
// disallow use of bitwise operators
130+
// http://eslint.org/docs/rules/no-bitwise
131+
// TODO: enable
128132
'no-bitwise': 0,
129133

130134
// disallow use of the continue statement
131-
'no-continue': 0,
135+
// http://eslint.org/docs/rules/no-continue
136+
'no-continue': 2,
132137

133138
// disallow comments inline after code
134139
'no-inline-comments': 0,
135140

136141
// disallow if as the only statement in an else block
137-
'no-lonely-if': 0,
142+
// http://eslint.org/docs/rules/no-lonely-if
143+
'no-lonely-if': 2,
138144

139145
// disallow un-paren'd mixes of different operators
140146
// http://eslint.org/docs/rules/no-mixed-operators
@@ -224,7 +230,8 @@ module.exports = {
224230
'one-var-declaration-per-line': [2, 'always'],
225231

226232
// require assignment operator shorthand where possible or prohibit it entirely
227-
'operator-assignment': 0,
233+
// http://eslint.org/docs/rules/operator-assignment
234+
'operator-assignment': [2, 'always'],
228235

229236
// enforce operators to be placed before or after line breaks
230237
'operator-linebreak': 0,
@@ -266,7 +273,13 @@ module.exports = {
266273
'space-infix-ops': 2,
267274

268275
// Require or disallow spaces before/after unary operators
269-
'space-unary-ops': 0,
276+
// http://eslint.org/docs/rules/space-unary-ops
277+
'space-unary-ops': [2, {
278+
words: true,
279+
nonwords: false,
280+
overrides: {
281+
},
282+
}],
270283

271284
// require or disallow a space immediately following the // or /* in a comment
272285
'spaced-comment': [2, 'always', {

packages/eslint-config-airbnb-base/rules/variables.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ module.exports = {
1010
'no-delete-var': 2,
1111

1212
// disallow labels that share a name with a variable
13-
'no-label-var': 0,
13+
// http://eslint.org/docs/rules/no-label-var
14+
'no-label-var': 2,
1415

1516
// disallow specific globals
1617
'no-restricted-globals': 0,

0 commit comments

Comments
 (0)