Skip to content
This repository has been archived by the owner on Apr 20, 2021. It is now read-only.

Allow specifying syntax #69

Open
cdauth opened this issue Feb 26, 2019 · 8 comments
Open

Allow specifying syntax #69

cdauth opened this issue Feb 26, 2019 · 8 comments

Comments

@cdauth
Copy link

cdauth commented Feb 26, 2019

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.

@emilgoldsmith
Copy link
Owner

That shouldn't be a problem no, see styled-components/stylelint-processor-styled-components#171 and styled-components/stylelint-processor-styled-components#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

@cdauth
Copy link
Author

cdauth commented Feb 26, 2019

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.

@cdauth
Copy link
Author

cdauth commented Feb 26, 2019

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.

@jeddy3
Copy link

jeddy3 commented Feb 27, 2019

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 styled-components/stylelint-processor-styled-components#170 (comment), but I don't think it supports inline comments.

As such, users might need to set the syntax to SCSS to use inline comments.

@emilgoldsmith
Copy link
Owner

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?

@cdauth
Copy link
Author

cdauth commented Feb 28, 2019

It cannot be specified in the stylelintrc config file, but it can be in the options of the API call, as documented here.

@emilgoldsmith emilgoldsmith reopened this Feb 28, 2019
@emilgoldsmith
Copy link
Owner

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

@jeddy3
Copy link

jeddy3 commented Feb 28, 2019

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants