stylelint-custom-processor-loader
stylelint-custom-processor-loader copied to clipboard
Allow specifying syntax
When using stylelint-custom-processor-loader with styled-components, the syntax parameter needs to be set to scss, otherwise some language features will not work (such as inline comments, see styled-components/stylelint-processor-styled-components#195).
It would be nice if the syntax parameter could be specified in the config object of the loader.
That shouldn't be a problem no, see https://github.com/styled-components/stylelint-processor-styled-components/pull/171 and https://github.com/styled-components/stylelint-processor-styled-components/issues/170
We initially thought so too but were enlightened by @jeddy3 from Stylelint.
If you have any other information than this feel free to share it but otherwise I'm closing this
I'm getting lost in docs.
My inline comments are triggering errors when I use this loader, how can I solve it then? When running stylelint manually, I can fix it by specifying --syntax scss.
The issue styled-components/stylelint-processor-styled-components#170 that you are linking simply explains the fact that the syntax property is not supported in the .stylelintrc config file. But it is still supported and I believe also necessary as a CLI/API parameter.
We initially thought so too but were enlightened by @jeddy3 from Stylelint.
I'm afraid I might have been wrong. The default PostCSS parser supports the interpolation and nesting I tried in https://github.com/styled-components/stylelint-processor-styled-components/issues/170#issuecomment-370135195, but I don't think it supports inline comments.
As such, users might need to set the syntax to SCSS to use inline comments.
Hmm okay @jeddy3. But if I recall correctly you said that setting the 'syntax' option in config simply didn't exist and it was only a CLI option? Or is that misremembered by me / outdated information?
It cannot be specified in the stylelintrc config file, but it can be in the options of the API call, as documented here.
Yes of course, @cdauth if you'd like to submit a PR I'll be happy to review it and publish a new version. But I have a lot of things going on so I won't have the time to implement it myself at the moment
Hmm okay @jeddy3. But if I recall correctly you said that setting the 'syntax' option in config simply didn't exist and it was only a CLI option
That's correct. It can't be set in the configuration object but it can be set using CLI or, as @cdauth pointed out, using the Node.js API.