Skip to content

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

Closed
@FloEdelmann

Description

@FloEdelmann

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions