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

Add ignoreAtRules: [] to no-invalid-position-at-import-rule #5492

Closed
GrimLink opened this issue Aug 23, 2021 · 8 comments · Fixed by #5520
Closed

Add ignoreAtRules: [] to no-invalid-position-at-import-rule #5492

GrimLink opened this issue Aug 23, 2021 · 8 comments · Fixed by #5520
Labels
status: ready to implement is ready to be worked on by someone type: new option a new option for an existing rule

Comments

@GrimLink
Copy link

It would be nice to have an option to keep the no-invalid-position-at-import-rule on and also support @use.
This syntax is used by both Sass but some PostCSS plugins also use at rules in the CSS directly.
Adding this option give some flexibility.

Not a must for me, but it would be a nice to have.

@ybiquitous
Copy link
Member

@GrimLink Can you check #5322, please?

@GrimLink
Copy link
Author

@ybiquitous I did 😉
And the related tickets.

I am not having an issue with it at the moment,
since I just disabled the rule no-invalid-position-at-import-rule in my scss config.

I am just asking for an option so I can keep no-invalid-position-at-import-rule enabled,
and also allow other at-rules on top.

@ybiquitous
Copy link
Member

I see. Is it possible to use /* stylelint-disable */ inline comments in your case?

For example:

/* stylelint-disable-next-line no-invalid-position-at-import-rule */
@use "...";

@import "...";

See also https://stylelint.io/user-guide/ignore-code/#within-files

@GrimLink
Copy link
Author

@ybiquitous it is for me,
but I also work in a team.
And my colleges only use stylelint and don't configure it or exclude rules.
Which you want to avoid to keep consistency.

I was just wondering this could be an option, as I already mentioned in my previous comments

@Semigradsky
Copy link

Semigradsky commented Aug 23, 2021

Ideally it would be to create scss/at-import-no-invalid-position rule but option would be nice workaround.

@ybiquitous
Copy link
Member

ybiquitous commented Aug 23, 2021

@Semigradsky Thanks for the help. As you commented, it seems ideal also to me to add a new rule to the stylelint-scss plugin like scss/at-rule-unknown. The rule handles @use internally.

@jeddy3 jeddy3 changed the title ADD: option ignoreAtRules to no-invalid-position-at-import-rule Add ignoreAtRules: [] to no-invalid-position-at-import-rule Aug 24, 2021
@jeddy3 jeddy3 added status: ready to implement is ready to be worked on by someone type: new option a new option for an existing rule labels Aug 24, 2021
@jeddy3
Copy link
Member

jeddy3 commented Aug 24, 2021

@GrimLink Thanks for the request.

Adding this option give some flexibility.

I agree. The primary purpose of secondary options is to make rules more permissive. We can add an ignoreAtRules: [] secondary option to the rule.

As @Semigradsky and @ybiquitous suggested, this would eventually make it into stylelint-scss as scss/at-import-no-invalid-position, which would make use of this new ignoreAtRules: [] secondary option and the checkAgainstRule util.

I've labelled the issue as ready to implement. Please consider contributing if you have time.

There are steps on how to add a new option in the Developer guide.

Please branch of v14 rather than master.


For context, this earlier comment is about @import being proceeded by rule-sets rather than other at-rules. This request is different as it about the interplay between @use and @import.

@jeddy3
Copy link
Member

jeddy3 commented Sep 17, 2021

Done in #5520

@jeddy3 jeddy3 closed this as completed Sep 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: ready to implement is ready to be worked on by someone type: new option a new option for an existing rule
Development

Successfully merging a pull request may close this issue.

4 participants