Skip to content

Commit 2fcba06

Browse files
committed
indexOf instead of includes
1 parent c7c7191 commit 2fcba06

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/rules/no-unused-prop-types.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ module.exports = {
276276
*/
277277
function getKeyValue(node) {
278278
if (node.type === 'ObjectTypeProperty') {
279-
const tokens = context.getFirstTokens(node, {count: 1, filter: tokenNode => ['Identifier', 'String'].includes(tokenNode.type)});
279+
const tokens = context.getFirstTokens(node, {count: 1, filter: tokenNode => ['Identifier', 'String'].indexOf(tokenNode.type) >= 0});
280280
return stripQuotes(tokens[0].value);
281281
}
282282
const key = node.key || node.argument;

lib/rules/prop-types.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ module.exports = {
346346
*/
347347
function getKeyValue(node) {
348348
if (node.type === 'ObjectTypeProperty') {
349-
const tokens = context.getFirstTokens(node, {count: 1, filter: tokenNode => ['Identifier', 'String'].includes(tokenNode.type)});
349+
const tokens = context.getFirstTokens(node, {count: 1, filter: tokenNode => ['Identifier', 'String'].indexOf(tokenNode.type) >= 0});
350350
return stripQuotes(tokens[0].value);
351351
}
352352
const key = node.key || node.argument;

0 commit comments

Comments
 (0)