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

Chore: removes unnecessary assignment in loop #11780

Merged
merged 2 commits into from Jun 8, 2019
Merged
Changes from 1 commit
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
14 changes: 10 additions & 4 deletions lib/linter/node-event-generator.js
Expand Up @@ -221,17 +221,23 @@ class NodeEventGenerator {
const selector = parseSelector(rawSelector);

if (selector.listenerTypes) {
selector.listenerTypes.forEach(nodeType => {
const typeMap = selector.isExit ? this.exitSelectorsByNodeType : this.enterSelectorsByNodeType;
const typeMap = selector.isExit ? this.exitSelectorsByNodeType : this.enterSelectorsByNodeType;

selector.listenerTypes.forEach(nodeType => {
if (!typeMap.has(nodeType)) {
typeMap.set(nodeType, []);
}
typeMap.get(nodeType).push(selector);
});
} else {
(selector.isExit ? this.anyTypeExitSelectors : this.anyTypeEnterSelectors).push(selector);
return;
}

if (selector.isExit) {
this.anyTypeExitSelectors.push(selector);
return;
}

this.anyTypeEnterSelectors.push(selector);
dimitropoulos marked this conversation as resolved.
Show resolved Hide resolved
});

this.anyTypeEnterSelectors.sort(compareSpecificity);
Expand Down