-
-
Notifications
You must be signed in to change notification settings - Fork 19
feat: add no-invalid-import-placement rule #156
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
feat: add no-invalid-import-placement rule #156
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR, the code mostly LGTM. Just a few suggestions
if (IGNORED_AT_RULES.has(name)) { | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not an invalid placement though?
}, | ||
|
||
Rule() { | ||
hasSeenNonImportRule = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we set it to false again once the traversing is complete?
recommended: true, | ||
url: "https://github.com/eslint/css/blob/main/docs/rules/no-invalid-import-placement.md", | ||
}, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's also add the ignoreAtRules
option similar to https://stylelint.io/user-guide/rules/no-invalid-position-at-import-rule/#ignoreatrules?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I considered it but didn’t find a need. Want it added anyway?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, we should add it for easy migration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've decided to expand no-invalid-import-placement to no-invalid-at-rule-placement. Given this change, should we rename the ignoreAtRules option to something more specific, like ignoreAtRulesForImport?
Superseded by #171 |
Prerequisites checklist
What is the purpose of this pull request?
This pull request introduces a new rule
no-invalid-import-placement
that enforces correct placement of@import
rules within stylesheets.What changes did you make? (Give an overview)
no-invalid-import-placement
rule to enforce correct placement of@import
rulesRelated Issues
Fixes #151
Is there anything you'd like reviewers to focus on?