File tree Expand file tree Collapse file tree 1 file changed +27
-36
lines changed Expand file tree Collapse file tree 1 file changed +27
-36
lines changed Original file line number Diff line number Diff line change 5
5
6
6
## :book : Rule Details
7
7
8
- This rule aims to enforce unified spacing in mustache interpolations.
9
-
10
- :-1 : Examples of ** incorrect** code for this rule:
11
-
12
- ``` html
13
- <div >{{ text }}</div >
14
- <div >{{text}}</div >
15
- ```
16
-
17
- :+1 : Examples of ** correct** code for this rule:
18
-
19
- ``` html
20
- <div >{{ text }}</div >
21
- ```
8
+ This rule aims at enforcing unified spacing in mustache interpolations.
22
9
23
10
## :wrench : Options
24
11
25
- Default spacing is set to ` always `
26
-
27
- ```
28
- 'vue/mustache-interpolation-spacing': [2, 'always'|'never']
12
+ ``` json
13
+ {
14
+ "vue/mustache-interpolation-spacing" : [ " error " , " always " | "never" ]
15
+ }
29
16
```
30
17
31
- ### ` "always" ` - Expect one space between expression and curly brackets.
18
+ - ` "always" ` (default) ... Expect one space between expression and curly brackets.
19
+ - ` "never" ` ... Expect no spaces between expression and curly brackets.
32
20
33
- : -1 : Examples of ** incorrect ** code for this rule:
21
+ ### ` "always" `
34
22
35
- ``` html
36
- <div >{{ text }}</div >
37
- <div >{{text}}</div >
23
+ <eslint-code-block :rules =" {'vue/mustache-interpolation-spacing': ['error']} " >
38
24
```
25
+ <template>
26
+ <!-- ✓ GOOD -->
27
+ <div>{{ text }}</div>
28
+ <div>{{ text }}</div><!-- Use vue/no-multi-spaces rule to disallow multiple spaces. -->
39
29
40
- :+1 : Examples of ** correct** code for this rule:
41
-
42
- ``` html
43
- <div >{{ text }}</div >
30
+ <!-- ✗ BAD -->
31
+ <div>{{text}}</div>
32
+ </template>
44
33
```
34
+ </eslint-code-block >
45
35
46
- ### ` "never" ` - Expect no spaces between expression and curly brackets.
36
+ ### ` "never" `
47
37
48
- :-1 : Examples of ** incorrect** code for this rule:
49
-
50
- ``` html
51
- <div >{{ text }}</div >
38
+ <eslint-code-block :rules =" {'vue/mustache-interpolation-spacing': ['error', 'never']} " >
52
39
```
40
+ <template>
41
+ <!-- ✓ GOOD -->
42
+ <div>{{text}}</div>
53
43
54
- : +1 : Examples of ** correct ** code for this rule:
55
-
56
- ``` html
57
- <div >{{text}}</ div >
44
+ <!-- ✗ BAD -->
45
+ <div>{{ text }}</div>
46
+ <div>{{ text }}</div>
47
+ </template >
58
48
```
49
+ </eslint-code-block >
59
50
60
51
## :mag : Implementation
61
52
You can’t perform that action at this time.
0 commit comments