Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove Identifier listener in no-irregular-whitespace #17235

Merged
merged 1 commit into from Jun 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 3 additions & 4 deletions lib/rules/no-irregular-whitespace.js
Expand Up @@ -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);

Expand Down Expand Up @@ -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) {
Expand Down