-
Notifications
You must be signed in to change notification settings - Fork 61
Interpolation tagging doesn't work with Typescript file #130
Comments
Can you try tagging your |
Hmm, my best guess at the moment is that the processor inserts an extra semicolon after Yeah it'd be helpful @huy-nguyen if you could do a bit of "binary search" to find exactly what causes it as the errors make it sound like it's not the selectors that are a problem, and find the minimum change to your css that'll make it stop erroring as that'll give us a better idea. |
@mxstbr I tried this import styled from 'styled-components';
const StyledTable = styled.div`
${/* sc-selector */tableColumnSelector}:nth-child(1) {
width: ${/* sc-value */ rankColumnWidth};
}
`; and this (removed semicolon): import styled from 'styled-components';
const StyledTable = styled.div`
${/* sc-selector */tableColumnSelector}:nth-child(1) {
width: ${/* sc-value */ rankColumnWidth}
}
`; and this import styled from 'styled-components';
const StyledTable = styled.div`
${/* sc-selector */tableColumnSelector}:nth-child(1) {
width: ${/* sc-custom '5px' */ rankColumnWidth};
}
`; but all gave the same errors. I'm not sure what else to try. |
Well this all helps of course, as it narrows it down to the interpolations though that was probably already pretty clear. What about trying replacing each of the interpolations by a normal constant css string and seeing which one is causing the error like that? :) |
I think it's the selector interpolation. This (removed the value interpolation) gives the same error: import styled from 'styled-components';
const StyledTable = styled.div`
${/* sc-selector */tableColumnSelector}:nth-child(1) {
width: 5px;
}
`; but this (removed the selector interpolation) does not: import styled from 'styled-components';
const StyledTable = styled.div`
td:nth-child(1) {
width: ${/* sc-value */ rankColumnWidth};
}
`; |
Great, that's very helpful. If you want to be even more helpful you can submit a PR with a breaking test like what was just done in #129 for #128. Then we'll get on it. Given your extra tests I also think I'll change the tag to bug as it seems pretty obvious from those tests that the fault is somewhere on our end. |
@emilgoldsmith I'm in a bit of a crunch right now to clone, add the tests and make a PR but I think it wouldn't take much time for someone else to pick it up from here. |
Yeah no worries, no requirements, just suggestions for positive ways to help speed up the process :). |
The current processor implementation can't recognize the selector interpolation here. And it will be substituted by Even with interpolation tagging, it doesn't work because |
Oh that makes sense, thanks for that information @chinesedfan, because then of course we can't do the interpolation tagging. We should probably also add this to the README on the website, I'll get on that later today. |
Hi @emilgoldsmith, have it been added? Not a push, just curious. 😄 |
Nope I must've forgotten! Thanks for the reminder I'll do it right now |
Any suggestions on workarounds for this? Currently I'm resorting to |
Hmm, that's probably the best approach as of right now I'm sorry! |
#143 should have fixed this, publishing now |
Thanks for fixing it! |
The update we need the most is `stylelint-processor-styled-components` because it fixes non-working interpolation tags (styled-components/stylelint-processor-styled-components#130).
I tried to lint this this typescript file (simplified):
and got this error:
I then tried to use the interpolation tagging with
sc-selector
:but got the same errors. I then tried using
sc-custom
as the last resort:but still got the same errors. Here's my
stylelint
config:Is this a bug with the processor or am I not using it correctly? Here are the relevant package versions.
stylelint
8.1.1stylelint-config-standard
17.0.0stylelint-processor-styled-components
1.0.0stylelint-config-styled-components
typescript
2.5.2 (but I'm not using any 2.5 feature and the example still fails withtypescript-eslint-parser
8.0 which supportstypescript
2.5)The text was updated successfully, but these errors were encountered: