mirror of
https://github.com/airbnb/javascript.git
synced 2026-01-13 21:38:03 -05:00
[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`
This commit is contained in:
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -101,6 +102,8 @@ 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
|
||||
@@ -108,6 +111,7 @@ module.exports = {
|
||||
'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
|
||||
@@ -115,7 +119,8 @@ module.exports = {
|
||||
'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
|
||||
|
||||
@@ -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,
|
||||
@@ -33,6 +34,6 @@ module.exports = {
|
||||
'no-restricted-modules': 0,
|
||||
|
||||
// disallow use of synchronous methods (off by default)
|
||||
'no-sync': 0
|
||||
'no-sync': 0,
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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,
|
||||
@@ -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,
|
||||
@@ -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
|
||||
@@ -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,
|
||||
@@ -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', {
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user