Skip to content

Commit 415fae5

Browse files
author
David Lomas
committed
Add documentation
1 parent 5f57e49 commit 415fae5

File tree

2 files changed

+42
-2
lines changed

2 files changed

+42
-2
lines changed

docs/rules/multiline-html-element-content-newline.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ This rule enforces a line break before and after the contents of a multiline ele
8282
"vue/multiline-html-element-content-newline": ["error", {
8383
"ignoreWhenEmpty": true,
8484
"ignores": ["pre", "textarea", ...INLINE_ELEMENTS],
85-
"allowEmptyLines": false
85+
"allowEmptyLines": false,
86+
"ignoreComments": false
8687
}]
8788
}
8889
```
@@ -93,6 +94,8 @@ This rule enforces a line break before and after the contents of a multiline ele
9394
default `["pre", "textarea", ...INLINE_ELEMENTS]`.
9495
- `allowEmptyLines` ... if `true`, it allows empty lines around content. If you want to disallow multiple empty lines, use [no-multiple-empty-lines] in combination.
9596
default `false`
97+
- `ignoreComments` ... if `true`, it allows comments to be on the same line as the tag.
98+
default `false`
9699

97100
::: info
98101
All inline non void elements can be found [here](https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/utils/inline-non-void-elements.json).
@@ -143,6 +146,23 @@ This rule enforces a line break before and after the contents of a multiline ele
143146

144147
</eslint-code-block>
145148

149+
### `"ignoreComments": true`
150+
151+
<eslint-code-block fix :rules="{'vue/multiline-html-element-content-newline': ['error', { ignoreComments: true }]}">
152+
153+
```vue
154+
<template>
155+
<!-- ✓ GOOD -->
156+
<div class="red"> <!-- or "blue" -->
157+
content
158+
</div>
159+
</template>
160+
```
161+
162+
</eslint-code-block>
163+
164+
165+
146166
## :books: Further Reading
147167

148168
- [no-multiple-empty-lines]

docs/rules/singleline-html-element-content-newline.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ This rule enforces a line break before and after the contents of a singleline el
5858
"ignoreWhenNoAttributes": true,
5959
"ignoreWhenEmpty": true,
6060
"ignores": ["pre", "textarea", ...INLINE_ELEMENTS],
61-
"externalIgnores": []
61+
"externalIgnores": [],
62+
"ignoreComments": false
63+
6264
}]
6365
}
6466
```
@@ -71,6 +73,8 @@ This rule enforces a line break before and after the contents of a singleline el
7173
default `["pre", "textarea", ...INLINE_ELEMENTS]`
7274
- `externalIgnores` ... the configuration for external element names to ignore line breaks style, it allows avoiding overwrite the default value of ignores.
7375
default `[]`
76+
- `ignoreComments` ... if `true`, it allows comments (but not content, including whitespace) on a single line.
77+
default `false`
7478

7579
::: info
7680
All inline non void elements can be found [here](https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/utils/inline-non-void-elements.json).
@@ -110,6 +114,22 @@ This rule enforces a line break before and after the contents of a singleline el
110114

111115
</eslint-code-block>
112116

117+
### `"ignoreComments": true`
118+
119+
<eslint-code-block fix :rules="{'vue/singleline-html-element-content-newline': ['error', {'ignoreComments': true}]}">
120+
121+
```vue
122+
<template>
123+
<!-- ✗ BAD -->
124+
<div attr>content</div>
125+
126+
<!-- ✓ GOOD -->
127+
<div attr><!-- comment --></div>
128+
</template>
129+
```
130+
131+
</eslint-code-block>
132+
113133
## :rocket: Version
114134

115135
This rule was introduced in eslint-plugin-vue v5.0.0

0 commit comments

Comments
 (0)