Skip to content

Commit

Permalink
[Fix] named exports order for old parsers
Browse files Browse the repository at this point in the history
  • Loading branch information
manuth committed Sep 4, 2024
1 parent a2cc811 commit a2e8c34
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/rules/order.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,17 +194,19 @@ function getNamedCJSExports(context, node) {
}
const result = [];
let root = node;
let parent = null;
while (root.type === 'MemberExpression') {
if (root.property.type !== 'Identifier') {
return;
}
result.unshift(root.property.name);
parent = root;
root = root.object;
}
if (isCJSExports(context, root)) {
return result;
}
if (isCJSExports(context, root.parent)) {
if (isCJSExports(context, parent)) {
return result.slice(1);
}
}
Expand Down

0 comments on commit a2e8c34

Please sign in to comment.