Skip to content

Commit f6d7fb4

Browse files
committed
update mustache-interpolation-spacing
1 parent 53e01ff commit f6d7fb4

File tree

1 file changed

+27
-36
lines changed

1 file changed

+27
-36
lines changed

docs/rules/mustache-interpolation-spacing.md

Lines changed: 27 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,57 +5,48 @@
55

66
## :book: Rule Details
77

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.
229

2310
## :wrench: Options
2411

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+
}
2916
```
3017

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.
3220

33-
:-1: Examples of **incorrect** code for this rule:
21+
### `"always"`
3422

35-
```html
36-
<div>{{ text }}</div>
37-
<div>{{text}}</div>
23+
<eslint-code-block :rules="{'vue/mustache-interpolation-spacing': ['error']}">
3824
```
25+
<template>
26+
<!-- ✓ GOOD -->
27+
<div>{{ text }}</div>
28+
<div>{{ text }}</div><!-- Use vue/no-multi-spaces rule to disallow multiple spaces. -->
3929
40-
:+1: Examples of **correct** code for this rule:
41-
42-
```html
43-
<div>{{ text }}</div>
30+
<!-- ✗ BAD -->
31+
<div>{{text}}</div>
32+
</template>
4433
```
34+
</eslint-code-block>
4535

46-
### `"never"` - Expect no spaces between expression and curly brackets.
36+
### `"never"`
4737

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']}">
5239
```
40+
<template>
41+
<!-- ✓ GOOD -->
42+
<div>{{text}}</div>
5343
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>
5848
```
49+
</eslint-code-block>
5950

6051
## :mag: Implementation
6152

0 commit comments

Comments
 (0)