diff --git a/.changeset/cool-cycles-lick.md b/.changeset/cool-cycles-lick.md new file mode 100644 index 000000000..b2903faa5 --- /dev/null +++ b/.changeset/cool-cycles-lick.md @@ -0,0 +1,5 @@ +--- +"eslint-plugin-vue": minor +--- + +Added autofix to [vue/prefer-use-template-ref](https://eslint.vuejs.org/rules/prefer-use-template-ref.html). diff --git a/docs/rules/index.md b/docs/rules/index.md index 7828b58bb..70691eae7 100644 --- a/docs/rules/index.md +++ b/docs/rules/index.md @@ -272,7 +272,7 @@ For example: | [vue/prefer-prop-type-boolean-first] | enforce `Boolean` comes first in component prop types | :bulb: | :warning: | | [vue/prefer-separate-static-class] | require static class names in template to be in a separate `class` attribute | :wrench: | :hammer: | | [vue/prefer-true-attribute-shorthand] | require shorthand form attribute when `v-bind` value is `true` | :bulb: | :hammer: | -| [vue/prefer-use-template-ref] | require using `useTemplateRef` instead of `ref`/`shallowRef` for template refs | | :hammer: | +| [vue/prefer-use-template-ref] | require using `useTemplateRef` instead of `ref`/`shallowRef` for template refs | :wrench: | :hammer: | | [vue/require-default-export] | require components to be the default export | | :warning: | | [vue/require-direct-export] | require the component to be directly exported | | :hammer: | | [vue/require-emit-validator] | require type definitions in emits | :bulb: | :hammer: | diff --git a/docs/rules/prefer-use-template-ref.md b/docs/rules/prefer-use-template-ref.md index 1b1b40385..cfa9a7a88 100644 --- a/docs/rules/prefer-use-template-ref.md +++ b/docs/rules/prefer-use-template-ref.md @@ -10,6 +10,8 @@ since: v9.31.0 > require using `useTemplateRef` instead of `ref`/`shallowRef` for template refs +- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fix-problems) can automatically fix some of the problems reported by this rule. + ## :book: Rule Details Vue 3.5 introduced a new way of obtaining template refs via @@ -17,7 +19,7 @@ the [`useTemplateRef()`](https://vuejs.org/guide/essentials/template-refs.html#a This rule enforces using the new `useTemplateRef` function instead of `ref`/`shallowRef` for template refs. - + ```vue