Skip to content

Commit c96ca57

Browse files
committed
fix: for old parsers
1 parent 1b5b17b commit c96ca57

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/parser/converts/attr.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,13 @@ function convertAttribute(
181181
};
182182
(key as any).parent = sAttr;
183183
ctx.scriptLet.addObjectShorthandProperty(attribute.key, sAttr, (es) => {
184-
sAttr.key = es.key;
184+
if (
185+
// FIXME: Older parsers may use the same node. In that case, do not replace.
186+
// We will drop support for ESLint v7 in the next major version and remove this branch.
187+
es.key !== es.value
188+
) {
189+
sAttr.key = es.key;
190+
}
185191
sAttr.value = es.value;
186192
});
187193
return sAttr;

0 commit comments

Comments
 (0)