Skip to content

Commit 76a4120

Browse files
committed
sort-comp jsx-eslint#1858 PR amendments
1 parent 98ce807 commit 76a4120

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/rules/sort-comp.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const has = require('has');
88
const util = require('util');
99

1010
const Components = require('../util/Components');
11+
const arrayIncludes = require('array-includes');
1112
const astUtil = require('../util/ast');
1213
const docsUrl = require('../util/docsUrl');
1314

@@ -158,7 +159,7 @@ module.exports = {
158159
if (method.instanceMethod) {
159160
methodGroupIndexes.push(groupIndex);
160161
}
161-
} else if ([
162+
} else if (arrayIncludes([
162163
'displayName',
163164
'propTypes',
164165
'contextTypes',
@@ -185,7 +186,7 @@ module.exports = {
185186
'componentDidCatch',
186187
'componentWillUnmount',
187188
'render'
188-
].includes(currentGroup)) {
189+
], currentGroup)) {
189190
if (currentGroup === method.name) {
190191
methodGroupIndexes.push(groupIndex);
191192
}

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"homepage": "https://github.com/yannickcr/eslint-plugin-react",
2525
"bugs": "https://github.com/yannickcr/eslint-plugin-react/issues",
2626
"dependencies": {
27+
"array-includes": "^3.0.3",
2728
"doctrine": "^2.1.0",
2829
"has": "^1.0.3",
2930
"jsx-ast-utils": "^2.0.1",

0 commit comments

Comments
 (0)