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

Implement the at-use-no-unnamespaced rule #569

Merged
merged 1 commit into from
Dec 21, 2021

Conversation

stof
Copy link
Contributor

@stof stof commented Dec 1, 2021

Closes #565

@stof
Copy link
Contributor Author

stof commented Dec 1, 2021

My implementation is incomplete. It won't catch configured modules, as the configuration comes after the namespace in the rule.

@stof stof force-pushed the rule_use_no_unnamespaced branch from 2a25f2b to 349e574 Compare December 1, 2021 14:06
@stof
Copy link
Contributor Author

stof commented Dec 1, 2021

And here is the complete implementation

export const ruleName = namespace("at-use-no-unnamespaced");

export const messages = utils.ruleMessages(ruleName, {
expected: "Expected @use to use a namespace"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went and checked from the stylelint repo, and most of the -no- rules seem to use the rejected: "Unexpected ..." message format, should this rule also use it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated it

@stof stof force-pushed the rule_use_no_unnamespaced branch from 349e574 to 98103ec Compare December 2, 2021 08:51
Copy link
Collaborator

@kristerkari kristerkari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! This can probably go to the next release (v4.1.0)

@kristerkari kristerkari merged commit 6ff4d1e into stylelint-scss:master Dec 21, 2021
@kristerkari
Copy link
Collaborator

This was released in 4.1.0:
https://github.com/stylelint-scss/stylelint-scss/releases/tag/v4.1.0

Thank you @stof !

@stof stof deleted the rule_use_no_unnamespaced branch December 21, 2021 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Rule idea: forbid unnamespaced module usages
2 participants