You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/rules/html-closing-bracket-new-line.md
+37-6Lines changed: 37 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ description: "require or disallow a line break before tag's closing brackets"
14
14
15
15
## :book: Rule Details
16
16
17
-
This rule reports ???.
17
+
This rule enforces a line break (or no line break) before tag's closing brackets, which can also be configured to be enforced on self-closing tags.
18
18
19
19
<ESLintCodeBlockfix>
20
20
@@ -26,8 +26,31 @@ This rule reports ???.
26
26
</script>
27
27
28
28
<!-- ✓ GOOD -->
29
+
<div></div>
30
+
<div
31
+
multiline
32
+
>
33
+
Children
34
+
</div>
35
+
36
+
<SelfClosing />
37
+
<SelfClosing
38
+
multiline
39
+
/>
29
40
30
41
<!-- ✗ BAD -->
42
+
43
+
<div
44
+
></div>
45
+
<div
46
+
multiline>
47
+
Children
48
+
</div>
49
+
50
+
<SelfClosing
51
+
/>
52
+
<SelfClosing
53
+
multiline />
31
54
```
32
55
33
56
</ESLintCodeBlock>
@@ -36,15 +59,23 @@ This rule reports ???.
36
59
37
60
```json
38
61
{
39
-
"svelte/brackets-same-line": ["error", {}]
62
+
"svelte/brackets-same-line": ["error", {
63
+
"singleline": "never", // ["never", "always"]
64
+
"multiline": "always", // ["never", "always"]
65
+
"selfClosingTag": {
66
+
"singleline": "never", // ["never", "always"]
67
+
"multiline": "always"// ["never", "always"]
68
+
}
69
+
}]
40
70
}
41
71
```
42
72
43
-
-
44
-
45
-
## :books: Further Reading
73
+
-`singleline`: (`"never"` by default) Configuration for single-line elements. It's a single-line element if the element does not have attributes or the last attribute is on the same line as the opening bracket.
74
+
-`multiline`: (`"always"` by default) Configuration for multi-line elements. It's a multi-line element if the last attribute is not on the same line of the opening bracket.
75
+
-`selfClosingTag.singleline`: Configuration for single-line self closing elements.
76
+
-`selfClosingTag.multiline`: Configuration for multi-line self closing elements.
46
77
47
-
-
78
+
The `selfClosing` is optional, and by default it will use the same configuration as `singleline` and `multiline`, respectively.
0 commit comments