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
# Define the number of attributes allows per line (max-attributes-per-line)
2
+
3
+
Limits the maximum number of attributes/properties per line to improve readability.
4
+
5
+
6
+
## :book: Rule Details
7
+
8
+
This rule aims to enforce a number of attributes per line in templates.
9
+
It checks all the elements in a template and verifies that the number of attributes per line does not exceed the defined maximum.
10
+
An attribute is considered to be in a new line when there is a line break between two attributes.
11
+
12
+
There is a configurable number of attributes that are acceptable in one-line case (default 3), as well as how many attributes are acceptable per line in multi-line case (default 1).
13
+
14
+
:-1: Examples of **incorrect** code for this rule:
15
+
16
+
```html
17
+
<componentlorem="1"ipsum="2"dolor="3"sit="4">
18
+
</component>
19
+
20
+
<component
21
+
lorem="1"ipsum="2"
22
+
dolor="3"
23
+
sit="4"
24
+
>
25
+
</component>
26
+
```
27
+
28
+
:+1: Examples of **correct** code for this rule:
29
+
30
+
```html
31
+
<componentlorem="1"ipsum="2"dolor="3">
32
+
</component>
33
+
34
+
<component
35
+
lorem="1"
36
+
ipsum="2"
37
+
dolor="3"
38
+
sit="4"
39
+
>
40
+
</component>
41
+
42
+
```
43
+
44
+
### :wrench: Options
45
+
46
+
```
47
+
{
48
+
"vue/max-attributes-per-line": [{
49
+
"singleline": 3,
50
+
"multiline": {
51
+
max: 1,
52
+
allowFirstLine: false
53
+
}
54
+
}]
55
+
}
56
+
```
57
+
58
+
#### `allowFirstLine`
59
+
For multi-line declarations, defines if allows attributes to be put in the first line. (Default false)
60
+
61
+
:-1: Example of **incorrect** code for this setting:
62
+
```html
63
+
// [{ "multiline": { "allowFirstLine": false }}]
64
+
<componentfoo="John"bar="Smith"
65
+
foobar={5555555}>
66
+
</component>;
67
+
```
68
+
69
+
:+1: Example of **correct** code for this setting:
70
+
```html
71
+
// [{ "multiline": { "allowFirstLine": false }}]
72
+
<component
73
+
foo="John"
74
+
bar="Smith"
75
+
foobar={5555555}
76
+
>
77
+
</component>;
78
+
```
79
+
80
+
81
+
#### `singleline`
82
+
Number of maximum attributes per line when the opening tag is in a single line. (Default is 3)
83
+
84
+
:-1: Example of **incorrect** code for this setting:
# enforce unified spacing in mustache interpolations. (mustache-interpolation-spacing)
2
+
3
+
-:wrench: The `--fix` option on the [command line](http://eslint.org/docs/user-guide/command-line-interface#fix) can automatically fix some of the problems reported by this rule.
4
+
5
+
## :book: Rule Details
6
+
7
+
This rule aims to enforce unified spacing in mustache interpolations.
8
+
9
+
:-1: Examples of **incorrect** code for this rule:
0 commit comments