UNPKG

2.15 kBMarkdownView Raw
1# block-opening-brace-newline-after
2
3Require a newline after the opening brace of blocks.
4
5<!-- prettier-ignore -->
6```css
7 a {
8 ↑ color: pink; }
9/** ↑
10 * The newline after this brace */
11```
12
13This rule allows an end-of-line comment followed by a newline. For example,
14
15<!-- prettier-ignore -->
16```css
17a { /* end-of-line comment */
18 color: pink;
19}
20```
21
22Refer to [combining rules](../../../docs/user-guide/rules/combine.md) for more information on using this rule with [`block-opening-brace-newline-before`](../block-opening-brace-newline-before/README.md) to disallow single-line rules.
23
24The [`fix` option](../../../docs/user-guide/usage/options.md#fix) can automatically fix all of the problems reported by this rule.
25
26## Options
27
28`string`: `"always"|"always-multi-line"|"never-multi-line"`
29
30### `"always"`
31
32There _must always_ be a newline after the opening brace.
33
34The following patterns are considered violations:
35
36<!-- prettier-ignore -->
37```css
38a{ color: pink; }
39```
40
41<!-- prettier-ignore -->
42```css
43a{ color: pink;
44}
45```
46
47<!-- prettier-ignore -->
48```css
49a{ /* end-of-line comment
50 with a newline */
51 color: pink;
52}
53```
54
55The following patterns are _not_ considered violations:
56
57<!-- prettier-ignore -->
58```css
59a {
60color: pink; }
61```
62
63<!-- prettier-ignore -->
64```css
65a
66{
67color: pink; }
68```
69
70<!-- prettier-ignore -->
71```css
72a { /* end-of-line comment */
73 color: pink;
74}
75```
76
77### `"always-multi-line"`
78
79There _must always_ be a newline after the opening brace in multi-line blocks.
80
81The following patterns are considered violations:
82
83<!-- prettier-ignore -->
84```css
85a{color: pink;
86}
87```
88
89The following patterns are _not_ considered violations:
90
91<!-- prettier-ignore -->
92```css
93a { color: pink; }
94```
95
96<!-- prettier-ignore -->
97```css
98a {
99color: pink; }
100```
101
102### `"never-multi-line"`
103
104There _must never_ be whitespace after the opening brace in multi-line blocks.
105
106The following patterns are considered violations:
107
108<!-- prettier-ignore -->
109```css
110a { color: pink;
111}
112```
113
114The following patterns are _not_ considered violations:
115
116<!-- prettier-ignore -->
117```css
118a { color: pink; }
119```
120
121<!-- prettier-ignore -->
122```css
123a {color: pink;
124}
125```