Skip to content

Commit 812f6bb

Browse files
authored
Change the categories of vue/no-arrow-functions-in-watch rule to 'vue3-essential' and 'essential'. (#1156)
1 parent f8b3014 commit 812f6bb

File tree

5 files changed

+8
-3
lines changed

5 files changed

+8
-3
lines changed

Diff for: docs/rules/README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Enforce all the rules in this category, as well as all higher priority rules, wi
3838

3939
| Rule ID | Description | |
4040
|:--------|:------------|:---|
41+
| [vue/no-arrow-functions-in-watch](./no-arrow-functions-in-watch.md) | disallow using arrow functions to define watcher | |
4142
| [vue/no-async-in-computed-properties](./no-async-in-computed-properties.md) | disallow asynchronous actions in computed properties | |
4243
| [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: |
4344
| [vue/no-deprecated-dollar-listeners-api](./no-deprecated-dollar-listeners-api.md) | disallow using deprecated `$listeners` (in Vue.js 3.0.0+) | |
@@ -159,6 +160,7 @@ Enforce all the rules in this category, as well as all higher priority rules, wi
159160

160161
| Rule ID | Description | |
161162
|:--------|:------------|:---|
163+
| [vue/no-arrow-functions-in-watch](./no-arrow-functions-in-watch.md) | disallow using arrow functions to define watcher | |
162164
| [vue/no-async-in-computed-properties](./no-async-in-computed-properties.md) | disallow asynchronous actions in computed properties | |
163165
| [vue/no-custom-modifiers-on-v-model](./no-custom-modifiers-on-v-model.md) | disallow custom modifiers on v-model used on the component | |
164166
| [vue/no-dupe-keys](./no-dupe-keys.md) | disallow duplication of field names | |
@@ -286,7 +288,6 @@ For example:
286288
| [vue/keyword-spacing](./keyword-spacing.md) | enforce consistent spacing before and after keywords | :wrench: |
287289
| [vue/match-component-file-name](./match-component-file-name.md) | require component name property to match its file name | |
288290
| [vue/max-len](./max-len.md) | enforce a maximum line length | |
289-
| [vue/no-arrow-functions-in-watch](./no-arrow-functions-in-watch.md)| disallows using arrow functions to define wathcer | |
290291
| [vue/no-boolean-default](./no-boolean-default.md) | disallow boolean defaults | :wrench: |
291292
| [vue/no-duplicate-attr-inheritance](./no-duplicate-attr-inheritance.md) | enforce `inheritAttrs` to be set to `false` when using `v-bind="$attrs"` | |
292293
| [vue/no-empty-pattern](./no-empty-pattern.md) | disallow empty destructuring patterns | |

Diff for: docs/rules/no-arrow-functions-in-watch.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
pageClass: rule-details
33
sidebarDepth: 0
44
title: vue/no-arrow-functions-in-watch
5-
description: disallow arrow functions to define watcher
5+
description: disallow using arrow functions to define watcher
66
---
77
# vue/no-arrow-functions-in-watch
88
> disallow using arrow functions to define watcher
99
10+
- :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"`.
11+
1012
## :book: Rule Details
1113

1214
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))

Diff for: lib/configs/essential.js

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
module.exports = {
77
extends: require.resolve('./base'),
88
rules: {
9+
'vue/no-arrow-functions-in-watch': 'error',
910
'vue/no-async-in-computed-properties': 'error',
1011
'vue/no-custom-modifiers-on-v-model': 'error',
1112
'vue/no-dupe-keys': 'error',

Diff for: lib/configs/vue3-essential.js

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
module.exports = {
77
extends: require.resolve('./base'),
88
rules: {
9+
'vue/no-arrow-functions-in-watch': 'error',
910
'vue/no-async-in-computed-properties': 'error',
1011
'vue/no-deprecated-data-object-declaration': 'error',
1112
'vue/no-deprecated-dollar-listeners-api': 'error',

Diff for: lib/rules/no-arrow-functions-in-watch.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module.exports = {
1010
type: 'problem',
1111
docs: {
1212
description: 'disallow using arrow functions to define watcher',
13-
categories: undefined,
13+
categories: ['vue3-essential', 'essential'],
1414
url: 'https://eslint.vuejs.org/rules/no-arrow-functions-in-watch.html'
1515
},
1616
fixable: null,

0 commit comments

Comments
 (0)