Skip to content

Rule proposal: props-names-casing #252

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

Closed
michalsnik opened this issue Nov 26, 2017 · 2 comments
Closed

Rule proposal: props-names-casing #252

michalsnik opened this issue Nov 26, 2017 · 2 comments

Comments

@michalsnik
Copy link
Member

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
}
@mysticatea
Copy link
Member

Could we use just core camelcase rule?

@michalsnik
Copy link
Member Author

Core rule won't work in case someone's using array of props @mysticatea

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

No branches or pull requests

2 participants