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 suggestion: vue/prefer-prop-type-boolean-first #1797

Closed
FloEdelmann opened this issue Feb 9, 2022 · 3 comments · Fixed by #1822
Closed

Rule suggestion: vue/prefer-prop-type-boolean-first #1797

FloEdelmann opened this issue Feb 9, 2022 · 3 comments · Fixed by #1822

Comments

@FloEdelmann
Copy link
Member

FloEdelmann commented Feb 9, 2022

Please describe what the rule should do:
In a prop definition with multiple allowed types, the rule suggests to put Boolean first to allow shorthand boolean props (see #775, #1781, #1796).

What category should the rule belong to?
[ ] Enforces code style (layout)
[x] 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:

export default {
  props: {
    // PASS
    foo: Boolean,
    foo: String,
    foo: [Boolean],
    foo: [Boolean, String],
    foo: { type: Boolean },
    foo: { type: String },
    foo: { type: [Boolean] },
    foo: { type: [Boolean, String] },

    // FAIL
    foo: [String, Boolean],
    foo: { type: [String, Boolean] },
  },
}
@ota-meshi
Copy link
Member

SGTM!

@FloEdelmann
Copy link
Member Author

@g-plane Would you maybe be interested in implementing this rule? (No problem if you are not 🙂)

@g-plane
Copy link
Contributor

g-plane commented Feb 23, 2022

I would like, but I don't have too much time so I may be slow to finish.

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.

3 participants