Skip to content

Commit

Permalink
[Deps] allow eslint v3 or v4; update eslint-plugin-import
Browse files Browse the repository at this point in the history
Part of airbnb#1447.
  • Loading branch information
ljharb authored and jaylaw81 committed Sep 19, 2017
1 parent 0758832 commit b0292b9
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 12 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,19 @@ env:
matrix:
- 'TEST=true ESLINT=3 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
include:
- node_js: "node"
env: PREPUBLISH=true ESLINT=3 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:
- node_js: "7"
- node_js: "5"
- env: PREPUBLISH=true ESLINT=3 PACKAGE=eslint-config-airbnb
- env: PREPUBLISH=true ESLINT=3 PACKAGE=eslint-config-airbnb-base
- env: PREPUBLISH=true ESLINT=4 PACKAGE=eslint-config-airbnb-base
6 changes: 3 additions & 3 deletions packages/eslint-config-airbnb-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@
"editorconfig-tools": "^0.1.1",
"eslint": "^4.3.0",
"eslint-find-rules": "^3.1.1",
"eslint-plugin-import": "^2.6.1",
"eslint-plugin-import": "^2.7.0",
"in-publish": "^2.0.0",
"safe-publish-latest": "^1.1.1",
"tape": "^4.7.0"
},
"peerDependencies": {
"eslint": "^3.19.0",
"eslint-plugin-import": "^2.6.1"
"eslint": "^3.19.0 || ^4.3.0",
"eslint-plugin-import": "^2.7.0"
},
"engines": {
"node": ">= 4"
Expand Down
4 changes: 3 additions & 1 deletion packages/eslint-config-airbnb-base/rules/best-practices.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ module.exports = {
}],

// disallow use of multiple spaces
'no-multi-spaces': 'error',
'no-multi-spaces': ['error', {
// ignoreEOLComments: false, // TODO: uncomment once v3 is dropped
}],

// disallow use of multiline strings
'no-multi-str': 'error',
Expand Down
12 changes: 12 additions & 0 deletions packages/eslint-config-airbnb-base/rules/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ module.exports = {
functions: 'always-multiline',
}],

// 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',

// 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 }],

// Disallow await inside of loops
// http://eslint.org/docs/rules/no-await-in-loop
'no-await-in-loop': 'error',
Expand Down Expand Up @@ -61,6 +71,8 @@ module.exports = {
conditionalAssign: true,
nestedBinaryExpressions: false,
returnAssign: false,
ignoreJSX: 'all', // delegate to eslint-plugin-react
enforceForArrowConditionals: false,
}],

// disallow unnecessary semicolons
Expand Down
10 changes: 8 additions & 2 deletions packages/eslint-config-airbnb-base/rules/es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,14 @@ module.exports = {
// http://eslint.org/docs/rules/prefer-destructuring
// TODO: enable
'prefer-destructuring': ['off', {
array: true,
object: true,
VariableDeclarator: {
array: false,
object: true,
},
AssignmentExpression: {
array: true,
object: true,
},
}, {
enforceForRenamedProperties: false,
}],
Expand Down
5 changes: 5 additions & 0 deletions packages/eslint-config-airbnb-base/rules/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ module.exports = {
// enforces error handling in callbacks (node environment)
'handle-callback-err': 'off',

// disallow use of the Buffer() constructor
// http://eslint.org/docs/rules/no-buffer-constructor
// TODO: enable, semver-major
'no-buffer-constructor': 'off',

// disallow mixing regular variable and require declarations
'no-mixed-requires': ['off', false],

Expand Down
44 changes: 38 additions & 6 deletions packages/eslint-config-airbnb-base/rules/style.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
module.exports = {
rules: {
// enforce line breaks after opening and before closing array brackets
// http://eslint.org/docs/rules/array-bracket-newline
// TODO: enable? semver-major
'array-bracket-newline': ['off', { multiline: true, minItems: 3 }],

// enforce line breaks between array elements
// http://eslint.org/docs/rules/array-element-newline
// TODO: enable? semver-major
'array-element-newline': ['off', { multiline: true, minItems: 3 }],

// enforce spacing inside array brackets
'array-bracket-spacing': ['error', 'never'],

Expand Down Expand Up @@ -82,7 +92,7 @@ module.exports = {
outerIIFEBody: 1,
// MemberExpression: null,
// CallExpression: {
// parameters: null,
// parameters: null,
// },
FunctionDeclaration: {
parameters: 1,
Expand Down Expand Up @@ -284,10 +294,18 @@ module.exports = {
'no-ternary': 'off',

// disallow trailing whitespace at the end of lines
'no-trailing-spaces': 'error',
'no-trailing-spaces': ['error', {
skipBlankLines: false,
// ignoreComments: false, // TODO: uncomment once v3 is dropped
}],

// disallow dangling underscores in identifiers
'no-underscore-dangle': ['error', { allowAfterThis: false }],
'no-underscore-dangle': ['error', {
allow: [],
allowAfterThis: false,
allowAfterSuper: false,
// enforceInMethodNames: false, // TODO: uncoment and enable, semver-minor once v3 is dropped
}],

// disallow the use of Boolean literals in conditional expressions
// also, prefer `a || b` over `a ? a : b`
Expand All @@ -307,10 +325,10 @@ 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
// TODO: enable once https://github.com/eslint/eslint/issues/6488 is resolved and v3 is dropped
'object-curly-newline': ['off', {
ObjectExpression: { minProperties: 0, multiline: true },
ObjectPattern: { minProperties: 0, multiline: true }
ObjectExpression: { minProperties: 3, multiline: true, consistent: true },
ObjectPattern: { minProperties: 3, multiline: true, consistent: true }
}],

// enforce "same line" or "multiple line" on object properties.
Expand All @@ -336,6 +354,10 @@ module.exports = {
// enforce padding within blocks
'padded-blocks': ['error', 'never'],

// Require or disallow padding lines between statements
// http://eslint.org/docs/rules/padding-line-between-statements
'padding-line-between-statements': 'off',

// require quotes around object literal property names
// http://eslint.org/docs/rules/quote-props.html
'quote-props': ['error', 'as-needed', { keywords: false, unnecessary: true, numbers: false }],
Expand All @@ -353,6 +375,11 @@ module.exports = {
// enforce spacing before and after semicolons
'semi-spacing': ['error', { before: false, after: true }],

// 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'],

// requires object keys to be sorted
'sort-keys': ['off', 'asc', { caseSensitive: false, natural: true }],

Expand Down Expand Up @@ -399,6 +426,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 }],

// Require or disallow spacing between template tags and their literals
// http://eslint.org/docs/rules/template-tag-spacing
// TODO: enable, semver-major
Expand Down

0 comments on commit b0292b9

Please sign in to comment.