Skip to content

Commit e064d0b

Browse files
authored
Merge branch 'master' into update-props-no-destructure-rule
2 parents 17f7be5 + 6dad5c2 commit e064d0b

File tree

224 files changed

+2463
-1901
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

224 files changed

+2463
-1901
lines changed

.circleci/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ jobs:
9898

9999
lint:
100100
docker:
101-
- image: node:14
101+
- image: node:16
102102
steps:
103103
- run:
104104
name: Versions

.markdownlint.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
line-length: false
2+
link-fragments: false
23
single-title: false
34
no-inline-html:
45
allowed_elements:

docs/rules/experimental-script-setup-vars.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ since: v7.0.0
99

1010
> prevent variables defined in `<script setup>` to be marked as undefined
1111
12-
- :no_entry_sign: This rule was **removed** in eslint-plugin-vue v9.0.0.
12+
- :no_entry: This rule was **removed** in eslint-plugin-vue v9.0.0.
1313

1414
This rule will find variables defined in `<script setup="args">` and mark them as defined variables.
1515

docs/rules/index.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ For example:
226226
| [vue/next-tick-style](./next-tick-style.md) | enforce Promise or callback style in `nextTick` | :wrench: | :hammer: |
227227
| [vue/no-bare-strings-in-template](./no-bare-strings-in-template.md) | disallow the use of bare strings in `<template>` | | :hammer: |
228228
| [vue/no-boolean-default](./no-boolean-default.md) | disallow boolean defaults | :wrench: | :hammer: |
229+
| [vue/no-deprecated-model-definition](./no-deprecated-model-definition.md) | disallow deprecated `model` definition (in Vue.js 3.0.0+) | :bulb: | :warning: |
229230
| [vue/no-duplicate-attr-inheritance](./no-duplicate-attr-inheritance.md) | enforce `inheritAttrs` to be set to `false` when using `v-bind="$attrs"` | | :hammer: |
230231
| [vue/no-empty-component-block](./no-empty-component-block.md) | disallow the `<template>` `<script>` `<style>` block to be empty | | :hammer: |
231232
| [vue/no-multiple-objects-in-class](./no-multiple-objects-in-class.md) | disallow to pass multiple objects into array to class | | :hammer: |
@@ -330,7 +331,7 @@ The following rules extend the rules provided by ESLint itself and apply them to
330331

331332
## Deprecated
332333

333-
- :warning: We're going to remove deprecated rules in the next major release. Please migrate to successor/new rules.
334+
- :no_entry_sign: We're going to remove deprecated rules in the next major release. Please migrate to successor/new rules.
334335
- :innocent: We don't fix bugs which are in deprecated rules since we don't have enough resources.
335336

336337
| Rule ID | Replaced by |
@@ -341,7 +342,7 @@ The following rules extend the rules provided by ESLint itself and apply them to
341342

342343
## Removed
343344

344-
- :no_entry_sign: These rules have been removed in a previous major release, after they have been deprecated for a while.
345+
- :no_entry: These rules have been removed in a previous major release, after they have been deprecated for a while.
345346

346347
| Rule ID | Replaced by | Deprecated in version | Removed in version |
347348
|:--------|:------------|:-----------------------|:-------------------|

docs/rules/name-property-casing.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ since: v3.8.0
99

1010
> enforce specific casing for the name property in Vue components
1111
12-
- :no_entry_sign: This rule was **removed** in eslint-plugin-vue v9.0.0 and replaced by [vue/component-definition-name-casing](component-definition-name-casing.md) rule.
12+
- :no_entry: This rule was **removed** in eslint-plugin-vue v9.0.0 and replaced by [vue/component-definition-name-casing](component-definition-name-casing.md) rule.
1313

1414
## :book: Rule Details
1515

docs/rules/no-confusing-v-for-v-if.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ since: v3.0.0
99

1010
> disallow confusing `v-for` and `v-if` on the same element
1111
12-
- :no_entry_sign: This rule was **removed** in eslint-plugin-vue v9.0.0 and replaced by [vue/no-use-v-if-with-v-for](no-use-v-if-with-v-for.md) rule.
12+
- :no_entry: This rule was **removed** in eslint-plugin-vue v9.0.0 and replaced by [vue/no-use-v-if-with-v-for](no-use-v-if-with-v-for.md) rule.
1313

1414
## :book: Rule Details
1515

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
pageClass: rule-details
3+
sidebarDepth: 0
4+
title: vue/no-deprecated-model-definition
5+
description: disallow deprecated `model` definition (in Vue.js 3.0.0+)
6+
---
7+
# vue/no-deprecated-model-definition
8+
9+
> disallow deprecated `model` definition (in Vue.js 3.0.0+)
10+
11+
- :exclamation: <badge text="This rule has not been released yet." vertical="middle" type="error"> ***This rule has not been released yet.*** </badge>
12+
- :bulb: Some problems reported by this rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
13+
14+
## :book: Rule Details
15+
16+
This rule reports use of the component `model` option, which has been deprecated in Vue.js 3.0.0+.
17+
18+
See [Migration Guide – `v-model`](https://v3-migration.vuejs.org/breaking-changes/v-model.html) for more details.
19+
20+
<eslint-code-block :rules="{'vue/no-deprecated-model-definition': ['error']}">
21+
22+
```vue
23+
<script>
24+
export default defineComponent({
25+
model: {
26+
prop: 'my-value',
27+
event: 'input'
28+
}
29+
})
30+
</script>
31+
```
32+
33+
</eslint-code-block>
34+
35+
## :wrench: Options
36+
37+
```json
38+
{
39+
"vue/no-deprecated-model-definition": ["error", {
40+
"allowVue3Compat": true
41+
}]
42+
}
43+
```
44+
45+
### `"allowVue3Compat": true`
46+
47+
Allow `model` definitions with prop/event names that match the Vue.js 3.0.0+ `v-model` syntax, e.g. `fooBar`/`update:fooBar`.
48+
49+
<eslint-code-block :rules="{'vue/no-deprecated-model-definition': ['error', { allowVue3Compat: true }]}">
50+
51+
```vue
52+
<script>
53+
export default defineComponent({
54+
model: {
55+
prop: 'fooBar',
56+
event: 'update:fooBar'
57+
}
58+
})
59+
</script>
60+
```
61+
62+
</eslint-code-block>
63+
64+
## :couple: Related Rules
65+
66+
- [vue/valid-model-definition](./valid-model-definition.md) (for Vue.js 2.x)
67+
- [vue/no-v-model-argument](./no-v-model-argument.md) (for Vue.js 2.x)
68+
69+
## :books: Further Reading
70+
71+
- [Migration Guide – `v-model`](https://v3-migration.vuejs.org/breaking-changes/v-model.html)
72+
73+
## :mag: Implementation
74+
75+
- [Rule source](https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/no-deprecated-model-definition.js)
76+
- [Test source](https://github.com/vuejs/eslint-plugin-vue/blob/master/tests/lib/rules/no-deprecated-model-definition.js)

docs/rules/no-invalid-model-keys.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ since: v7.9.0
99

1010
> require valid keys in model option
1111
12-
- :warning: This rule was **deprecated** and replaced by [vue/valid-model-definition](valid-model-definition.md) rule.
12+
- :no_entry_sign: This rule was **deprecated** and replaced by [vue/valid-model-definition](valid-model-definition.md) rule.
1313

1414
## :book: Rule Details
1515

docs/rules/no-unregistered-components.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ since: v7.0.0
99

1010
> disallow using components that are not registered inside templates
1111
12-
- :no_entry_sign: This rule was **removed** in eslint-plugin-vue v9.0.0 and replaced by [vue/no-undef-components](no-undef-components.md) rule.
12+
- :no_entry: This rule was **removed** in eslint-plugin-vue v9.0.0 and replaced by [vue/no-undef-components](no-undef-components.md) rule.
1313

1414
## :book: Rule Details
1515

docs/rules/script-setup-uses-vars.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ since: v7.13.0
99

1010
> prevent `<script setup>` variables used in `<template>` to be marked as unused
1111
12-
- :warning: This rule was **deprecated**.
12+
- :no_entry_sign: This rule was **deprecated**.
1313

1414
::: tip
1515

docs/rules/v-on-function-call.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ since: v5.2.0
99

1010
> enforce or forbid parentheses after method calls without arguments in `v-on` directives
1111
12-
- :warning: This rule was **deprecated** and replaced by [vue/v-on-handler-style](v-on-handler-style.md) rule.
12+
- :no_entry_sign: This rule was **deprecated** and replaced by [vue/v-on-handler-style](v-on-handler-style.md) rule.
1313
- :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.
1414

1515
## :book: Rule Details

eslint-internal-rules/no-invalid-meta-docs-categories.js

+16-7
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function checkMetaValidity(context, exportsNode) {
5656
if (!categories) {
5757
context.report({
5858
node: metaDocs,
59-
message: 'Rule is missing a meta.docs.categories property.',
59+
messageId: 'missingCategories',
6060
fix(fixer) {
6161
const category = getPropertyFromObject('category', metaDocs.value)
6262
if (!category) {
@@ -70,16 +70,16 @@ function checkMetaValidity(context, exportsNode) {
7070
) {
7171
// fixes.push(fixer.insertTextBefore(category.value, '['), fixer.insertTextAfter(category.value, ']'))
7272

73-
// for vue3 migration
74-
if (category.value.value !== 'base') {
73+
if (category.value.value === 'base') {
74+
fixes.push(fixer.insertTextBefore(category.value, '['))
75+
} else {
76+
// for vue3 migration
7577
fixes.push(
7678
fixer.insertTextBefore(
7779
category.value,
7880
`['vue3-${category.value.value}', `
7981
)
8082
)
81-
} else {
82-
fixes.push(fixer.insertTextBefore(category.value, '['))
8383
}
8484
fixes.push(fixer.insertTextAfter(category.value, ']'))
8585
}
@@ -98,18 +98,27 @@ function checkMetaValidity(context, exportsNode) {
9898
categories.value.name === 'undefined'
9999
)
100100
) {
101-
context.report(categories.value, 'meta.docs.categories must be an array.')
101+
context.report({
102+
node: categories.value,
103+
messageId: 'categoriesMustBeArray'
104+
})
102105
}
103106
}
104107

105108
module.exports = {
106109
meta: {
110+
type: 'problem',
107111
docs: {
108112
description: 'enforce correct use of `meta` property in core rules',
109113
categories: ['Internal']
110114
},
111115
fixable: 'code',
112-
schema: []
116+
schema: [],
117+
messages: {
118+
missingCategories: 'Rule is missing a meta.docs.categories property.',
119+
// eslint-disable-next-line eslint-plugin/report-message-format
120+
categoriesMustBeArray: 'meta.docs.categories must be an array.'
121+
}
113122
},
114123

115124
create(context) {

eslint-internal-rules/no-invalid-meta.js

+20-8
Original file line numberDiff line numberDiff line change
@@ -67,32 +67,44 @@ function checkMetaValidity(context, exportsNode) {
6767
const metaProperty = getMetaPropertyFromExportsNode(exportsNode)
6868

6969
if (!metaProperty) {
70-
context.report(exportsNode, 'Rule is missing a meta property.')
70+
context.report({
71+
node: exportsNode,
72+
messageId: 'missingMeta'
73+
})
7174
return
7275
}
7376

7477
if (!hasMetaDocs(metaProperty)) {
75-
context.report(metaProperty, 'Rule is missing a meta.docs property.')
78+
context.report({
79+
node: 'metaDocs',
80+
messageId: 'missingMetaDocs'
81+
})
7682
return
7783
}
7884

7985
if (!hasMetaDocsCategories(metaProperty)) {
80-
context.report(
81-
metaProperty,
82-
'Rule is missing a meta.docs.categories property.'
83-
)
86+
context.report({
87+
node: metaProperty,
88+
messageId: 'missingMetaDocsCategories'
89+
})
8490
return
8591
}
8692
}
8793

8894
module.exports = {
8995
meta: {
96+
type: 'problem',
9097
docs: {
9198
description: 'enforce correct use of `meta` property in core rules',
9299
categories: ['Internal']
93100
},
94-
95-
schema: []
101+
schema: [],
102+
messages: {
103+
missingMeta: 'Rule is missing a meta property.',
104+
missingMetaDocs: 'Rule is missing a meta.docs property.',
105+
missingMetaDocsCategories:
106+
'Rule is missing a meta.docs.categories property.'
107+
}
96108
},
97109

98110
create(context) {

eslint-internal-rules/require-eslint-community.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@
22

33
module.exports = {
44
meta: {
5+
type: 'problem',
56
docs: {
67
description: 'enforce use of the `@eslint-community/*` package',
78
categories: ['Internal']
89
},
910
fixable: 'code',
11+
schema: [],
1012
messages: {
1113
useCommunityPackageInstead:
1214
'Please use `@eslint-community/{{name}}` instead.'
13-
},
14-
schema: []
15+
}
1516
},
1617

1718
/** @param {import('eslint').Rule.RuleContext} context */

eslint.config.js

+8-16
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ module.exports = [
2727
},
2828
...eslintrc.plugins('eslint-plugin', 'prettier', 'unicorn'),
2929
...eslintrc.extends(
30-
'plugin:eslint-plugin/recommended',
30+
'plugin:eslint-plugin/all',
3131
'prettier',
3232
'plugin:node-dependencies/recommended',
3333
'plugin:jsonc/recommended-with-jsonc',
@@ -143,8 +143,6 @@ module.exports = [
143143

144144
'prettier/prettier': 'error',
145145
'eslint-plugin/report-message-format': ['error', "^[A-Z`'{].*\\.$"],
146-
'eslint-plugin/prefer-placeholders': 'error',
147-
'eslint-plugin/consistent-output': 'error',
148146

149147
'no-debugger': 'error',
150148
'no-console': 'error',
@@ -169,17 +167,14 @@ module.exports = [
169167
'unicorn/filename-case': 'off',
170168
'unicorn/no-null': 'off',
171169
'unicorn/no-array-callback-reference': 'off', // doesn't work well with TypeScript's custom type guards
172-
'unicorn/no-negated-condition': 'off', // remove when there are few pull requests (ref: #2146)
173170
'unicorn/no-useless-undefined': 'off',
174171
'unicorn/prefer-optional-catch-binding': 'off', // not supported by current ESLint parser version
175172
'unicorn/prefer-module': 'off',
176173
'unicorn/prevent-abbreviations': 'off',
177174
'unicorn/prefer-at': 'off', // turn off to prevent make breaking changes (ref: #2146)
178175
'unicorn/prefer-node-protocol': 'off', // turn off to prevent make breaking changes (ref: #2146)
179176
'unicorn/prefer-string-replace-all': 'off', // turn off to prevent make breaking changes (ref: #2146)
180-
'unicorn/prefer-ternary': 'off', // remove when there are few pull requests (ref: #2146)
181177
'unicorn/prefer-top-level-await': 'off', // turn off to prevent make breaking changes (ref: #2146)
182-
'unicorn/switch-case-braces': 'off', // remove when there are few pull requests (ref: #2146)
183178

184179
'internal/require-eslint-community': ['error']
185180
}
@@ -199,23 +194,20 @@ module.exports = [
199194
{
200195
files: ['lib/rules/*.js'],
201196
rules: {
202-
'eslint-plugin/no-deprecated-context-methods': 'error',
203-
'eslint-plugin/no-only-tests': 'error',
204-
'eslint-plugin/prefer-object-rule': 'error',
205-
'eslint-plugin/require-meta-docs-description': 'error',
206197
'eslint-plugin/require-meta-docs-url': [
207198
'error',
208-
{
209-
pattern: `https://eslint.vuejs.org/rules/{{name}}.html`
210-
}
199+
{ pattern: 'https://eslint.vuejs.org/rules/{{name}}.html' }
211200
],
212-
'eslint-plugin/require-meta-has-suggestions': 'error',
213-
'eslint-plugin/require-meta-schema': 'error',
214-
'eslint-plugin/require-meta-type': 'error',
215201
'internal/no-invalid-meta': 'error',
216202
'internal/no-invalid-meta-docs-categories': 'error'
217203
}
218204
},
205+
{
206+
files: ['eslint-internal-rules/*.js'],
207+
rules: {
208+
'eslint-plugin/require-meta-docs-url': 'off'
209+
}
210+
},
219211
{
220212
files: ['**/*.json'],
221213
rules: {

lib/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ module.exports = {
7979
'no-deprecated-functional-template': require('./rules/no-deprecated-functional-template'),
8080
'no-deprecated-html-element-is': require('./rules/no-deprecated-html-element-is'),
8181
'no-deprecated-inline-template': require('./rules/no-deprecated-inline-template'),
82+
'no-deprecated-model-definition': require('./rules/no-deprecated-model-definition'),
8283
'no-deprecated-props-default-this': require('./rules/no-deprecated-props-default-this'),
8384
'no-deprecated-router-link-tag-prop': require('./rules/no-deprecated-router-link-tag-prop'),
8485
'no-deprecated-scope-attribute': require('./rules/no-deprecated-scope-attribute'),

0 commit comments

Comments
 (0)