Skip to content

Commit

Permalink
[eslint config] [base] [breaking] enable overlooked rules:
Browse files Browse the repository at this point in the history
 - `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`
  • Loading branch information
ljharb authored and hibearpanda committed Jan 22, 2017
1 parent cb8cbb5 commit a3bea85
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 15 deletions.
16 changes: 13 additions & 3 deletions packages/eslint-config-airbnb-base/rules/best-practices.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ module.exports = {
'dot-notation': [2, { allowKeywords: true }],

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

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

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

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

// disallow the type conversions with shorter notations
'no-implicit-coercion': 0,
// disallow implicit type conversions
// http://eslint.org/docs/rules/no-implicit-coercion
'no-implicit-coercion': [0, {
boolean: false,
number: true,
string: true,
allow: [],
}],

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

// disallow use of void operator
// http://eslint.org/docs/rules/no-void
// TODO: enable
'no-void': 0,

// disallow usage of configurable warning terms in comments: e.g. todo
Expand Down
5 changes: 4 additions & 1 deletion packages/eslint-config-airbnb-base/rules/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ module.exports = {
'no-ex-assign': 2,

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

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

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

// disallow unreachable statements after a return, throw, continue, or break statement
Expand Down
9 changes: 7 additions & 2 deletions packages/eslint-config-airbnb-base/rules/es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ module.exports = {
'no-restricted-imports': 0,

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

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

// suggest using Reflect methods where applicable
// http://eslint.org/docs/rules/prefer-reflect
// TODO: enable
'prefer-reflect': 0,

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

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

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

// disallow generator functions that do not have yield
'require-yield': 0,
// http://eslint.org/docs/rules/require-yield
'require-yield': 2,

// enforce spacing between object rest-spread
// http://eslint.org/docs/rules/rest-spread-spacing
Expand Down
5 changes: 3 additions & 2 deletions packages/eslint-config-airbnb-base/rules/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ module.exports = {
'no-new-require': 0,

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

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

// disallow use of synchronous methods (off by default)
'no-sync': 0
'no-sync': 0,
}
};
25 changes: 19 additions & 6 deletions packages/eslint-config-airbnb-base/rules/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ module.exports = {
}],

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

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

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

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

// disallow use of bitwise operators
// http://eslint.org/docs/rules/no-bitwise
// TODO: enable
'no-bitwise': 0,

// disallow use of the continue statement
'no-continue': 0,
// http://eslint.org/docs/rules/no-continue
'no-continue': 2,

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

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

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

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

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

// Require or disallow spaces before/after unary operators
'space-unary-ops': 0,
// http://eslint.org/docs/rules/space-unary-ops
'space-unary-ops': [2, {
words: true,
nonwords: false,
overrides: {
},
}],

// require or disallow a space immediately following the // or /* in a comment
'spaced-comment': [2, 'always', {
Expand Down
3 changes: 2 additions & 1 deletion packages/eslint-config-airbnb-base/rules/variables.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ module.exports = {
'no-delete-var': 2,

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

// disallow specific globals
'no-restricted-globals': 0,
Expand Down

0 comments on commit a3bea85

Please sign in to comment.