Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not run scss/* rules on non-SCSS files #4262

Closed
unikitty37 opened this issue Sep 8, 2019 · 4 comments
Closed

Do not run scss/* rules on non-SCSS files #4262

unikitty37 opened this issue Sep 8, 2019 · 4 comments
Labels
status: needs discussion triage needs further discussion

Comments

@unikitty37
Copy link

What is the problem you're trying to solve?

I use SCSS, and the stylelint-scss rules at https://github.com/kristerkari/stylelint-scss. However, there are some plain CSS files in the project as well, and some stylelint-scss rules do not work well when run against plain CSS.

(Example: setting scss/comment-no-loud to true means no comments can be used in .css files, as it disallows /* … */ and only permits // — but this is not valid in plain CSS.

What solution would you like to see?

An ability to prevent SCSS-specific rules from running on non-SCSS files.

Ideally, stylelint-scss would be able to declare that its rules should only run against files detected to be SCSS (whether by checking the extension or some other means).

A second-best option would be allow stylelint-disable to accept wildcards — placing stylelint-disable scss/* at the start of every .css file would be annoying, but a reasonable workaround. Listing every rule starting scss/ individually would not be reasonable 😁 — nor would leaving the offending rules disabled by default and manually enabling them at the top of .scss files

I originally filed this at stylelint-scss/stylelint-scss#352, but was told it needed to be addressed in stylelint itself.

@vankop
Copy link
Member

vankop commented Sep 8, 2019

As a workaround I can suggest run stylelint twice with different configs. I don't know good solution for IDE stylelint support.

@vankop vankop added the status: needs discussion triage needs further discussion label Sep 8, 2019
@hudochenkov
Copy link
Member

Some of stylelint-scss could be applied to non-SCSS syntaxes. E. g. if someone uses $variables in their style sheet with PostCSS plugin. Then they could use dollar-variables rules from stylelint-scss, while not using SCSS itself.

We have two solutions:

  1. overrides object in configuration Add overrides property to configuration object #3128 But it's not implemented yet :(
  2. Use separate configs and run stylelint twice. You can extends you main config in config for CSS and run stylelint for CSS as: stylelint "**/*.css" --config my-stylelint-css-config.json.

@jeddy3
Copy link
Member

jeddy3 commented Sep 10, 2019

overrides object in configuration #3128 But it's not implemented yet :(

Yep, I think this is covered by the overrides feature that is present in other linters. @unikitty37 That issue is labeled as "help wanted", so feel free to contribute it if you've time.


Closing in favour of #3128

@jeddy3 jeddy3 closed this as completed Sep 10, 2019
@unikitty37
Copy link
Author

Unfortunately, the workaround is no workaround for me, as I need IDE support :(

I wish I had time — and enough Node knowledge — to help on #3128

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs discussion triage needs further discussion
Development

No branches or pull requests

4 participants