From 0892412556b2ba6c3d1b85152dafe47a3f4cba72 Mon Sep 17 00:00:00 2001 From: Milos Djermanovic Date: Fri, 2 Jun 2023 22:28:02 +0200 Subject: [PATCH] refactor: remove `Identifier` listener in no-irregular-whitespace (#17235) --- lib/rules/no-irregular-whitespace.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/rules/no-irregular-whitespace.js b/lib/rules/no-irregular-whitespace.js index 67519b5e851..0badc58b87a 100644 --- a/lib/rules/no-irregular-whitespace.js +++ b/lib/rules/no-irregular-whitespace.js @@ -100,12 +100,12 @@ module.exports = { } /** - * Checks identifier or literal nodes for errors that we are choosing to ignore and calls the relevant methods to remove the errors + * Checks literal nodes for errors that we are choosing to ignore and calls the relevant methods to remove the errors * @param {ASTNode} node to check for matching errors. * @returns {void} * @private */ - function removeInvalidNodeErrorsInIdentifierOrLiteral(node) { + function removeInvalidNodeErrorsInLiteral(node) { const shouldCheckStrings = skipStrings && (typeof node.value === "string"); const shouldCheckRegExps = skipRegExps && Boolean(node.regex); @@ -237,8 +237,7 @@ module.exports = { checkForIrregularLineTerminators(node); }; - nodes.Identifier = removeInvalidNodeErrorsInIdentifierOrLiteral; - nodes.Literal = removeInvalidNodeErrorsInIdentifierOrLiteral; + nodes.Literal = removeInvalidNodeErrorsInLiteral; nodes.TemplateElement = skipTemplates ? removeInvalidNodeErrorsInTemplateLiteral : noop; nodes["Program:exit"] = function() { if (skipComments) {