[eslint config] [deps] update eslint-plugin-react

This commit is contained in:
Jordan Harband
2019-10-03 19:20:10 -04:00
parent 8c94d53bf8
commit c66cfc3f89
2 changed files with 8 additions and 11 deletions

View File

@@ -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": {

View File

@@ -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');
});
});