-
-
Notifications
You must be signed in to change notification settings - Fork 681
Rule Proposal: vue/enforce-style-attribute
#2109
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
Comments
Thank you for the rule proposal. Also, I have a similar rule available in another plugin. I think it would be better if we changed your implementation rule to accept options similar to the |
Thank you for the feedback and for linking to the other plugin! I think that makes sense. I will modify the implementation to accept the same options. |
Please describe what the rule should do:
Many projects agree on using one specific way of writing CSS. For example, using CSS Modules, strictly using Scoped CSS, or a combination of the two, which may be rare but could happen when migrating from one style to another.
This rule helps developers enforce one or either of the two attributes in SFCs.
What category should the rule belong to?
[x] Enforces code style (layout)
[ ] Warns about a potential error (problem)
[ ] Suggests an alternate way of doing something (suggestion)
[ ] Other (please specify:)
Provide 2-3 code examples that this rule should warn about:
Option
either
: No warning as long as one attribute is specified. Does not enforce one specific style.<!-- ✓ GOOD --> <style scoped></style> <style lang="scss" src="../path/to/style.scss" scoped></style> <!-- ✓ GOOD --> <style module></style> <!-- ✗ BAD --> <style></style>
Option
scoped
: Style tags must have thescoped
attribute.<!-- ✓ GOOD --> <style scoped></style> <style lang="scss" src="../path/to/style.scss" scoped></style> <!-- ✗ BAD --> <style module></style> <style></style>
Option
module
: Style tags must have themodule
attribute.<!-- ✓ GOOD --> <style module></style> <!-- ✗ BAD --> <style scoped></style> <style lang="scss" src="../path/to/style.scss" scoped></style> <style></style>
The text was updated successfully, but these errors were encountered: