Skip to content

Commit 34d2e33

Browse files
vwillyamsljharb
andauthored
Update lib/rules/no-multi-comp.js
Co-authored-by: Jordan Harband <[email protected]>
1 parent 9c03d56 commit 34d2e33

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/rules/no-multi-comp.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ module.exports = {
6565
if (node.declaration.type === 'ClassDeclaration') {
6666
return node.declaration.id.name;
6767
}
68-
for (const declarator of node.declaration.declarations || []) {
69-
const type = declarator.init.type;
70-
if (validIdentifiers.has(type)) {
68+
if (node.declaration.declarations) {
69+
const declarator = node.declaration.declarations.find((declarator) => validIdentifiers.has(declarator.init.type));
70+
if (declarator) {
7171
return declarator.id.name;
7272
}
7373
}

0 commit comments

Comments
 (0)