Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/eslint-config-airbnb-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@
},
"homepage": "https://github.com/airbnb/javascript",
"devDependencies": {
"@babel/runtime": "^7.5.5",
"babel-preset-airbnb": "^4.0.1",
"@babel/runtime": "^7.6.2",
"babel-preset-airbnb": "^4.1.0",
"babel-tape-runner": "^3.0.0",
"eclint": "^2.8.1",
"eslint": "^5.16.0 || ^6.1.0",
"eslint-find-rules": "^3.4.0",
"eslint-plugin-import": "^2.18.2",
"in-publish": "^2.0.0",
"safe-publish-latest": "^1.1.2",
"safe-publish-latest": "^1.1.3",
"tape": "^4.11.0"
},
"peerDependencies": {
Expand All @@ -72,7 +72,7 @@
"node": ">= 6"
},
"dependencies": {
"confusing-browser-globals": "^1.0.7",
"confusing-browser-globals": "^1.0.9",
"object.assign": "^4.1.0",
"object.entries": "^1.1.0"
}
Expand Down
8 changes: 8 additions & 0 deletions packages/eslint-config-airbnb-base/rules/best-practices.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ module.exports = {
// require default case in switch statements
'default-case': ['error', { commentPattern: '^no default$' }],

// https://eslint.org/docs/rules/default-param-last
// TODO: enable, semver-minor, when eslint v6.4 is required (which is a major)
'default-param-last': 'off',

// encourages use of dot notation whenever possible
'dot-notation': ['error', { allowKeywords: true }],

Expand Down Expand Up @@ -313,6 +317,10 @@ module.exports = {
// https://eslint.org/docs/rules/prefer-named-capture-group
'prefer-named-capture-group': 'off',

// https://eslint.org/docs/rules/prefer-regex-literals
// TODO; enable, semver-minor, once eslint v6.4 is required (which is a major)
'prefer-regex-literals': 'off',

// require use of the second argument for parseInt()
radix: 'error',

Expand Down
4 changes: 4 additions & 0 deletions packages/eslint-config-airbnb-base/rules/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ module.exports = {
// disallow overwriting functions written as function declarations
'no-func-assign': 'error',

// https://eslint.org/docs/rules/no-import-assign
// TODO: enable, semver-minor, once eslint v6.4 is required (which is a major)
'no-import-assign': 'off',

// disallow function or variable declarations in nested blocks
'no-inner-declarations': 'error',

Expand Down
4 changes: 4 additions & 0 deletions packages/eslint-config-airbnb-base/rules/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ module.exports = {
// enforce newline at the end of file, with no multiple empty lines
'eol-last': ['error', 'always'],

// https://eslint.org/docs/rules/function-call-argument-newline
// TODO: enable, semver-minor, once eslint v6.2 is required (which is a major)
'function-call-argument-newline': ['off', 'consistent'],

// enforce spacing between functions and their invocations
// https://eslint.org/docs/rules/func-call-spacing
'func-call-spacing': ['error', 'never'],
Expand Down
10 changes: 5 additions & 5 deletions packages/eslint-config-airbnb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,26 +59,26 @@
"object.entries": "^1.1.0"
},
"devDependencies": {
"@babel/runtime": "^7.5.5",
"babel-preset-airbnb": "^4.0.1",
"@babel/runtime": "^7.6.2",
"babel-preset-airbnb": "^4.1.0",
"babel-tape-runner": "^3.0.0",
"eclint": "^2.8.1",
"eslint": "^5.16.0 || ^6.1.0",
"eslint-find-rules": "^3.4.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.14.3",
"eslint-plugin-react": "^7.15.1",
"eslint-plugin-react-hooks": "^1.7.0",
"in-publish": "^2.0.0",
"react": ">= 0.13.0",
"safe-publish-latest": "^1.1.2",
"safe-publish-latest": "^1.1.3",
"tape": "^4.11.0"
},
"peerDependencies": {
"eslint": "^5.16.0 || ^6.1.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.14.3",
"eslint-plugin-react": "^7.15.1",
"eslint-plugin-react-hooks": "^1.7.0"
},
"engines": {
Expand Down
3 changes: 1 addition & 2 deletions packages/eslint-config-airbnb/rules/react.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,7 @@ module.exports = {
'getSnapshotBeforeUpdate',
'componentDidUpdate',
'componentDidCatch',
'componentWillUnmount',
'componentDidCatch'
'componentWillUnmount'
],
rendering: [
'/^render.+$/',
Expand Down
15 changes: 6 additions & 9 deletions packages/eslint-config-airbnb/test/test-react-order.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ import React from 'react';

export default class MyComponent extends React.Component {
/* eslint no-empty-function: 0, class-methods-use-this: 0 */
${body}
}
${body}}
`;
}

Expand All @@ -44,25 +43,24 @@ test('validate react prop order', (t) => {
t.test('passes a good component', (t) => {
t.plan(3);
const result = lint(wrapComponent(`
componentWillMount() {}
componentDidMount() {}
setFoo() {}
getFoo() {}
setBar() {}
someMethod() {}
renderDogs() {}
render() { return <div />; }`));
render() { return <div />; }
`));

t.notOk(result.warningCount, 'no warnings');
t.notOk(result.errorCount, 'no errors');
t.deepEquals(result.messages, [], 'no messages in results');
t.notOk(result.errorCount, 'no errors');
});

t.test('order: when random method is first', (t) => {
t.plan(2);
const result = lint(wrapComponent(`
someMethod() {}
componentWillMount() {}
componentDidMount() {}
setFoo() {}
getFoo() {}
Expand All @@ -72,13 +70,12 @@ test('validate react prop order', (t) => {
`));

t.ok(result.errorCount, 'fails');
t.equal(result.messages[0].ruleId, 'react/sort-comp', 'fails due to sort');
t.deepEqual(result.messages.map(x => x.ruleId), ['react/sort-comp'], 'fails due to sort');
});

t.test('order: when random method after lifecycle methods', (t) => {
t.plan(2);
const result = lint(wrapComponent(`
componentWillMount() {}
componentDidMount() {}
someMethod() {}
setFoo() {}
Expand All @@ -89,6 +86,6 @@ test('validate react prop order', (t) => {
`));

t.ok(result.errorCount, 'fails');
t.equal(result.messages[0].ruleId, 'react/sort-comp', 'fails due to sort');
t.deepEqual(result.messages.map(x => x.ruleId), ['react/sort-comp'], 'fails due to sort');
});
});