Fix formatting styled(Foo).attrs(...)`` (#3073)
parent
5b7b012fcd
commit
12f028cd46
|
@ -430,10 +430,13 @@ function isStyledComponents(path) {
|
||||||
return (
|
return (
|
||||||
// styled(Component)``
|
// styled(Component)``
|
||||||
isStyledIdentifier(tag.callee) ||
|
isStyledIdentifier(tag.callee) ||
|
||||||
// styled.foo.attr({})``
|
|
||||||
(tag.callee.type === "MemberExpression" &&
|
(tag.callee.type === "MemberExpression" &&
|
||||||
tag.callee.object.type === "MemberExpression" &&
|
// styled.foo.attr({})``
|
||||||
isStyledIdentifier(tag.callee.object.object))
|
((tag.callee.object.type === "MemberExpression" &&
|
||||||
|
isStyledIdentifier(tag.callee.object.object)) ||
|
||||||
|
// styled(Component).attr({})``
|
||||||
|
(tag.callee.object.type === "CallExpression" &&
|
||||||
|
isStyledIdentifier(tag.callee.object.callee))))
|
||||||
);
|
);
|
||||||
|
|
||||||
case "Identifier":
|
case "Identifier":
|
||||||
|
|
|
@ -27,6 +27,9 @@ styled(ExistingComponent)\`
|
||||||
|
|
||||||
styled.button.attr({})\`
|
styled.button.attr({})\`
|
||||||
border : rebeccapurple\`;
|
border : rebeccapurple\`;
|
||||||
|
|
||||||
|
styled(ExistingComponent).attr({})\`
|
||||||
|
border : rebeccapurple\`;
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
const ListItem = styled.li\`\`;
|
const ListItem = styled.li\`\`;
|
||||||
|
|
||||||
|
@ -57,4 +60,8 @@ styled.button.attr({})\`
|
||||||
border: rebeccapurple;
|
border: rebeccapurple;
|
||||||
\`;
|
\`;
|
||||||
|
|
||||||
|
styled(ExistingComponent).attr({})\`
|
||||||
|
border: rebeccapurple;
|
||||||
|
\`;
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
|
@ -24,3 +24,6 @@ styled(ExistingComponent)`
|
||||||
|
|
||||||
styled.button.attr({})`
|
styled.button.attr({})`
|
||||||
border : rebeccapurple`;
|
border : rebeccapurple`;
|
||||||
|
|
||||||
|
styled(ExistingComponent).attr({})`
|
||||||
|
border : rebeccapurple`;
|
||||||
|
|
Loading…
Reference in New Issue