diff --git a/packages/eslint-config-airbnb/package.json b/packages/eslint-config-airbnb/package.json index d9b3f5d9..1ffd85fc 100644 --- a/packages/eslint-config-airbnb/package.json +++ b/packages/eslint-config-airbnb/package.json @@ -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": { diff --git a/packages/eslint-config-airbnb/test/test-react-order.js b/packages/eslint-config-airbnb/test/test-react-order.js index 2527f04e..af9287ab 100644 --- a/packages/eslint-config-airbnb/test/test-react-order.js +++ b/packages/eslint-config-airbnb/test/test-react-order.js @@ -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
; }`)); + render() { return
; } +`)); 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'); }); });