Skip to content

Commit

Permalink
[eslint config] [*] [new] add eslint v5 support
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Jun 25, 2018
1 parent 2037fd8 commit a510095
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 8 deletions.
23 changes: 20 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,37 @@ script:
sudo: false
env:
matrix:
- 'TEST=true ESLINT=4 PACKAGE=eslint-config-airbnb'
- 'TEST=true ESLINT=5 PACKAGE=eslint-config-airbnb-base'
- 'TEST=true ESLINT=5 PACKAGE=eslint-config-airbnb'
- 'TEST=true ESLINT=4 PACKAGE=eslint-config-airbnb-base'
- 'TEST=true ESLINT=4 PACKAGE=eslint-config-airbnb'
matrix:
fast_finish: true
include:
- node_js: "lts/*"
env: PREPUBLISH=true ESLINT=4 PACKAGE=eslint-config-airbnb
env: PREPUBLISH=true ESLINT=5 PACKAGE=eslint-config-airbnb-base
- node_js: "lts/*"
env: PREPUBLISH=true ESLINT=5 PACKAGE=eslint-config-airbnb
- node_js: "lts/*"
env: PREPUBLISH=true ESLINT=4 PACKAGE=eslint-config-airbnb-base
- node_js: "lts/*"
env: PREPUBLISH=true ESLINT=4 PACKAGE=eslint-config-airbnb
- node_js: "lts/*"
env: LINT=true
exclude:
- node_js: "5"
env: TEST=true ESLINT=5 PACKAGE=eslint-config-airbnb-base
- node_js: "5"
env: TEST=true ESLINT=5 PACKAGE=eslint-config-airbnb
- node_js: "4"
env: TEST=true ESLINT=5 PACKAGE=eslint-config-airbnb-base
- node_js: "4"
env: TEST=true ESLINT=5 PACKAGE=eslint-config-airbnb
allow_failures:
- node_js: "9"
- node_js: "7"
- node_js: "5"
- env: PREPUBLISH=true ESLINT=4 PACKAGE=eslint-config-airbnb
- env: PREPUBLISH=true ESLINT=5 PACKAGE=eslint-config-airbnb-base
- env: PREPUBLISH=true ESLINT=5 PACKAGE=eslint-config-airbnb
- env: PREPUBLISH=true ESLINT=4 PACKAGE=eslint-config-airbnb-base
- env: PREPUBLISH=true ESLINT=4 PACKAGE=eslint-config-airbnb
4 changes: 2 additions & 2 deletions packages/eslint-config-airbnb-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@
"babel-preset-airbnb": "^2.5.1",
"babel-tape-runner": "^2.0.1",
"editorconfig-tools": "^0.1.1",
"eslint": "^4.19.1",
"eslint": "^4.19.1 || ^5.0.1",
"eslint-find-rules": "^3.3.1",
"eslint-plugin-import": "^2.13.0",
"in-publish": "^2.0.0",
"safe-publish-latest": "^1.1.1",
"tape": "^4.9.1"
},
"peerDependencies": {
"eslint": "^4.19.1",
"eslint": "^4.19.1 || ^5.0.1",
"eslint-plugin-import": "^2.13.0"
},
"engines": {
Expand Down
10 changes: 9 additions & 1 deletion packages/eslint-config-airbnb-base/rules/best-practices.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ module.exports = {
// make sure for-in loops have an if statement
'guard-for-in': 'error',

// enforce a maximum number of classes per file
// https://eslint.org/docs/rules/max-classes-per-file
// TODO: semver-major (eslint 5): enable
'max-classes-per-file': ['off', 1],

// disallow the use of alert, confirm, and prompt
'no-alert': 'warn',

Expand Down Expand Up @@ -243,7 +248,10 @@ module.exports = {

// disallow self assignment
// https://eslint.org/docs/rules/no-self-assign
'no-self-assign': 'error',
// TODO: semver-major: props -> true
'no-self-assign': ['error', {
props: false,
}],

// disallow comparisons where both sides are exactly the same
'no-self-compare': 'error',
Expand Down
16 changes: 16 additions & 0 deletions packages/eslint-config-airbnb-base/rules/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ module.exports = {
'brace-style': ['error', '1tbs', { allowSingleLine: true }],

// require camel case names
// TODO: semver-major (eslint 5): add ignoreDestructuring: false option
camelcase: ['error', { properties: 'never' }],

// enforce or disallow capitalization of the first letter of a comment
Expand Down Expand Up @@ -83,6 +84,7 @@ module.exports = {
// requires function names to match the name of the variable or property to which they are
// assigned
// https://eslint.org/docs/rules/func-name-matching
// TODO: semver-major (eslint 5): add considerPropertyDescriptor: true
'func-name-matching': ['off', 'always', {
includeCommonJSModuleExports: false
}],
Expand Down Expand Up @@ -208,6 +210,15 @@ module.exports = {
skipComments: true
}],

// enforce a maximum function length
// https://eslint.org/docs/rules/max-lines-per-function
'max-lines-per-function': ['off', {
max: 50,
skipBlankLines: true,
skipComments: true,
IIFEs: true,
}],

// specify the maximum depth callbacks can be nested
'max-nested-callbacks': 'off',

Expand Down Expand Up @@ -416,6 +427,11 @@ module.exports = {
// https://eslint.org/docs/rules/padding-line-between-statements
'padding-line-between-statements': 'off',

// Prefer use of an object spread over Object.assign
// https://eslint.org/docs/rules/prefer-object-spread
// TODO: semver-major (eslint 5): enable
'prefer-object-spread': 'off',

// require quotes around object literal property names
// https://eslint.org/docs/rules/quote-props.html
'quote-props': ['error', 'as-needed', { keywords: false, unnecessary: true, numbers: false }],
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-config-airbnb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"babel-preset-airbnb": "^2.5.1",
"babel-tape-runner": "^2.0.1",
"editorconfig-tools": "^0.1.1",
"eslint": "^4.19.1",
"eslint": "^4.19.1 || ^5.0.1",
"eslint-find-rules": "^3.3.1",
"eslint-plugin-import": "^2.13.0",
"eslint-plugin-jsx-a11y": "^6.1.0",
Expand All @@ -73,7 +73,7 @@
"tape": "^4.9.1"
},
"peerDependencies": {
"eslint": "^4.19.1",
"eslint": "^4.19.1 || ^5.0.1",
"eslint-plugin-import": "^2.13.0",
"eslint-plugin-jsx-a11y": "^6.1.0",
"eslint-plugin-react": "^7.10.0"
Expand Down

0 comments on commit a510095

Please sign in to comment.