@@ -14,30 +14,33 @@ There is a configurable number of attributes that are acceptable in one-line cas
14
14
:-1 : Examples of ** incorrect** code for this rule:
15
15
16
16
``` html
17
- <component lorem =" 1" ipsum =" 2" dolor =" 3" sit =" 4" >
18
- </component >
17
+ <MyComponent lorem =" 1" ipsum =" 2" />
19
18
20
- <component
19
+ <MyComponent
20
+ lorem =" 1" ipsum =" 2"
21
+ />
22
+
23
+ <MyComponent
21
24
lorem =" 1" ipsum =" 2"
22
25
dolor =" 3"
23
- sit =" 4"
24
- >
25
- </component >
26
+ />
26
27
```
27
28
28
29
:+1 : Examples of ** correct** code for this rule:
29
30
30
31
``` html
31
- <component lorem =" 1" ipsum =" 2" dolor =" 3" >
32
- </component >
32
+ <MyComponent lorem =" 1" />
33
+
34
+ <MyComponent
35
+ lorem =" 1"
36
+ ipsum =" 2"
37
+ />
33
38
34
- <component
39
+ <MyComponent
35
40
lorem =" 1"
36
41
ipsum =" 2"
37
42
dolor =" 3"
38
- sit =" 4"
39
- >
40
- </component >
43
+ />
41
44
```
42
45
43
46
### :wrench : Options
@@ -55,67 +58,67 @@ There is a configurable number of attributes that are acceptable in one-line cas
55
58
```
56
59
57
60
#### ` allowFirstLine `
61
+
58
62
For multi-line declarations, defines if allows attributes to be put in the first line. (Default false)
59
63
60
64
:-1 : Example of ** incorrect** code for this setting:
65
+
61
66
``` html
62
- // [{ "multiline": { "allowFirstLine": false }}]
63
- <component foo =" John" bar = " Smith "
64
- foobar = {5555555} >
65
- </ component >;
67
+ <!-- [{ "multiline": { "allowFirstLine": false }}] -->
68
+ <MyComponent foo =" John"
69
+ bar = " Smith "
70
+ />
66
71
```
67
72
68
73
:+1 : Example of ** correct** code for this setting:
74
+
69
75
``` html
70
- // [{ "multiline": { "allowFirstLine": false }}]
71
- <component
76
+ <!-- [{ "multiline": { "allowFirstLine": false }}] -->
77
+ <MyComponent
72
78
foo =" John"
73
79
bar =" Smith"
74
- foobar ={5555555}
75
- >
76
- </component >;
80
+ />
77
81
```
78
82
79
-
80
83
#### ` singleline `
81
- Number of maximum attributes per line when the opening tag is in a single line. (Default is 3)
84
+
85
+ Number of maximum attributes per line when the opening tag is in a single line. (Default is 1)
82
86
83
87
:-1 : Example of ** incorrect** code for this setting:
84
88
``` html
85
- // [{"singleline": 2,}]
86
- <component foo =" John" bar =" Smith" foobar = {5555555} ></ component >;
89
+ <!-- [{"singleline": 1}] -->
90
+ <MyComponent foo =" John" bar =" Smith" />
87
91
```
88
92
89
93
:+1 : Example of ** correct** code for this setting:
90
94
``` html
91
- // [{"singleline": 3,}]
92
- <component foo =" John" bar = " Smith " foobar = {5555555} ></ component >;
95
+ <!-- [{"singleline": 1}] -->
96
+ <MyComponent foo =" John" />
93
97
```
94
98
95
-
96
99
#### ` multiline `
100
+
97
101
Number of maximum attributes per line when a tag is in multiple lines. (Default is 1)
98
102
99
103
:-1 : Example of ** incorrect** code for this setting:
104
+
100
105
``` html
101
- // [{"multiline": 1}]
102
- <component foo = " John " bar = " Smith "
103
- foobar = {5555555} >
104
- </ component >;
106
+ <!-- [{"multiline": 1}] -->
107
+ <MyComponent
108
+ foo = " John " bar = " Smith "
109
+ />
105
110
```
106
111
107
112
:+1 : Example of ** correct** code for this setting:
113
+
108
114
``` html
109
- // [{"multiline": 1}]
110
- <component
115
+ <!-- [{"multiline": 1}] -->
116
+ <MyComponent
111
117
foo =" John"
112
118
bar =" Smith"
113
- foobar ={5555555}
114
- >
115
- </component >;
119
+ />
116
120
```
117
121
118
122
## When Not To Use It
119
123
120
124
If you do not want to check the number of attributes declared per line you can disable this rule.
121
-
0 commit comments