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

Rule Proposal: Boolean prop shorthand (prop instead of :prop="true") #775

Closed
2 of 4 tasks
manniL opened this issue Jan 14, 2019 · 2 comments · Fixed by #1796
Closed
2 of 4 tasks

Rule Proposal: Boolean prop shorthand (prop instead of :prop="true") #775

manniL opened this issue Jan 14, 2019 · 2 comments · Fixed by #1796

Comments

@manniL
Copy link
Contributor

manniL commented Jan 14, 2019

Please describe what the rule should do:

I've seen code like <div :boolProp="true" /> often where you could use <div boolProp /> instead. I'd love to see a rule for that (plus an auto-fix option which should be fairly possible)

What category should the rule belong to?

  • Enforces code style
  • Warns about a potential error
  • Suggests an alternate way of doing something
  • Other (please specify:)

Provide 2-3 code examples that this rule should warn about:

<template>
  <div>
    <button :disabled="true">
  </div>
</template>
@armano2
Copy link
Collaborator

armano2 commented Jan 14, 2019

i think there should be an option to enable/disable this feature.

  • always (default)
// valid
<button disabled>
// invalid
<button :disabled="true">
  • never
// valid
<button :disabled="true">
// invalid
<button disabled>

what do you think about naming it as require-shorthand-boolean-prop or something similar

@manniL
Copy link
Contributor Author

manniL commented Jan 14, 2019

@armano2 Fully agree. always/never should be configurable.

Like the name ☺️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants