Skip to content

Commit

Permalink
Format documents (#1511)
Browse files Browse the repository at this point in the history
  • Loading branch information
ota-meshi committed Jun 9, 2021
1 parent e9d20fd commit a4ac565
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 67 deletions.
6 changes: 3 additions & 3 deletions docs/rules/README.md
Expand Up @@ -42,15 +42,15 @@ Enforce all the rules in this category, as well as all higher priority rules, wi
| [vue/no-arrow-functions-in-watch](./no-arrow-functions-in-watch.md) | disallow using arrow functions to define watcher | |
| [vue/no-async-in-computed-properties](./no-async-in-computed-properties.md) | disallow asynchronous actions in computed properties | |
| [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: |
| [vue/no-deprecated-destroyed-lifecycle](./no-deprecated-destroyed-lifecycle.md) | disallow using deprecated `destroyed` and `beforeDestroy` lifecycle hooks (in Vue.js 3.0.0+) | |
| [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: |
| [vue/no-deprecated-dollar-listeners-api](./no-deprecated-dollar-listeners-api.md) | disallow using deprecated `$listeners` (in Vue.js 3.0.0+) | |
| [vue/no-deprecated-dollar-scopedslots-api](./no-deprecated-dollar-scopedslots-api.md) | disallow using deprecated `$scopedSlots` (in Vue.js 3.0.0+) | :wrench: |
| [vue/no-deprecated-events-api](./no-deprecated-events-api.md) | disallow using deprecated events api (in Vue.js 3.0.0+) | |
| [vue/no-deprecated-filter](./no-deprecated-filter.md) | disallow using deprecated filters syntax (in Vue.js 3.0.0+) | |
| [vue/no-deprecated-functional-template](./no-deprecated-functional-template.md) | disallow using deprecated the `functional` template (in Vue.js 3.0.0+) | |
| [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+) | |
| [vue/no-deprecated-inline-template](./no-deprecated-inline-template.md) | disallow using deprecated `inline-template` attribute (in Vue.js 3.0.0+) | |
| [vue/no-deprecated-props-default-this](./no-deprecated-props-default-this.md) | disallow props default function `this` access | |
| [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+) | |
| [vue/no-deprecated-scope-attribute](./no-deprecated-scope-attribute.md) | disallow deprecated `scope` attribute (in Vue.js 2.5.0+) | :wrench: |
| [vue/no-deprecated-slot-attribute](./no-deprecated-slot-attribute.md) | disallow deprecated `slot` attribute (in Vue.js 2.6.0+) | :wrench: |
| [vue/no-deprecated-slot-scope-attribute](./no-deprecated-slot-scope-attribute.md) | disallow deprecated `slot-scope` attribute (in Vue.js 2.6.0+) | :wrench: |
Expand Down Expand Up @@ -314,7 +314,7 @@ For example:
| [vue/no-restricted-v-bind](./no-restricted-v-bind.md) | disallow specific argument in `v-bind` | |
| [vue/no-static-inline-styles](./no-static-inline-styles.md) | disallow static inline `style` attributes | |
| [vue/no-template-target-blank](./no-template-target-blank.md) | disallow target="_blank" attribute without rel="noopener noreferrer" | |
| [vue/no-this-in-before-route-enter](./no-this-in-before-route-enter.md) | disallow this usage in a beforeRouteEnter method | |
| [vue/no-this-in-before-route-enter](./no-this-in-before-route-enter.md) | disallow `this` usage in a `beforeRouteEnter` method | |
| [vue/no-unregistered-components](./no-unregistered-components.md) | disallow using components that are not registered inside templates | |
| [vue/no-unsupported-features](./no-unsupported-features.md) | disallow unsupported Vue.js syntax on the specified version | :wrench: |
| [vue/no-unused-properties](./no-unused-properties.md) | disallow unused properties | |
Expand Down
3 changes: 2 additions & 1 deletion docs/rules/no-deprecated-destroyed-lifecycle.md
Expand Up @@ -10,12 +10,13 @@ since: v7.0.0
> disallow using deprecated `destroyed` and `beforeDestroy` lifecycle hooks (in Vue.js 3.0.0+)
- :gear: This rule is included in all of `"plugin:vue/vue3-essential"`, `"plugin:vue/vue3-strongly-recommended"` and `"plugin:vue/vue3-recommended"`.
- :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.

## :book: Rule Details

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

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

```vue
<script>
Expand Down
4 changes: 2 additions & 2 deletions docs/rules/no-deprecated-props-default-this.md
Expand Up @@ -2,12 +2,12 @@
pageClass: rule-details
sidebarDepth: 0
title: vue/no-deprecated-props-default-this
description: disallow props default function `this` access
description: disallow deprecated `this` access in props default function (in Vue.js 3.0.0+)
since: v7.0.0
---
# vue/no-deprecated-props-default-this

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

Expand Down
9 changes: 8 additions & 1 deletion docs/rules/no-deprecated-v-is.md
Expand Up @@ -32,9 +32,16 @@ Use [`is` attribute with `vue:` prefix](https://v3.vuejs.org/api/special-attribu

</eslint-code-block>

## :couple: Related Rules

- [vue/valid-v-is]

[vue/valid-v-is]: ./valid-v-is.md

## :books: Further Reading

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

## :mag: Implementation

Expand Down
67 changes: 9 additions & 58 deletions docs/rules/no-this-in-before-route-enter.md
Expand Up @@ -2,77 +2,29 @@
pageClass: rule-details
sidebarDepth: 0
title: vue/no-this-in-before-route-enter
description: disallow this usage in a beforeRouteEnter method
description: disallow `this` usage in a `beforeRouteEnter` method
---
# vue/no-this-in-before-route-enter

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

## Rule Details
## :book: Rule Details

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.

Bad:

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

```vue
<script>
export default {
beforeRouteEnter() {
this.method(); // Uncaught TypeError: Cannot read property 'method' of undefined
}
}
</script>
```

</eslint-code-block>

Bad:

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

```vue
<script>
export default {
beforeRouteEnter() {
/* ✗ BAD */
this.method(); // Uncaught TypeError: Cannot read property 'method' of undefined
this.attribute = 42;
}
}
</script>
```

</eslint-code-block>

Bad:

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

```vue
<script>
export default {
beforeRouteEnter() {
if (this.value === 42) {
}
}
}
</script>
```

</eslint-code-block>


Bad:

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

```vue
<script>
export default {
beforeRouteEnter() {
this.attribute = this.method();
}
}
Expand All @@ -81,14 +33,13 @@ export default {

</eslint-code-block>

Good:

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

```vue
<script>
export default {
beforeRouteEnter() {
/* ✓ GOOD */
// anything without this
}
}
Expand All @@ -97,15 +48,15 @@ export default {

</eslint-code-block>

### Options
## :wrench: Options

Nothing.

## When Not To Use It
## :mute: When Not To Use It

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

## Further Reading
## :books: Further Reading

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

Expand Down
1 change: 1 addition & 0 deletions docs/rules/no-unsupported-features.md
Expand Up @@ -96,6 +96,7 @@ The `"ignores"` option accepts an array of the following strings.
## :books: Further Reading

- [API - v-is](https://v3.vuejs.org/api/directives.html#v-is)
- [API - v-is (Old)](https://github.com/vuejs/docs-next/blob/008613756c3d781128d96b64a2d27f7598f8f548/src/api/directives.md#v-is)
- [Guide - Dynamic Arguments](https://v3.vuejs.org/guide/template-syntax.html#dynamic-arguments)
- [API - v-slot](https://v3.vuejs.org/api/directives.html#v-slot)
- [API (for v2) - slot-scope](https://vuejs.org/v2/api/#slot-scope-deprecated)
Expand Down
3 changes: 3 additions & 0 deletions docs/rules/valid-v-is.md
Expand Up @@ -51,13 +51,16 @@ Nothing.

## :couple: Related Rules

- [vue/no-deprecated-v-is]
- [vue/no-parsing-error]

[vue/no-deprecated-v-is]: ./no-deprecated-v-is.md
[vue/no-parsing-error]: ./no-parsing-error.md

## :books: Further Reading

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

## :rocket: Version

Expand Down
3 changes: 2 additions & 1 deletion lib/rules/no-deprecated-props-default-this.js
Expand Up @@ -18,7 +18,8 @@ module.exports = {
meta: {
type: 'problem',
docs: {
description: 'disallow props default function `this` access',
description:
'disallow deprecated `this` access in props default function (in Vue.js 3.0.0+)',
categories: ['vue3-essential'],
url: 'https://eslint.vuejs.org/rules/no-deprecated-props-default-this.html'
},
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-this-in-before-route-enter.js
Expand Up @@ -18,7 +18,7 @@ module.exports = {
meta: {
type: 'problem',
docs: {
description: 'disallow this usage in a beforeRouteEnter method',
description: 'disallow `this` usage in a `beforeRouteEnter` method',
categories: null,
url: 'https://eslint.vuejs.org/rules/no-this-in-before-route-enter.html'
},
Expand Down
2 changes: 2 additions & 0 deletions lib/rules/valid-v-is.js
Expand Up @@ -39,6 +39,8 @@ module.exports = {
type: 'problem',
docs: {
description: 'enforce valid `v-is` directives',
// TODO Switch to `undefined` in the major version.
// categories: undefined,
categories: ['vue3-essential'],
url: 'https://eslint.vuejs.org/rules/valid-v-is.html'
},
Expand Down

0 comments on commit a4ac565

Please sign in to comment.