Skip to content

Commit a4ac565

Browse files
authored
Format documents (#1511)
1 parent e9d20fd commit a4ac565

10 files changed

+33
-67
lines changed

docs/rules/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@ Enforce all the rules in this category, as well as all higher priority rules, wi
4242
| [vue/no-arrow-functions-in-watch](./no-arrow-functions-in-watch.md) | disallow using arrow functions to define watcher | |
4343
| [vue/no-async-in-computed-properties](./no-async-in-computed-properties.md) | disallow asynchronous actions in computed properties | |
4444
| [vue/no-deprecated-data-object-declaration](./no-deprecated-data-object-declaration.md) | disallow using deprecated object declaration on data (in Vue.js 3.0.0+) | :wrench: |
45-
| [vue/no-deprecated-destroyed-lifecycle](./no-deprecated-destroyed-lifecycle.md) | disallow using deprecated `destroyed` and `beforeDestroy` lifecycle hooks (in Vue.js 3.0.0+) | |
45+
| [vue/no-deprecated-destroyed-lifecycle](./no-deprecated-destroyed-lifecycle.md) | disallow using deprecated `destroyed` and `beforeDestroy` lifecycle hooks (in Vue.js 3.0.0+) | :wrench: |
4646
| [vue/no-deprecated-dollar-listeners-api](./no-deprecated-dollar-listeners-api.md) | disallow using deprecated `$listeners` (in Vue.js 3.0.0+) | |
4747
| [vue/no-deprecated-dollar-scopedslots-api](./no-deprecated-dollar-scopedslots-api.md) | disallow using deprecated `$scopedSlots` (in Vue.js 3.0.0+) | :wrench: |
4848
| [vue/no-deprecated-events-api](./no-deprecated-events-api.md) | disallow using deprecated events api (in Vue.js 3.0.0+) | |
4949
| [vue/no-deprecated-filter](./no-deprecated-filter.md) | disallow using deprecated filters syntax (in Vue.js 3.0.0+) | |
5050
| [vue/no-deprecated-functional-template](./no-deprecated-functional-template.md) | disallow using deprecated the `functional` template (in Vue.js 3.0.0+) | |
5151
| [vue/no-deprecated-html-element-is](./no-deprecated-html-element-is.md) | disallow using deprecated the `is` attribute on HTML elements (in Vue.js 3.0.0+) | |
5252
| [vue/no-deprecated-inline-template](./no-deprecated-inline-template.md) | disallow using deprecated `inline-template` attribute (in Vue.js 3.0.0+) | |
53-
| [vue/no-deprecated-props-default-this](./no-deprecated-props-default-this.md) | disallow props default function `this` access | |
53+
| [vue/no-deprecated-props-default-this](./no-deprecated-props-default-this.md) | disallow deprecated `this` access in props default function (in Vue.js 3.0.0+) | |
5454
| [vue/no-deprecated-scope-attribute](./no-deprecated-scope-attribute.md) | disallow deprecated `scope` attribute (in Vue.js 2.5.0+) | :wrench: |
5555
| [vue/no-deprecated-slot-attribute](./no-deprecated-slot-attribute.md) | disallow deprecated `slot` attribute (in Vue.js 2.6.0+) | :wrench: |
5656
| [vue/no-deprecated-slot-scope-attribute](./no-deprecated-slot-scope-attribute.md) | disallow deprecated `slot-scope` attribute (in Vue.js 2.6.0+) | :wrench: |
@@ -314,7 +314,7 @@ For example:
314314
| [vue/no-restricted-v-bind](./no-restricted-v-bind.md) | disallow specific argument in `v-bind` | |
315315
| [vue/no-static-inline-styles](./no-static-inline-styles.md) | disallow static inline `style` attributes | |
316316
| [vue/no-template-target-blank](./no-template-target-blank.md) | disallow target="_blank" attribute without rel="noopener noreferrer" | |
317-
| [vue/no-this-in-before-route-enter](./no-this-in-before-route-enter.md) | disallow this usage in a beforeRouteEnter method | |
317+
| [vue/no-this-in-before-route-enter](./no-this-in-before-route-enter.md) | disallow `this` usage in a `beforeRouteEnter` method | |
318318
| [vue/no-unregistered-components](./no-unregistered-components.md) | disallow using components that are not registered inside templates | |
319319
| [vue/no-unsupported-features](./no-unsupported-features.md) | disallow unsupported Vue.js syntax on the specified version | :wrench: |
320320
| [vue/no-unused-properties](./no-unused-properties.md) | disallow unused properties | |

docs/rules/no-deprecated-destroyed-lifecycle.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ since: v7.0.0
1010
> disallow using deprecated `destroyed` and `beforeDestroy` lifecycle hooks (in Vue.js 3.0.0+)
1111
1212
- :gear: This rule is included in all of `"plugin:vue/vue3-essential"`, `"plugin:vue/vue3-strongly-recommended"` and `"plugin:vue/vue3-recommended"`.
13+
- :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.
1314

1415
## :book: Rule Details
1516

1617
This rule reports use of deprecated `destroyed` and `beforeDestroy` lifecycle hooks. (in Vue.js 3.0.0+).
1718

18-
<eslint-code-block :rules="{'vue/no-deprecated-destroyed-lifecycle': ['error']}">
19+
<eslint-code-block fix :rules="{'vue/no-deprecated-destroyed-lifecycle': ['error']}">
1920

2021
```vue
2122
<script>

docs/rules/no-deprecated-props-default-this.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
pageClass: rule-details
33
sidebarDepth: 0
44
title: vue/no-deprecated-props-default-this
5-
description: disallow props default function `this` access
5+
description: disallow deprecated `this` access in props default function (in Vue.js 3.0.0+)
66
since: v7.0.0
77
---
88
# vue/no-deprecated-props-default-this
99

10-
> disallow props default function `this` access
10+
> disallow deprecated `this` access in props default function (in Vue.js 3.0.0+)
1111
1212
- :gear: This rule is included in all of `"plugin:vue/vue3-essential"`, `"plugin:vue/vue3-strongly-recommended"` and `"plugin:vue/vue3-recommended"`.
1313

docs/rules/no-deprecated-v-is.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,16 @@ Use [`is` attribute with `vue:` prefix](https://v3.vuejs.org/api/special-attribu
3232

3333
</eslint-code-block>
3434

35+
## :couple: Related Rules
36+
37+
- [vue/valid-v-is]
38+
39+
[vue/valid-v-is]: ./valid-v-is.md
40+
3541
## :books: Further Reading
3642

37-
- [v-is](https://v3.vuejs.org/api/directives.html#v-is)
43+
- [API - v-is](https://v3.vuejs.org/api/directives.html#v-is)
44+
- [API - v-is (Old)](https://github.com/vuejs/docs-next/blob/008613756c3d781128d96b64a2d27f7598f8f548/src/api/directives.md#v-is)
3845

3946
## :mag: Implementation
4047

docs/rules/no-this-in-before-route-enter.md

+9-58
Original file line numberDiff line numberDiff line change
@@ -2,77 +2,29 @@
22
pageClass: rule-details
33
sidebarDepth: 0
44
title: vue/no-this-in-before-route-enter
5-
description: disallow this usage in a beforeRouteEnter method
5+
description: disallow `this` usage in a `beforeRouteEnter` method
66
---
77
# vue/no-this-in-before-route-enter
88

9-
> disallow this usage in a beforeRouteEnter method
9+
> disallow `this` usage in a `beforeRouteEnter` method
1010
1111
- :exclamation: <badge text="This rule has not been released yet." vertical="middle" type="error"> ***This rule has not been released yet.*** </badge>
1212

13-
## Rule Details
13+
## :book: Rule Details
1414

1515
Because lack of `this` in the `beforeRouteEnter` [(docs)](https://router.vuejs.org/guide/advanced/navigation-guards.html#in-component-guards). This behavior isn't obvious, so it's pretty easy to make a `TypeError`. Especially during some refactor.
1616

17-
Bad:
18-
19-
<eslint-code-block :rules="{'vue/no-this-in-before-route-enter': ['error']}">
20-
21-
```vue
22-
<script>
23-
export default {
24-
beforeRouteEnter() {
25-
this.method(); // Uncaught TypeError: Cannot read property 'method' of undefined
26-
}
27-
}
28-
</script>
29-
```
30-
31-
</eslint-code-block>
32-
33-
Bad:
34-
3517
<eslint-code-block :rules="{'vue/no-this-in-before-route-enter': ['error']}">
3618

3719
```vue
3820
<script>
3921
export default {
4022
beforeRouteEnter() {
23+
/* ✗ BAD */
24+
this.method(); // Uncaught TypeError: Cannot read property 'method' of undefined
4125
this.attribute = 42;
42-
}
43-
}
44-
</script>
45-
```
46-
47-
</eslint-code-block>
48-
49-
Bad:
50-
51-
<eslint-code-block :rules="{'vue/no-this-in-before-route-enter': ['error']}">
52-
53-
```vue
54-
<script>
55-
export default {
56-
beforeRouteEnter() {
5726
if (this.value === 42) {
58-
5927
}
60-
}
61-
}
62-
</script>
63-
```
64-
65-
</eslint-code-block>
66-
67-
68-
Bad:
69-
70-
<eslint-code-block :rules="{'vue/no-this-in-before-route-enter': ['error']}">
71-
72-
```vue
73-
<script>
74-
export default {
75-
beforeRouteEnter() {
7628
this.attribute = this.method();
7729
}
7830
}
@@ -81,14 +33,13 @@ export default {
8133

8234
</eslint-code-block>
8335

84-
Good:
85-
8636
<eslint-code-block :rules="{'vue/no-this-in-before-route-enter': ['error']}">
8737

8838
```vue
8939
<script>
9040
export default {
9141
beforeRouteEnter() {
42+
/* ✓ GOOD */
9243
// anything without this
9344
}
9445
}
@@ -97,15 +48,15 @@ export default {
9748

9849
</eslint-code-block>
9950

100-
### Options
51+
## :wrench: Options
10152

10253
Nothing.
10354

104-
## When Not To Use It
55+
## :mute: When Not To Use It
10556

10657
When [vue-router](https://router.vuejs.org/) is not installed.
10758

108-
## Further Reading
59+
## :books: Further Reading
10960

11061
[vue-router - in-component-guards](https://router.vuejs.org/guide/advanced/navigation-guards.html#in-component-guards)
11162

docs/rules/no-unsupported-features.md

+1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ The `"ignores"` option accepts an array of the following strings.
9696
## :books: Further Reading
9797

9898
- [API - v-is](https://v3.vuejs.org/api/directives.html#v-is)
99+
- [API - v-is (Old)](https://github.com/vuejs/docs-next/blob/008613756c3d781128d96b64a2d27f7598f8f548/src/api/directives.md#v-is)
99100
- [Guide - Dynamic Arguments](https://v3.vuejs.org/guide/template-syntax.html#dynamic-arguments)
100101
- [API - v-slot](https://v3.vuejs.org/api/directives.html#v-slot)
101102
- [API (for v2) - slot-scope](https://vuejs.org/v2/api/#slot-scope-deprecated)

docs/rules/valid-v-is.md

+3
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,16 @@ Nothing.
5151

5252
## :couple: Related Rules
5353

54+
- [vue/no-deprecated-v-is]
5455
- [vue/no-parsing-error]
5556

57+
[vue/no-deprecated-v-is]: ./no-deprecated-v-is.md
5658
[vue/no-parsing-error]: ./no-parsing-error.md
5759

5860
## :books: Further Reading
5961

6062
- [API - v-is](https://v3.vuejs.org/api/directives.html#v-is)
63+
- [API - v-is (Old)](https://github.com/vuejs/docs-next/blob/008613756c3d781128d96b64a2d27f7598f8f548/src/api/directives.md#v-is)
6164

6265
## :rocket: Version
6366

lib/rules/no-deprecated-props-default-this.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ module.exports = {
1818
meta: {
1919
type: 'problem',
2020
docs: {
21-
description: 'disallow props default function `this` access',
21+
description:
22+
'disallow deprecated `this` access in props default function (in Vue.js 3.0.0+)',
2223
categories: ['vue3-essential'],
2324
url: 'https://eslint.vuejs.org/rules/no-deprecated-props-default-this.html'
2425
},

lib/rules/no-this-in-before-route-enter.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module.exports = {
1818
meta: {
1919
type: 'problem',
2020
docs: {
21-
description: 'disallow this usage in a beforeRouteEnter method',
21+
description: 'disallow `this` usage in a `beforeRouteEnter` method',
2222
categories: null,
2323
url: 'https://eslint.vuejs.org/rules/no-this-in-before-route-enter.html'
2424
},

lib/rules/valid-v-is.js

+2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ module.exports = {
3939
type: 'problem',
4040
docs: {
4141
description: 'enforce valid `v-is` directives',
42+
// TODO Switch to `undefined` in the major version.
43+
// categories: undefined,
4244
categories: ['vue3-essential'],
4345
url: 'https://eslint.vuejs.org/rules/valid-v-is.html'
4446
},

0 commit comments

Comments
 (0)