diff --git a/src/rules/order.js b/src/rules/order.js index a42d51284..6dfdb44ab 100644 --- a/src/rules/order.js +++ b/src/rules/order.js @@ -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); } }