Closed ntdesmond closed 1 year ago
Thank you for your report!
it didn't handle the interpolation properly
Could you explain what was the problem?
I guess it has something to do with indentation rule that I use in my config.
You're right. There is an issue within indentation
rule code. This issue won't be fixed, because indentation
rule will be deprecated in upcoming stylelint v15.
Unexpected unknown function "${" function-no-unknown
Again, issue with stylelint rule. This is something I can look into, as it's also in my to-do :)
Funny fact, postcss-styled-components
doesn't show an error, because it replace value of font-size
and Stylelint see it as font-size: POSTCSS_styled-components_0
.
P.S. I switched to 43081j/postcss-styled-components which does not have these issues.
Whatever works for you. Be aware that it currently doesn't support a lot of things related to interpolations and throws parsing errors in many common styled-components use cases. But I know that author of that package works to improve support.
For function-no-unknown
for now you could use:
'function-no-unknown': [
true,
{
ignoreFunctions: [/^\${/, /^`/],
},
],
I used this configuration with @stylelint/postcss-css-in-js
and it works with this syntax.
Opened a PR in stylelint https://github.com/stylelint/stylelint/pull/6565
function-no-unknown
will be fixed in stylelint v15, when it's released.
Any chance the indentation
bug gets fixed, to be compatible with https://github.com/elirasza/stylelint-stylistic or https://github.com/firefoxic/stylelint-codeguide ?
@meriouma it's up to developers of indentation
rule to adjust it to work with this syntax. I'm pretty sure the rule is written for standard CSS and it doesn't expect to have properties outside of rules as we have in CSS-in-JS.
I searched a syntax that would not report arrow functions in interpolation as @stylelint/postcss-css-in-js does.
Tried your package and not only it didn't handle the interpolation properly, but reported even more errors as it didn't like the indentation. I guess it has something to do with
indentation
rule that I use in my config.Technical details
package versions from
package.json
:.stylelintrc
:P.S. I switched to 43081j/postcss-styled-components which does not have these issues.