Skip to content

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

Closed
@FloEdelmann

Description

@FloEdelmann

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] },
  },
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions