twbs/stylelint-config-twbs-bootstrap

no-invalid-position-at-import-rule needs to be disabled for scss

fgblomqvist opened this issue · 8 comments

I'm hitting this since upgrading from 2.1.0 to 2.2.0: stylelint/stylelint#5322
Rather than just blindly disabling it in your stylelint config, I believe it should be fixed upstream.

I don't think https://github.com/kristerkari/stylelint-config-recommended-scss suffers from it (yet) because they have yet to update to stylelint-config-recommended 5.0 (which enables this rule). So perhaps the problem is in this repo and related to how you extend the scss config as well as your own css config? Not sure how the priorities work there.

Hmm, perhaps we should disable the rule in the Scss config indeed. Right now the scss config inherits from the CSS config where the rule is enabled.

Out of curiosity, why does the scss config inherit from css? Doesn't that defeat a part of the purpose of keeping them separate?

Because many rules are common and it's been working for us for all these years.

The issue rn is that by inheriting from css in scss, you also inherit stylelint-config-standard. That one in turn inherits stylelint-config-recommended. That doesn't feel right.

With your current setup, your SCSS extends chain look like this:

  1. stylelint-config-recommended - OK
  2. stylelint-config-recommended-scss - Disables some CSS-specific stuff from the -recommended one
  3. stylelint-config-recommended - This undoes step 2
  4. stylelint-config-standard - OK
  5. ../css - OK

I've bolded the ones you directly reference from your scss config. As you can see, step 2 is redundant. It would make sense to therefore drop the dep on that one (it does so little and is barely even maintained anymore) which would reduce confusion and "clean up" your chain so that you're extending from various CSS configs, then finally (in your SCSS one) do SCSS stuff.

Will try the patch (but I'm 99% sure it'll work).

It worked.

We don't have the bandwidth to work on cleaning the configs, but you are welcome to provide a PR assuming all the current rules are still included.

I'll make a new release for this.