From 76a4120dffaed24b4ff4d1cbb5d001433a072543 Mon Sep 17 00:00:00 2001 From: Jason Ellison Date: Wed, 4 Jul 2018 09:44:56 +0100 Subject: [PATCH] sort-comp #1858 PR amendments --- lib/rules/sort-comp.js | 5 +++-- package.json | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/rules/sort-comp.js b/lib/rules/sort-comp.js index 8d98f4b476..ed364a8217 100644 --- a/lib/rules/sort-comp.js +++ b/lib/rules/sort-comp.js @@ -8,6 +8,7 @@ const has = require('has'); const util = require('util'); const Components = require('../util/Components'); +const arrayIncludes = require('array-includes'); const astUtil = require('../util/ast'); const docsUrl = require('../util/docsUrl'); @@ -158,7 +159,7 @@ module.exports = { if (method.instanceMethod) { methodGroupIndexes.push(groupIndex); } - } else if ([ + } else if (arrayIncludes([ 'displayName', 'propTypes', 'contextTypes', @@ -185,7 +186,7 @@ module.exports = { 'componentDidCatch', 'componentWillUnmount', 'render' - ].includes(currentGroup)) { + ], currentGroup)) { if (currentGroup === method.name) { methodGroupIndexes.push(groupIndex); } diff --git a/package.json b/package.json index 15d1cfe585..13b420802c 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "homepage": "https://github.com/yannickcr/eslint-plugin-react", "bugs": "https://github.com/yannickcr/eslint-plugin-react/issues", "dependencies": { + "array-includes": "^3.0.3", "doctrine": "^2.1.0", "has": "^1.0.3", "jsx-ast-utils": "^2.0.1",