Fix incorrect property ordering with obj rest spread on nested (#5685)
This commit is contained in:
@@ -117,15 +117,22 @@ export default function ({ types: t }) {
|
||||
}
|
||||
|
||||
let ref = this.originalPath.node.init;
|
||||
const refPropertyPath = [];
|
||||
|
||||
path.findParent((path) => {
|
||||
if (path.isObjectProperty()) {
|
||||
ref = t.memberExpression(ref, t.identifier(path.node.key.name));
|
||||
refPropertyPath.unshift(path.node.key.name);
|
||||
} else if (path.isVariableDeclarator()) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
if (refPropertyPath.length) {
|
||||
refPropertyPath.forEach((prop) => {
|
||||
ref = t.memberExpression(ref, t.identifier(prop));
|
||||
});
|
||||
}
|
||||
|
||||
const [ argument, callExpression ] = createObjectSpread(
|
||||
file,
|
||||
path.parentPath.node.properties,
|
||||
|
||||
Reference in New Issue
Block a user