Skip to content

Commit

Permalink
Change the categories of vue/no-arrow-functions-in-watch rule to 'v…
Browse files Browse the repository at this point in the history
…ue3-essential' and 'essential'. (#1156)
  • Loading branch information
ota-meshi committed May 23, 2020
1 parent f8b3014 commit 812f6bb
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion docs/rules/README.md
Expand Up @@ -38,6 +38,7 @@ Enforce all the rules in this category, as well as all higher priority rules, wi

| Rule ID | Description | |
|:--------|:------------|:---|
| [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-dollar-listeners-api](./no-deprecated-dollar-listeners-api.md) | disallow using deprecated `$listeners` (in Vue.js 3.0.0+) | |
Expand Down Expand Up @@ -159,6 +160,7 @@ Enforce all the rules in this category, as well as all higher priority rules, wi

| Rule ID | Description | |
|:--------|:------------|:---|
| [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-custom-modifiers-on-v-model](./no-custom-modifiers-on-v-model.md) | disallow custom modifiers on v-model used on the component | |
| [vue/no-dupe-keys](./no-dupe-keys.md) | disallow duplication of field names | |
Expand Down Expand Up @@ -286,7 +288,6 @@ For example:
| [vue/keyword-spacing](./keyword-spacing.md) | enforce consistent spacing before and after keywords | :wrench: |
| [vue/match-component-file-name](./match-component-file-name.md) | require component name property to match its file name | |
| [vue/max-len](./max-len.md) | enforce a maximum line length | |
| [vue/no-arrow-functions-in-watch](./no-arrow-functions-in-watch.md)| disallows using arrow functions to define wathcer | |
| [vue/no-boolean-default](./no-boolean-default.md) | disallow boolean defaults | :wrench: |
| [vue/no-duplicate-attr-inheritance](./no-duplicate-attr-inheritance.md) | enforce `inheritAttrs` to be set to `false` when using `v-bind="$attrs"` | |
| [vue/no-empty-pattern](./no-empty-pattern.md) | disallow empty destructuring patterns | |
Expand Down
4 changes: 3 additions & 1 deletion docs/rules/no-arrow-functions-in-watch.md
Expand Up @@ -2,11 +2,13 @@
pageClass: rule-details
sidebarDepth: 0
title: vue/no-arrow-functions-in-watch
description: disallow arrow functions to define watcher
description: disallow using arrow functions to define watcher
---
# vue/no-arrow-functions-in-watch
> disallow using arrow functions to define watcher
- :gear: This rule is included in all of `"plugin:vue/vue3-essential"`, `"plugin:vue/essential"`, `"plugin:vue/vue3-strongly-recommended"`, `"plugin:vue/strongly-recommended"`, `"plugin:vue/vue3-recommended"` and `"plugin:vue/recommended"`.

## :book: Rule Details

This rules disallows using arrow functions to defined watcher.The reason is arrow functions bind the parent context, so `this` will not be the Vue instance as you expect.([see here for more details](https://vuejs.org/v2/api/#watch))
Expand Down
1 change: 1 addition & 0 deletions lib/configs/essential.js
Expand Up @@ -6,6 +6,7 @@
module.exports = {
extends: require.resolve('./base'),
rules: {
'vue/no-arrow-functions-in-watch': 'error',
'vue/no-async-in-computed-properties': 'error',
'vue/no-custom-modifiers-on-v-model': 'error',
'vue/no-dupe-keys': 'error',
Expand Down
1 change: 1 addition & 0 deletions lib/configs/vue3-essential.js
Expand Up @@ -6,6 +6,7 @@
module.exports = {
extends: require.resolve('./base'),
rules: {
'vue/no-arrow-functions-in-watch': 'error',
'vue/no-async-in-computed-properties': 'error',
'vue/no-deprecated-data-object-declaration': 'error',
'vue/no-deprecated-dollar-listeners-api': 'error',
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-arrow-functions-in-watch.js
Expand Up @@ -10,7 +10,7 @@ module.exports = {
type: 'problem',
docs: {
description: 'disallow using arrow functions to define watcher',
categories: undefined,
categories: ['vue3-essential', 'essential'],
url: 'https://eslint.vuejs.org/rules/no-arrow-functions-in-watch.html'
},
fixable: null,
Expand Down

0 comments on commit 812f6bb

Please sign in to comment.