From 101cabf6a09cbfc31f3df073093e1b1765ccbfdc Mon Sep 17 00:00:00 2001 From: Vincent Rubinetti Date: Tue, 1 Aug 2023 03:51:13 -0400 Subject: [PATCH 1/5] Improve docs and error message for `vue/no-dupe-keys` (#2260) --- docs/rules/no-dupe-keys.md | 5 +- docs/rules/no-duplicate-attr-inheritance.md | 2 +- docs/rules/no-duplicate-attributes.md | 5 +- lib/rules/no-dupe-keys.js | 7 +- tests/lib/rules/no-dupe-keys.js | 108 +++++++++++++------- 5 files changed, 82 insertions(+), 45 deletions(-) diff --git a/docs/rules/no-dupe-keys.md b/docs/rules/no-dupe-keys.md index 41f4a962f..1d9d20f24 100644 --- a/docs/rules/no-dupe-keys.md +++ b/docs/rules/no-dupe-keys.md @@ -11,11 +11,12 @@ since: v3.9.0 - :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"`. -This rule prevents to use duplicated names. +This rule prevents using duplicate key names. ## :book: Rule Details -This rule is aimed at preventing duplicated property names. +This rule prevents duplicate `props`/`data`/`methods`/etc. key names defined on a component. +Even if a key name does not conflict in the ` `, options: [{ allowVue3Compat: true }] + }, + { + filename: 'test.vue', + code: ` + + `, + options: [{ allowVue3Compat: true }] } ], invalid: [ @@ -320,6 +334,58 @@ tester.run('no-deprecated-model-definition', rule, { ] } ] + }, + { + filename: 'test.vue', + code: ` + + `, + options: [{ allowVue3Compat: true }], + errors: [ + { + message: + '`model` definition is deprecated. You may use the Vue 3-compatible `modelValue`/`update:modelValue` though.', + line: 4, + column: 11, + endLine: 7, + endColumn: 12, + suggestions: [ + { + desc: 'Change to `modelValue`/`update:modelValue`.', + output: ` + + ` + }, + { + desc: 'Change to `model-value`/`update:model-value`.', + output: ` + + ` + } + ] + } + ] } ] }) From 4112be528e831995d6fd09a2d727ec19e99e865c Mon Sep 17 00:00:00 2001 From: Yosuke Ota Date: Wed, 9 Aug 2023 20:07:32 +0900 Subject: [PATCH 3/5] Rename `vue/no-setup-props-destructure` to `vue/no-setup-props-reactivity-loss` and remove from config (#2268) --- docs/rules/index.md | 3 +- docs/rules/no-setup-props-destructure.md | 6 +- docs/rules/no-setup-props-reactivity-loss.md | 102 +++ lib/configs/essential.js | 1 - lib/configs/vue3-essential.js | 1 - lib/index.js | 1 + lib/rules/no-setup-props-destructure.js | 265 +------ lib/rules/no-setup-props-reactivity-loss.js | 272 +++++++ .../rules/no-setup-props-reactivity-loss.js | 682 ++++++++++++++++++ 9 files changed, 1071 insertions(+), 262 deletions(-) create mode 100644 docs/rules/no-setup-props-reactivity-loss.md create mode 100644 lib/rules/no-setup-props-reactivity-loss.js create mode 100644 tests/lib/rules/no-setup-props-reactivity-loss.js diff --git a/docs/rules/index.md b/docs/rules/index.md index 6b06a7c71..d5525a785 100644 --- a/docs/rules/index.md +++ b/docs/rules/index.md @@ -79,7 +79,6 @@ Rules in this category are enabled for all presets provided by eslint-plugin-vue | [vue/no-reserved-component-names](./no-reserved-component-names.md) | disallow the use of reserved names in component definitions | | :three::two::hammer: | | [vue/no-reserved-keys](./no-reserved-keys.md) | disallow overwriting reserved keys | | :three::two::hammer: | | [vue/no-reserved-props](./no-reserved-props.md) | disallow reserved names in props | | :three::two::warning: | -| [vue/no-setup-props-destructure](./no-setup-props-destructure.md) | disallow destructuring of `props` passed to `setup` | | :three::two::hammer: | | [vue/no-shared-component-data](./no-shared-component-data.md) | enforce component's data property to be a function | :wrench: | :three::two::warning: | | [vue/no-side-effects-in-computed-properties](./no-side-effects-in-computed-properties.md) | disallow side effects in computed properties | | :three::two::warning: | | [vue/no-template-key](./no-template-key.md) | disallow `key` attribute on `