This is a bit of a selfish PR, but I was thinking we could be just a bit smarter about guessing whether an interpolation is a selector or not. I don't think that & and > aren valid tokens in CSS for anything other than as part of a selector, so we could use those to reduce the need for sc tags. This helps in cases like the following (very common in our code base, don't know how common in others):
SomeChild would not be identified as a selector since it is part of a list of selectors. Commas are valid CSS tokens in lots of scenarios, so looking for that is not really an option, but & and > are only valid as part of a selector (I don't think 🤔 ), so it would at least cover those. Thoughts? Am I way off base here?
Coverage remained the same at 100.0% when pulling e8a6bb9cd3b8c643270cb3ebe0f66ace72f1f1a0 on uniqname:fix/selector-guess into 8a5fab0fd47526a2e7977ae968e0987c95045e70 on styled-components:master.
This is a bit of a selfish PR, but I was thinking we could be just a bit smarter about guessing whether an interpolation is a selector or not. I don't think that
&
and>
aren valid tokens in CSS for anything other than as part of a selector, so we could use those to reduce the need for sc tags. This helps in cases like the following (very common in our code base, don't know how common in others):SomeChild
would not be identified as a selector since it is part of a list of selectors. Commas are valid CSS tokens in lots of scenarios, so looking for that is not really an option, but&
and>
are only valid as part of a selector (I don't think 🤔 ), so it would at least cover those. Thoughts? Am I way off base here?