Skip to content

Rule proposal: props-names-casing #252

Closed
@michalsnik

Description

@michalsnik

Style guide:
https://vuejs.org/v2/style-guide/#Prop-name-casing-strongly-recommended

Description:
This rule would enforce proper casing of props in vue components (camelCase).
We already have a rule for checking HTML attributes casing, and this would make a good addition to that rule.

We could add different casing as options and set camelCase as default, but I think we should definitely forbid two of them anyway:

  • kebab-case - which doesn't make any sense and should be avoided
  • PascalCase - as this is the casing recommended for components, and users should not be able to mix props with components

so in the end there may be two options:

  • camelCase
  • snake_case

Which makes me think if this rule shouldn't be named props-camel-casing and force only one style of props names.

// bad
props: {
  'greeting-text': String
}
// good
props: {
  greetingText: String
}

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