Skip to content

Rule proposition: Maximum number of props per line #47

Closed
@filipalacerda

Description

@filipalacerda

We often struggle to read templates with a different number of props per line.

This rule would limit the maximum number of props on a single line can to improve readability.
There should also be the possibility to disable this rule when a tag has only one prop.

Proposal
'vue/max-props-per-line': {max: Number, when: 'always|multiline'}

The default could be: 'vue/max-props-per-line': {max: 1, when: 'always'}

  1. Enforcing one prop per line always 'vue/max-props-per-line': {max: 1, when: 'always'}
<component 
  prop="something"
  foo="bar"
  />

<component
  prop="something"
  />
  1. Enforcing one prop per line only when it has multilines it would accept: 'vue/max-props-per-line': {max: 1, when: 'multiline'}
<component prop="something" foo="bar" />

<component
  prop="something"
  foo="bar" 
  />

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions