8000 Update · vuejs/eslint-plugin-vue@6206cc9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6206cc9

Browse files
committed
Update
- v-on-style - v-bind-style
1 parent dd84609 commit 6206cc9

File tree

3 files changed

+49
-42
lines changed

3 files changed

+49
-42
lines changed

docs/rules/attribute-hyphenation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Default casing is set to `always` with `['data-', 'aria-', 'slot-scope']` set to
1111
{
1212
"vue/attribute-hyphenation": [2, "always" | "never", {
1313
"ignore": ["custom-prop"]
14-
}}]
14+
}]
1515
}
1616
```
1717

docs/rules/v-bind-style.md

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,21 @@
33
- :gear: This rule is included in `"plugin:vue/strongly-recommended"` and `"plugin:vue/recommended"`.
44
- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
55

6-
This rule enforces `v-bind` directive style which you should use shorthand or long form.
7-
86
## :book: Rule Details
97

10-
:-1: Examples of **incorrect** code for this rule:
11-
12-
```html
13-
<div v-bind:foo="bar"/>
14-
```
15-
16-
:+1: Examples of **correct** code for this rule:
17-
18-
```html
19-
<div :foo="bar"/>
20-
```
21-
22-
:-1: Examples of **incorrect** code for this rule with `"longform"` option:
8+
This rule enforces `v-bind` directive style which you should use shorthand or long form.
239

10+
<eslint-code-block :rules="{'vue/v-bind-style': ['error']}">
2411
```html
25-
<div :foo="bar"/>
26-
```
27-
28-
:+1: Examples of **correct** code for this rule with `"longform"` option:
12+
<template>
13+
<!-- ✓ GOOD -->
14+
<div :foo="bar"/>
2915

30-
```html
31-
<div v-bind:foo="bar"/>
16+
<!-- ✗ BAD -->
17+
<div v-bind:foo="bar"/>
18+
</template>
3219
```
20+
</eslint-code-block>
3321

3422
## :wrench: Options
3523
Default is set to `shorthand`.
@@ -43,6 +31,21 @@ Default is set to `shorthand`.
4331
- `"shorthand"` (default) ... requires using shorthand.
4432
- `"longform"` ... requires using long form.
4533

34+
### `"longform"`
35+
36+
<eslint-code-block :rules="{'vue/v-bind-style': ['error', 'longform']}">
37+
```html
38+
<template>
39+
<!-- ✓ GOOD -->
40+
<div v-bind:foo="bar"/>
41+
42+
<!-- ✗ BAD -->
43+
<div :foo="bar"/>
44+
</template>
45+
```
46+
</eslint-code-block>
47+
48+
4649
## Related links
4750

4851
- [Style guide - Directive shorthands](https://vuejs.org/v2/style-guide/#Directive-shorthands-strongly-recommended)

docs/rules/v-on-style.md

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,22 @@
33
- :gear: This rule is included in `"plugin:vue/strongly-recommended"` and `"plugin:vue/recommended"`.
44
- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
55

6-
This rule enforces `v-on` directive style which you should use shorthand or long form.
76

87
## :book: Rule Details
98

10-
:-1: Examples of **incorrect** code for this rule:
11-
12-
```html
13-
<div v-on:click="foo"/>
14-
```
15-
16-
:+1: Examples of **correct** code for this rule:
9+
This rule enforces `v-on` directive style which you should use shorthand or long form.
1710

11+
<eslint-code-block :rules="{'vue/v-on-style': ['error']}">
1812
```html
19-
<div @click="foo"/>
20-
```
21-
22-
:-1: Examples of **incorrect** code for this rule with `"longform"` option:
13+
<template>
14+
<!-- ✓ GOOD -->
15+
<div @click="foo"/>
2316

24-
```html
25-
<div @click="foo"/>
26-
```
27-
28-
:+1: Examples of **correct** code for this rule with `"longform"` option:
29-
30-
```html
31-
<div v-on:click="foo"/>
17+
<!-- ✗ BAD -->
18+
<div v-on:click="foo"/>
19+
</template>
3220
```
21+
</eslint-code-block>
3322

3423
## :wrench: Options
3524
Default is set to `shorthand`.
@@ -43,6 +32,21 @@ Default is set to `shorthand`.
4332
- `"shorthand"` (default) ... requires using shorthand.
4433
- `"longform"` ... requires using long form.
4534

35+
### `"longform"`
36+
37+
<eslint-code-block :rules="{'vue/v-on-style': ['error', 'longform']}">
38+
```html
39+
<template>
40+
<!-- ✓ GOOD -->
41+
<div v-on:click="foo"/>
42+
43+
<!-- ✗ BAD -->
44+
<div @click="foo"/>
45+
</template>
46+
```
47+
</eslint-code-block>
48+
49+
4650
## Related links
4751

4852
- [Style guide - Directive shorthands](https://vuejs.org/v2/style-guide/#Directive-shorthands-strongly-recommended)

0 commit comments

Comments
 (0)
0