Skip to content
This repository was archived by the owner on Jun 8, 2019. It is now read-only.

Add support for sequenceExpressions #38

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,17 @@ export default function () {
}

function referencesImport(path, mod, importedNames) {
if (!(path.isIdentifier() || path.isJSXIdentifier())) {
return false;
}
if (path.isSequenceExpression()) {
const sequenceExpressionValue =
path.node.expressions[path.node.expressions.length - 1];

return importedNames.some((name) => path.referencesImport(mod, name));
if (sequenceExpressionValue.property && sequenceExpressionValue.property.name) {
return importedNames.some((name) => name === sequenceExpressionValue.property.name);
}
} else if (path.isIdentifier() || path.isJSXIdentifier()) {
return importedNames.some((name) => path.referencesImport(mod, name));
}
return false;
}

return {
Expand Down