Skip to content

Commit 4a60998

Browse files
committed
update html-closing-bracket-newline
1 parent 2f451eb commit 4a60998

File tree

1 file changed

+44
-47
lines changed

1 file changed

+44
-47
lines changed

docs/rules/html-closing-bracket-newline.md

Lines changed: 44 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,49 @@ This rule enforces a line break (or no line break) before tag's closing brackets
88

99
```html
1010
<div
11-
id="foo"
12-
class="bar"> <!-- On the same line with the last attribute. -->
11+
id="foo"
12+
class="bar"> <!-- On the same line with the last attribute. -->
1313
</div>
1414

1515
<div
16-
id="foo"
17-
class="bar"
16+
id="foo"
17+
class="bar"
1818
> <!-- On the next line. -->
1919
</div>
2020
```
2121

22-
## Rule Details
22+
## :book: Rule Details
23+
24+
This rule aims to warn the right angle brackets which are at the location other than the configured location.
25+
26+
<eslint-code-block :rules="{'vue/html-closing-bracket-newline': ['error']}">
27+
```
28+
<template>
29+
<!-- ✓ GOOD -->
30+
<div id="foo" class="bar">
31+
<div
32+
id="foo"
33+
class="bar"
34+
>
35+
36+
<!-- ✗ BAD -->
37+
<div id="foo" class="bar"
38+
>
39+
<div
40+
id="foo"
41+
class="bar">
42+
</template>
43+
```
44+
</eslint-code-block>
45+
46+
## :wrench: Options
2347

2448
```json
2549
{
26-
"vue/html-closing-bracket-newline": ["error", {
27-
"singleline": "never",
28-
"multiline": "always"
29-
}]
50+
"vue/html-closing-bracket-newline": ["error", {
51+
"singleline": "never",
52+
"multiline": "always"
53+
}]
3054
}
3155
```
3256

@@ -39,51 +63,24 @@ This rule enforces a line break (or no line break) before tag's closing brackets
3963

4064
Plus, you can use [`vue/html-indent`](./html-indent.md) rule to enforce indent-level of the closing brackets.
4165

42-
:-1: Examples of **incorrect** code for this rule:
43-
44-
```html
45-
<!-- eslint html-closing-bracket-newline: "error" -->
46-
47-
<div id="foo" class="bar"
48-
>
66+
### `{ "multiline": "never" }`
4967

50-
<div
51-
id="foo"
52-
class="bar">
68+
<eslint-code-block :rules="{'vue/html-closing-bracket-newline': ['error', { 'multiline': 'never' }]}">
5369
```
54-
55-
:+1: Examples of **correct** code for this rule:
56-
57-
```html
58-
<!-- eslint html-closing-bracket-newline: "error" -->
59-
60-
<div id="foo" class="bar">
61-
<div
70+
<template>
71+
<!-- ✓ GOOD -->
72+
<div
6273
id="foo"
63-
class="bar"
64-
>
65-
```
66-
67-
:-1: Examples of **incorrect** code for `{ "multiline": "never" }`:
68-
69-
```html
70-
<!-- eslint html-closing-bracket-newline: ["error", { multiline: never }] -->
74+
class="bar">
7175
72-
<div
76+
<!-- ✗ BAD -->
77+
<div
7378
id="foo"
7479
class="bar"
75-
>
76-
```
77-
78-
:+1: Examples of **correct** code for `{ "multiline": "never" }`:
79-
80-
```html
81-
<!-- html-closing-bracket-newline: ["error", { multiline: never }] -->
82-
83-
<div
84-
id="foo"
85-
class="bar">
80+
>
81+
</template>
8682
```
83+
</eslint-code-block>
8784

8885
## :mag: Implementation
8986

0 commit comments

Comments
 (0)