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/no-prop-default-true #1806

Closed
FloEdelmann opened this issue Feb 22, 2022 · 2 comments
Closed

Rule suggestion: vue/no-prop-default-true #1806

FloEdelmann opened this issue Feb 22, 2022 · 2 comments

Comments

@FloEdelmann
Copy link
Member

FloEdelmann commented Feb 22, 2022

Please describe what the rule should do:
For prop definitions, the rule reports default: true.
Boolean props with default: false can use the shorthand syntax (see #775, #1781, #1796, #1797).

What category should the rule belong to?
[ ] Enforces code style (layout)
[ ] Warns about a potential error (problem)
[x] 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: { type: Boolean },
    foo: { type: String },
    foo: { type: [Boolean, String] },
    foo: { type: Boolean, default: false },
    foo: { type: String, default: false },
    foo: { type: [Boolean, String], default: false },

    // FAIL
    foo: { type: Boolean, default: true },
    foo: { type: String, default: true },
    foo: { type: [Boolean, String], default: true },
  },
}
@FloEdelmann
Copy link
Member Author

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

@FloEdelmann
Copy link
Member Author

Oh sorry, this rule does already exist!

See https://eslint.vuejs.org/rules/no-boolean-default.html

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

No branches or pull requests

1 participant