mirror of
https://github.com/airbnb/javascript.git
synced 2026-01-13 23:37:55 -05:00
[eslint config] [deps] update eslint-plugin-react
This commit is contained in:
@@ -67,7 +67,7 @@
|
||||
"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",
|
||||
@@ -78,7 +78,7 @@
|
||||
"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": {
|
||||
|
||||
@@ -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}}
|
||||
`;
|
||||
}
|
||||
|
||||
@@ -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() {}
|
||||
@@ -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() {}
|
||||
@@ -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');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user