Skip to content

Commit

Permalink
Update: use includes instead of indexOf
Browse files Browse the repository at this point in the history
  • Loading branch information
Connormiha committed May 21, 2021
1 parent 2466a05 commit e2033ba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/rules/callback-return.js
Expand Up @@ -52,7 +52,7 @@ module.exports = {
if (!node.parent) {
return null;
}
if (types.indexOf(node.parent.type) === -1) {
if (!types.includes(node.parent.type)) {
return findClosestParentOfType(node.parent, types);
}
return node.parent;
Expand Down Expand Up @@ -86,7 +86,7 @@ module.exports = {
* @returns {boolean} Whether or not this function matches our callback name.
*/
function isCallback(node) {
return containsOnlyIdentifiers(node.callee) && callbacks.indexOf(sourceCode.getText(node.callee)) > -1;
return containsOnlyIdentifiers(node.callee) && callbacks.includes(sourceCode.getText(node.callee));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/comma-spacing.js
Expand Up @@ -181,7 +181,7 @@ module.exports = {

validateCommaItemSpacing({
comma: token,
left: astUtils.isCommaToken(previousToken) || commaTokensToIgnore.indexOf(token) > -1 ? null : previousToken,
left: astUtils.isCommaToken(previousToken) || commaTokensToIgnore.includes(token) ? null : previousToken,
right: astUtils.isCommaToken(nextToken) ? null : nextToken
}, token);
});
Expand Down

0 comments on commit e2033ba

Please sign in to comment.