-
-
Notifications
You must be signed in to change notification settings - Fork 681
New rule: prefer-true-attribute-shorthand #1781
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 rule proposal. <script>
export default {
name: 'MyComponent',
props: {
a: Boolean,
b: [String, Boolean]
}
}
</script>
<template>
<pre>
a: {{a}}
b: {{b}}
</pre>
</template> <template>
<MyComponent a b/>
<MyComponent :a="true" :b="true"/>
</template> So far, I haven't found a way to distinguish them well. If you have a good idea, please let me know. |
If you change the order of types, both will give the same result. <script>
export default {
name: 'MyComponent',
props: {
a: Boolean,
- b: [String, Boolean]
+ b: [Boolean, String]
}
}
</script> |
Duplicate of #775 |
We still can report errors, but instead of providing auto fix, we can provide suggestions. |
Sounds good to me! |
Please describe what the rule should do:
In template, if there's an attribute whose value is
true
, such as:show="true"
, this rule will warn and provide auto fix (becomesshow
, see the example below). This can reduce verbosity.What category should the rule belong to?
[x] Suggests an alternate way of doing something (suggestion)
Provide 2-3 code examples that this rule should warn about:
Invalid:
which can be fixed to:
The text was updated successfully, but these errors were encountered: