mirror of
https://github.com/airbnb/javascript.git
synced 2026-01-13 22:38:08 -05:00
[eslint config] [base] [deps] [breaking] require eslint v4
- enable `function-paren-newline`, `for-direction`, `getter-return`, `no-compare-neg-zero`, `semi-style`, `object-curly-newline`, `no-buffer-constructor`, `no-restricted-globals`, `switch-colon-spacing`, `template-tag-spacing`, `prefer-promise-reject-errors`, `prefer-restructuring` - improve `indent`, `no-multi-spaces`, `no-trailing-spaces`, `no-underscore-dangle`
This commit is contained in:
@@ -19,7 +19,6 @@ env:
|
||||
matrix:
|
||||
- 'TEST=true ESLINT=3 PACKAGE=eslint-config-airbnb'
|
||||
- 'TEST=true ESLINT=4 PACKAGE=eslint-config-airbnb'
|
||||
- 'TEST=true ESLINT=3 PACKAGE=eslint-config-airbnb-base'
|
||||
- 'TEST=true ESLINT=4 PACKAGE=eslint-config-airbnb-base'
|
||||
matrix:
|
||||
fast_finish: true
|
||||
@@ -28,8 +27,6 @@ matrix:
|
||||
env: PREPUBLISH=true ESLINT=3 PACKAGE=eslint-config-airbnb
|
||||
- node_js: "node"
|
||||
env: PREPUBLISH=true ESLINT=4 PACKAGE=eslint-config-airbnb
|
||||
- node_js: "node"
|
||||
env: PREPUBLISH=true ESLINT=3 PACKAGE=eslint-config-airbnb-base
|
||||
- node_js: "node"
|
||||
env: PREPUBLISH=true ESLINT=4 PACKAGE=eslint-config-airbnb-base
|
||||
allow_failures:
|
||||
@@ -37,5 +34,4 @@ matrix:
|
||||
- node_js: "5"
|
||||
- env: PREPUBLISH=true ESLINT=3 PACKAGE=eslint-config-airbnb
|
||||
- env: PREPUBLISH=true ESLINT=4 PACKAGE=eslint-config-airbnb
|
||||
- env: PREPUBLISH=true ESLINT=3 PACKAGE=eslint-config-airbnb-base
|
||||
- env: PREPUBLISH=true ESLINT=4 PACKAGE=eslint-config-airbnb-base
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
"babel-preset-airbnb": "^2.4.0",
|
||||
"babel-tape-runner": "^2.0.1",
|
||||
"editorconfig-tools": "^0.1.1",
|
||||
"eslint": "^4.5.0",
|
||||
"eslint": "^4.6.0",
|
||||
"eslint-find-rules": "^3.1.1",
|
||||
"eslint-plugin-import": "^2.7.0",
|
||||
"in-publish": "^2.0.0",
|
||||
@@ -59,7 +59,7 @@
|
||||
"tape": "^4.8.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"eslint": "^3.19.0 || ^4.5.0",
|
||||
"eslint": "^4.6.0",
|
||||
"eslint-plugin-import": "^2.7.0"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
@@ -143,7 +143,7 @@ module.exports = {
|
||||
|
||||
// disallow use of multiple spaces
|
||||
'no-multi-spaces': ['error', {
|
||||
// ignoreEOLComments: false, // TODO: uncomment once v3 is dropped
|
||||
ignoreEOLComments: false,
|
||||
}],
|
||||
|
||||
// disallow use of multiline strings
|
||||
@@ -294,8 +294,7 @@ module.exports = {
|
||||
|
||||
// require using Error objects as Promise rejection reasons
|
||||
// http://eslint.org/docs/rules/prefer-promise-reject-errors
|
||||
// TODO: enable, semver-major
|
||||
'prefer-promise-reject-errors': ['off', { allowEmptyReject: true }],
|
||||
'prefer-promise-reject-errors': ['error', { allowEmptyReject: true }],
|
||||
|
||||
// require use of the second argument for parseInt()
|
||||
radix: 'error',
|
||||
|
||||
@@ -2,13 +2,11 @@ module.exports = {
|
||||
rules: {
|
||||
// Enforce “for” loop update clause moving the counter in the right direction
|
||||
// http://eslint.org/docs/rules/for-direction
|
||||
// TODO: enable, semver-major until v3 is dropped; semver-minor otherwise
|
||||
'for-direction': 'off',
|
||||
'for-direction': 'error',
|
||||
|
||||
// Enforces that a return statement is present in property getters
|
||||
// http://eslint.org/docs/rules/getter-return
|
||||
// TODO: enable, semver-major when v3 is dropped
|
||||
'getter-return': ['off', { allowImplicit: true }],
|
||||
'getter-return': ['error', { allowImplicit: true }],
|
||||
|
||||
// Disallow await inside of loops
|
||||
// http://eslint.org/docs/rules/no-await-in-loop
|
||||
@@ -16,8 +14,7 @@ module.exports = {
|
||||
|
||||
// Disallow comparisons to negative zero
|
||||
// http://eslint.org/docs/rules/no-compare-neg-zero
|
||||
// TODO: enable (semver-major)
|
||||
'no-compare-neg-zero': 'off',
|
||||
'no-compare-neg-zero': 'error',
|
||||
|
||||
// disallow assignment in conditional expressions
|
||||
'no-cond-assign': ['error', 'always'],
|
||||
|
||||
@@ -110,8 +110,7 @@ module.exports = {
|
||||
|
||||
// Prefer destructuring from arrays and objects
|
||||
// http://eslint.org/docs/rules/prefer-destructuring
|
||||
// TODO: enable
|
||||
'prefer-destructuring': ['off', {
|
||||
'prefer-destructuring': ['error', {
|
||||
VariableDeclarator: {
|
||||
array: false,
|
||||
object: true,
|
||||
|
||||
@@ -16,8 +16,7 @@ module.exports = {
|
||||
|
||||
// disallow use of the Buffer() constructor
|
||||
// http://eslint.org/docs/rules/no-buffer-constructor
|
||||
// TODO: enable, semver-major
|
||||
'no-buffer-constructor': 'off',
|
||||
'no-buffer-constructor': 'error',
|
||||
|
||||
// disallow mixing regular variable and require declarations
|
||||
'no-mixed-requires': ['off', false],
|
||||
|
||||
@@ -82,6 +82,10 @@ module.exports = {
|
||||
// TODO: enable
|
||||
'func-style': ['off', 'expression'],
|
||||
|
||||
// enforce consistent line breaks inside function parentheses
|
||||
// https://eslint.org/docs/rules/function-paren-newline
|
||||
'function-paren-newline': ['error', 'multiline'],
|
||||
|
||||
// Blacklist certain identifiers to prevent them being used
|
||||
// http://eslint.org/docs/rules/id-blacklist
|
||||
'id-blacklist': 'off',
|
||||
@@ -100,9 +104,6 @@ module.exports = {
|
||||
VariableDeclarator: 1,
|
||||
outerIIFEBody: 1,
|
||||
// MemberExpression: null,
|
||||
// CallExpression: {
|
||||
// parameters: null,
|
||||
// },
|
||||
FunctionDeclaration: {
|
||||
parameters: 1,
|
||||
body: 1
|
||||
@@ -110,7 +111,15 @@ module.exports = {
|
||||
FunctionExpression: {
|
||||
parameters: 1,
|
||||
body: 1
|
||||
}
|
||||
},
|
||||
CallExpression: {
|
||||
'arguments': 1
|
||||
},
|
||||
ArrayExpression: 1,
|
||||
ObjectExpression: 1,
|
||||
ImportDeclaration: 1,
|
||||
flatTernaryExpressions: false,
|
||||
ignoredNodes: ['JSXElement *']
|
||||
}],
|
||||
|
||||
// specify whether double or single quotes should be used in JSX attributes
|
||||
@@ -305,7 +314,7 @@ module.exports = {
|
||||
// disallow trailing whitespace at the end of lines
|
||||
'no-trailing-spaces': ['error', {
|
||||
skipBlankLines: false,
|
||||
// ignoreComments: false, // TODO: uncomment once v3 is dropped
|
||||
ignoreComments: false,
|
||||
}],
|
||||
|
||||
// disallow dangling underscores in identifiers
|
||||
@@ -313,7 +322,7 @@ module.exports = {
|
||||
allow: [],
|
||||
allowAfterThis: false,
|
||||
allowAfterSuper: false,
|
||||
// enforceInMethodNames: false, // TODO: uncoment and enable, semver-minor once v3 is dropped
|
||||
enforceInMethodNames: false,
|
||||
}],
|
||||
|
||||
// disallow the use of Boolean literals in conditional expressions
|
||||
@@ -334,8 +343,7 @@ module.exports = {
|
||||
|
||||
// enforce line breaks between braces
|
||||
// http://eslint.org/docs/rules/object-curly-newline
|
||||
// TODO: enable once https://github.com/eslint/eslint/issues/6488 is resolved and v3 is dropped
|
||||
'object-curly-newline': ['off', {
|
||||
'object-curly-newline': ['error', {
|
||||
ObjectExpression: { minProperties: 3, multiline: true, consistent: true },
|
||||
ObjectPattern: { minProperties: 3, multiline: true, consistent: true }
|
||||
}],
|
||||
@@ -386,8 +394,7 @@ module.exports = {
|
||||
|
||||
// Enforce location of semicolons
|
||||
// http://eslint.org/docs/rules/semi-style
|
||||
// TODO: enable, semver-major until v3 is dropped, semver-minor otherwise
|
||||
'semi-style': ['off', 'last'],
|
||||
'semi-style': ['error', 'last'],
|
||||
|
||||
// requires object keys to be sorted
|
||||
'sort-keys': ['off', 'asc', { caseSensitive: false, natural: true }],
|
||||
@@ -437,13 +444,11 @@ module.exports = {
|
||||
|
||||
// Enforce spacing around colons of switch statements
|
||||
// http://eslint.org/docs/rules/switch-colon-spacing
|
||||
// TODO: enable, semver-major
|
||||
'switch-colon-spacing': ['off', { after: true, before: false }],
|
||||
'switch-colon-spacing': ['error', { after: true, before: false }],
|
||||
|
||||
// Require or disallow spacing between template tags and their literals
|
||||
// http://eslint.org/docs/rules/template-tag-spacing
|
||||
// TODO: enable, semver-major
|
||||
'template-tag-spacing': ['off', 'never'],
|
||||
'template-tag-spacing': ['error', 'never'],
|
||||
|
||||
// require or disallow the Unicode Byte Order Mark
|
||||
// http://eslint.org/docs/rules/unicode-bom
|
||||
|
||||
Reference in New Issue
Block a user