Skip to content

Commit c1a2d3d

Browse files
committed
update html-indent
1 parent 40de2a3 commit c1a2d3d

File tree

1 file changed

+33
-35
lines changed

1 file changed

+33
-35
lines changed

docs/rules/html-indent.md

Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,13 @@ This rule enforces a consistent indentation style in `<template>`. The default s
1010
- This rule checks all tags, also all expressions in directives and mustaches.
1111
- In the expressions, this rule supports ECMAScript 2017 syntaxes. It ignores unknown AST nodes, but it might be confused by non-standard syntaxes.
1212

13-
:-1: Examples of **incorrect** code for this rule:
14-
15-
```html
16-
<template>
17-
<div class="foo">
18-
Hello.
19-
</div>
20-
</template>
13+
<eslint-code-block :rules="{'vue/html-indent': ['error']}">
2114
```
22-
23-
:+1: Examples of **correct** code for this rule:
24-
25-
```html
2615
<template>
16+
<!-- ✓ GOOD -->
2717
<div class="foo">
2818
Hello.
2919
</div>
30-
</template>
31-
```
32-
33-
```html
34-
<template>
3520
<div class="foo">
3621
Hello.
3722
</div>
@@ -56,8 +41,14 @@ This rule enforces a consistent indentation style in `<template>`. The default s
5641
displayMessage
5742
}}
5843
</div>
44+
45+
<!-- ✗ BAD -->
46+
<div class="foo">
47+
Hello.
48+
</div>
5949
</template>
6050
```
51+
</eslint-code-block>
6152

6253
## :wrench: Options
6354

@@ -78,10 +69,12 @@ This rule enforces a consistent indentation style in `<template>`. The default s
7869
- `alignAttributesVertically` (`boolean`) ... Condition for whether attributes should be vertically aligned to the first attribute in multiline case or not. Default is `true`
7970
- `ignores` (`string[]`) ... The selector to ignore nodes. The AST spec is [here](https://github.com/mysticatea/vue-eslint-parser/blob/master/docs/ast.md). You can use [esquery](https://github.com/estools/esquery#readme) to select nodes. Default is an empty array.
8071

81-
:+1: Examples of **correct** code for `{attribute: 1, closeBracket: 1}`:
72+
### `2, {"attribute": 1, "closeBracket": 1}`
8273

83-
```html
74+
<eslint-code-block :rules="{'vue/html-indent': ['error', 2, {attribute: 1, closeBracket: 1}]}">
75+
```
8476
<template>
77+
<!-- ✓ GOOD -->
8578
<div
8679
id="a"
8780
class="b"
@@ -94,11 +87,14 @@ This rule enforces a consistent indentation style in `<template>`. The default s
9487
</div>
9588
</template>
9689
```
90+
</eslint-code-block>
9791

98-
:+1: Examples of **correct** code for `{attribute: 2, closeBracket: 1}`:
92+
### `2, {"attribute": 2, "closeBracket": 1}`
9993

100-
```html
94+
<eslint-code-block :rules="{'vue/html-indent': ['error', 2, {attribute: 2, closeBracket: 1}]}">
95+
```
10196
<template>
97+
<!-- ✓ GOOD -->
10298
<div
10399
id="a"
104100
class="b"
@@ -111,39 +107,41 @@ This rule enforces a consistent indentation style in `<template>`. The default s
111107
</div>
112108
</template>
113109
```
110+
</eslint-code-block>
114111

115-
:+1: Examples of **correct** code for `{ignores: ["VAttribute"]}`:
112+
### `2, {"ignores": ["VAttribute"]}`
116113

117-
```html
114+
<eslint-code-block :rules="{'vue/html-indent': ['error', 2, {ignores: ['VAttribute']}]}">
115+
```
118116
<template>
117+
<!-- ✓ GOOD -->
119118
<div
120119
id=""
121120
class=""
122121
/>
123122
</template>
124123
```
124+
</eslint-code-block>
125125

126-
:+1: Examples of **correct** code for `{alignAttributesVertically: true}`:
126+
### `2, {"alignAttributesVertically": false}`
127127

128-
```html
129-
<template>
130-
<div id=""
131-
class=""
132-
some-attr=""
133-
/>
134-
</template>
128+
<eslint-code-block :rules="{'vue/html-indent': ['error', 2, {alignAttributesVertically: false}]}">
135129
```
136-
137-
:+1: Examples of **correct** code for `{alignAttributesVertically: false}`:
138-
139-
```html
140130
<template>
131+
<!-- ✓ GOOD -->
141132
<div id=""
142133
class=""
143134
some-attr=""
144135
/>
136+
137+
<!-- ✗ BAD -->
138+
<div id=""
139+
class=""
140+
some-attr=""
141+
/>
145142
</template>
146143
```
144+
</eslint-code-block>
147145

148146
## :mag: Implementation
149147

0 commit comments

Comments
 (0)