Skip to content

Commit a510095

Browse files
committed
[eslint config] [*] [new] add eslint v5 support
1 parent 2037fd8 commit a510095

File tree

5 files changed

+49
-8
lines changed

5 files changed

+49
-8
lines changed

.travis.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,37 @@ script:
1818
sudo: false
1919
env:
2020
matrix:
21-
- 'TEST=true ESLINT=4 PACKAGE=eslint-config-airbnb'
21+
- 'TEST=true ESLINT=5 PACKAGE=eslint-config-airbnb-base'
22+
- 'TEST=true ESLINT=5 PACKAGE=eslint-config-airbnb'
2223
- 'TEST=true ESLINT=4 PACKAGE=eslint-config-airbnb-base'
24+
- 'TEST=true ESLINT=4 PACKAGE=eslint-config-airbnb'
2325
matrix:
2426
fast_finish: true
2527
include:
2628
- node_js: "lts/*"
27-
env: PREPUBLISH=true ESLINT=4 PACKAGE=eslint-config-airbnb
29+
env: PREPUBLISH=true ESLINT=5 PACKAGE=eslint-config-airbnb-base
30+
- node_js: "lts/*"
31+
env: PREPUBLISH=true ESLINT=5 PACKAGE=eslint-config-airbnb
2832
- node_js: "lts/*"
2933
env: PREPUBLISH=true ESLINT=4 PACKAGE=eslint-config-airbnb-base
34+
- node_js: "lts/*"
35+
env: PREPUBLISH=true ESLINT=4 PACKAGE=eslint-config-airbnb
3036
- node_js: "lts/*"
3137
env: LINT=true
38+
exclude:
39+
- node_js: "5"
40+
env: TEST=true ESLINT=5 PACKAGE=eslint-config-airbnb-base
41+
- node_js: "5"
42+
env: TEST=true ESLINT=5 PACKAGE=eslint-config-airbnb
43+
- node_js: "4"
44+
env: TEST=true ESLINT=5 PACKAGE=eslint-config-airbnb-base
45+
- node_js: "4"
46+
env: TEST=true ESLINT=5 PACKAGE=eslint-config-airbnb
3247
allow_failures:
3348
- node_js: "9"
3449
- node_js: "7"
3550
- node_js: "5"
36-
- env: PREPUBLISH=true ESLINT=4 PACKAGE=eslint-config-airbnb
51+
- env: PREPUBLISH=true ESLINT=5 PACKAGE=eslint-config-airbnb-base
52+
- env: PREPUBLISH=true ESLINT=5 PACKAGE=eslint-config-airbnb
3753
- env: PREPUBLISH=true ESLINT=4 PACKAGE=eslint-config-airbnb-base
54+
- env: PREPUBLISH=true ESLINT=4 PACKAGE=eslint-config-airbnb

packages/eslint-config-airbnb-base/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,15 @@
5656
"babel-preset-airbnb": "^2.5.1",
5757
"babel-tape-runner": "^2.0.1",
5858
"editorconfig-tools": "^0.1.1",
59-
"eslint": "^4.19.1",
59+
"eslint": "^4.19.1 || ^5.0.1",
6060
"eslint-find-rules": "^3.3.1",
6161
"eslint-plugin-import": "^2.13.0",
6262
"in-publish": "^2.0.0",
6363
"safe-publish-latest": "^1.1.1",
6464
"tape": "^4.9.1"
6565
},
6666
"peerDependencies": {
67-
"eslint": "^4.19.1",
67+
"eslint": "^4.19.1 || ^5.0.1",
6868
"eslint-plugin-import": "^2.13.0"
6969
},
7070
"engines": {

packages/eslint-config-airbnb-base/rules/best-practices.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ module.exports = {
4242
// make sure for-in loops have an if statement
4343
'guard-for-in': 'error',
4444

45+
// enforce a maximum number of classes per file
46+
// https://eslint.org/docs/rules/max-classes-per-file
47+
// TODO: semver-major (eslint 5): enable
48+
'max-classes-per-file': ['off', 1],
49+
4550
// disallow the use of alert, confirm, and prompt
4651
'no-alert': 'warn',
4752

@@ -243,7 +248,10 @@ module.exports = {
243248

244249
// disallow self assignment
245250
// https://eslint.org/docs/rules/no-self-assign
246-
'no-self-assign': 'error',
251+
// TODO: semver-major: props -> true
252+
'no-self-assign': ['error', {
253+
props: false,
254+
}],
247255

248256
// disallow comparisons where both sides are exactly the same
249257
'no-self-compare': 'error',

packages/eslint-config-airbnb-base/rules/style.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ module.exports = {
2121
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
2222

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

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

213+
// enforce a maximum function length
214+
// https://eslint.org/docs/rules/max-lines-per-function
215+
'max-lines-per-function': ['off', {
216+
max: 50,
217+
skipBlankLines: true,
218+
skipComments: true,
219+
IIFEs: true,
220+
}],
221+
211222
// specify the maximum depth callbacks can be nested
212223
'max-nested-callbacks': 'off',
213224

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

430+
// Prefer use of an object spread over Object.assign
431+
// https://eslint.org/docs/rules/prefer-object-spread
432+
// TODO: semver-major (eslint 5): enable
433+
'prefer-object-spread': 'off',
434+
419435
// require quotes around object literal property names
420436
// https://eslint.org/docs/rules/quote-props.html
421437
'quote-props': ['error', 'as-needed', { keywords: false, unnecessary: true, numbers: false }],

packages/eslint-config-airbnb/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"babel-preset-airbnb": "^2.5.1",
6363
"babel-tape-runner": "^2.0.1",
6464
"editorconfig-tools": "^0.1.1",
65-
"eslint": "^4.19.1",
65+
"eslint": "^4.19.1 || ^5.0.1",
6666
"eslint-find-rules": "^3.3.1",
6767
"eslint-plugin-import": "^2.13.0",
6868
"eslint-plugin-jsx-a11y": "^6.1.0",
@@ -73,7 +73,7 @@
7373
"tape": "^4.9.1"
7474
},
7575
"peerDependencies": {
76-
"eslint": "^4.19.1",
76+
"eslint": "^4.19.1 || ^5.0.1",
7777
"eslint-plugin-import": "^2.13.0",
7878
"eslint-plugin-jsx-a11y": "^6.1.0",
7979
"eslint-plugin-react": "^7.10.0"

0 commit comments

Comments
 (0)