Skip to content

Rule Proposal vue/closing-bracket-location #169

Closed
@mikegreiling

Description

@mikegreiling

Please describe what the rule should do:

Provide a template rule similar to react/jsx-closing-bracket-location for vue templates.

This rule would govern the indentation style for the closing bracket of html tags within vue components when a tag spans multiple lines. (single-line tags are fine)

What category of rule is this? (place an "X" next to just one item)

[X] Enforces code style
[ ] Warns about a potential error
[ ] Suggests an alternate way of doing something
[ ] Other (please specify:)

Provide 2-3 code examples that this rule will warn about:

Configuration

'vue/closing-bracket-location': ['tag-aligned' | 'line-aligned' | 'after-props' | 'props-aligned']

Examples:

The following would not produce errors:

// 'vue/closing-bracket-location': [1, 'line-aligned']

<my-component
  really-long-param="foo"
  another-really-long-param="bar"
/>

Foo: <my-component
  really-long-param="foo"
  another-really-long-param="bar"
/>

<my-other-component
  really-long-param="foo"
  another-really-long-param="bar"
>
  Hello World!
</my-other-component>


// 'vue/closing-bracket-location': [1, 'tag-aligned']

<my-component
  really-long-param="foo"
  another-really-long-param="bar"
/>

Foo: <my-component
       really-long-param="foo"
       another-really-long-param="bar"
     />

<my-other-component
  really-long-param="foo"
  another-really-long-param="bar"
>
  Hello World!
</my-other-component>


// 'vue/closing-bracket-location': [1, 'after-props']

<my-component
  really-long-param="foo"
  another-really-long-param="bar" />

<my-other-component
  really-long-param="foo"
  another-really-long-param="bar">
  Hello World!
</my-other-component>


// 'vue/closing-bracket-location': [1, 'props-aligned']

<my-component
  really-long-param="foo"
  another-really-long-param="bar"
  />

<my-other-component
  really-long-param="foo"
  another-really-long-param="bar"
  >
  Hello World!
</my-other-component>

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions