# Available rules
Legend
🔧 Indicates that the rule is fixable, and using --fix
option on the command line (opens new window) can automatically fix some of the reported problems.
# Base Rules (Enabling Correct ESLint Parsing)
Enforce all the rules in this category, as well as all higher priority rules, with:
{
"extends": "plugin:vue/base"
}
Rule ID | Description | |
---|---|---|
vue/comment-directive | support comment-directives in <template> | |
vue/experimental-script-setup-vars | prevent variables defined in <script setup> to be marked as undefined | |
vue/jsx-uses-vars | prevent variables used in JSX to be marked as unused |
# Priority A: Essential (Error Prevention) for Vue.js 3.x
Enforce all the rules in this category, as well as all higher priority rules, with:
{
"extends": "plugin:vue/vue3-essential"
}
Rule ID | Description | |
---|---|---|
vue/no-arrow-functions-in-watch | disallow using arrow functions to define watcher | |
vue/no-async-in-computed-properties | disallow asynchronous actions in computed properties | |
vue/no-deprecated-data-object-declaration | disallow using deprecated object declaration on data (in Vue.js 3.0.0+) | 🔧 |
vue/no-deprecated-destroyed-lifecycle | disallow using deprecated destroyed and beforeDestroy lifecycle hooks (in Vue.js 3.0.0+) | |
vue/no-deprecated-dollar-listeners-api | disallow using deprecated $listeners (in Vue.js 3.0.0+) | |
vue/no-deprecated-dollar-scopedslots-api | disallow using deprecated $scopedSlots (in Vue.js 3.0.0+) | 🔧 |
vue/no-deprecated-events-api | disallow using deprecated events api (in Vue.js 3.0.0+) | |
vue/no-deprecated-filter | disallow using deprecated filters syntax (in Vue.js 3.0.0+) | |
vue/no-deprecated-functional-template | disallow using deprecated the functional template (in Vue.js 3.0.0+) | |
vue/no-deprecated-html-element-is | disallow using deprecated the is attribute on HTML elements (in Vue.js 3.0.0+) | |
vue/no-deprecated-inline-template | disallow using deprecated inline-template attribute (in Vue.js 3.0.0+) | |
vue/no-deprecated-props-default-this | disallow props default function this access | |
vue/no-deprecated-scope-attribute | disallow deprecated scope attribute (in Vue.js 2.5.0+) | 🔧 |
vue/no-deprecated-slot-attribute | disallow deprecated slot attribute (in Vue.js 2.6.0+) | 🔧 |
vue/no-deprecated-slot-scope-attribute | disallow deprecated slot-scope attribute (in Vue.js 2.6.0+) | 🔧 |
vue/no-deprecated-v-bind-sync | disallow use of deprecated .sync modifier on v-bind directive (in Vue.js 3.0.0+) | 🔧 |
vue/no-deprecated-v-on-native-modifier | disallow using deprecated .native modifiers (in Vue.js 3.0.0+) | |
vue/no-deprecated-v-on-number-modifiers | disallow using deprecated number (keycode) modifiers (in Vue.js 3.0.0+) | 🔧 |
vue/no-deprecated-vue-config-keycodes | disallow using deprecated Vue.config.keyCodes (in Vue.js 3.0.0+) | |
vue/no-dupe-keys | disallow duplication of field names | |
vue/no-dupe-v-else-if | disallow duplicate conditions in v-if / v-else-if chains | |
vue/no-duplicate-attributes | disallow duplication of attributes | |
vue/no-lifecycle-after-await | disallow asynchronously registered lifecycle hooks | |
vue/no-mutating-props | disallow mutation of component props | |
vue/no-parsing-error | disallow parsing errors in <template> | |
vue/no-ref-as-operand | disallow use of value wrapped by ref() (Composition API) as an operand | 🔧 |
vue/no-reserved-keys | disallow overwriting reserved keys | |
vue/no-setup-props-destructure | disallow destructuring of props passed to setup | |
vue/no-shared-component-data | enforce component's data property to be a function | 🔧 |
vue/no-side-effects-in-computed-properties | disallow side effects in computed properties | |
vue/no-template-key | disallow key attribute on <template> | |
vue/no-textarea-mustache | disallow mustaches in <textarea> | |
vue/no-unused-components | disallow registering components that are not used inside templates | |
vue/no-unused-vars | disallow unused variable definitions of v-for directives or scope attributes | |
vue/no-use-v-if-with-v-for | disallow use v-if on the same element as v-for | |
vue/no-v-for-template-key-on-child | disallow key of <template v-for> placed on child elements | |
vue/no-watch-after-await | disallow asynchronously registered watch | |
vue/require-component-is | require v-bind:is of <component> elements | |
vue/require-prop-type-constructor | require prop type to be a constructor | 🔧 |
vue/require-render-return | enforce render function to always return value | |
vue/require-slots-as-functions | enforce properties of $slots to be used as a function | |
vue/require-toggle-inside-transition | require control the display of the content inside <transition> | |
vue/require-v-for-key | require v-bind:key with v-for directives | |
vue/require-valid-default-prop | enforce props default values to be valid | |
vue/return-in-computed-property | enforce that a return statement is present in computed property | |
vue/return-in-emits-validator | enforce that a return statement is present in emits validator | |
vue/use-v-on-exact | enforce usage of exact modifier on v-on | |
vue/valid-template-root | enforce valid template root | |
vue/valid-v-bind | enforce valid v-bind directives | |
vue/valid-v-cloak | enforce valid v-cloak directives | |
vue/valid-v-else-if | enforce valid v-else-if directives | |
vue/valid-v-else | enforce valid v-else directives | |
vue/valid-v-for | enforce valid v-for directives | |
vue/valid-v-html | enforce valid v-html directives | |
vue/valid-v-if | enforce valid v-if directives | |
vue/valid-v-is | enforce valid v-is directives | |
vue/valid-v-model | enforce valid v-model directives | |
vue/valid-v-on | enforce valid v-on directives | |
vue/valid-v-once | enforce valid v-once directives | |
vue/valid-v-pre | enforce valid v-pre directives | |
vue/valid-v-show | enforce valid v-show directives | |
vue/valid-v-slot | enforce valid v-slot directives | |
vue/valid-v-text | enforce valid v-text directives |
# Priority B: Strongly Recommended (Improving Readability) for Vue.js 3.x
Enforce all the rules in this category, as well as all higher priority rules, with:
{
"extends": "plugin:vue/vue3-strongly-recommended"
}
Rule ID | Description | |
---|---|---|
vue/attribute-hyphenation | enforce attribute naming style on custom components in template | 🔧 |
vue/component-definition-name-casing | enforce specific casing for component definition name | 🔧 |
vue/html-closing-bracket-newline | require or disallow a line break before tag's closing brackets | 🔧 |
vue/html-closing-bracket-spacing | require or disallow a space before tag's closing brackets | 🔧 |
vue/html-end-tags | enforce end tag style | 🔧 |
vue/html-indent | enforce consistent indentation in <template> | 🔧 |
vue/html-quotes | enforce quotes style of HTML attributes | 🔧 |
vue/html-self-closing | enforce self-closing style | 🔧 |
vue/max-attributes-per-line | enforce the maximum number of attributes per line | 🔧 |
vue/multiline-html-element-content-newline | require a line break before and after the contents of a multiline element | 🔧 |
vue/mustache-interpolation-spacing | enforce unified spacing in mustache interpolations | 🔧 |
vue/no-multi-spaces | disallow multiple spaces | 🔧 |
vue/no-spaces-around-equal-signs-in-attribute | disallow spaces around equal signs in attribute | 🔧 |
vue/no-template-shadow | disallow variable declarations from shadowing variables declared in the outer scope | |
vue/one-component-per-file | enforce that each component should be in its own file | |
vue/prop-name-casing | enforce specific casing for the Prop name in Vue components | |
vue/require-default-prop | require default value for props | |
vue/require-explicit-emits | require emits option with name triggered by $emit() | |
vue/require-prop-types | require type definitions in props | |
vue/singleline-html-element-content-newline | require a line break before and after the contents of a singleline element | 🔧 |
vue/v-bind-style | enforce v-bind directive style | 🔧 |
vue/v-on-style | enforce v-on directive style | 🔧 |
vue/v-slot-style | enforce v-slot directive style | 🔧 |
# Priority C: Recommended (Minimizing Arbitrary Choices and Cognitive Overhead) for Vue.js 3.x
Enforce all the rules in this category, as well as all higher priority rules, with:
{
"extends": "plugin:vue/vue3-recommended"
}
Rule ID | Description | |
---|---|---|
vue/attributes-order | enforce order of attributes | 🔧 |
vue/component-tags-order | enforce order of component top-level elements | |
vue/no-lone-template | disallow unnecessary <template> | |
vue/no-multiple-slot-args | disallow to pass multiple arguments to scoped slots | |
vue/no-v-html | disallow use of v-html to prevent XSS attack | |
vue/order-in-components | enforce order of properties in components | 🔧 |
vue/this-in-template | disallow usage of this in template |
# Priority A: Essential (Error Prevention) for Vue.js 2.x
Enforce all the rules in this category, as well as all higher priority rules, with:
{
"extends": "plugin:vue/essential"
}
Rule ID | Description | |
---|---|---|
vue/no-arrow-functions-in-watch | disallow using arrow functions to define watcher | |
vue/no-async-in-computed-properties | disallow asynchronous actions in computed properties | |
vue/no-custom-modifiers-on-v-model | disallow custom modifiers on v-model used on the component | |
vue/no-dupe-keys | disallow duplication of field names | |
vue/no-dupe-v-else-if | disallow duplicate conditions in v-if / v-else-if chains | |
vue/no-duplicate-attributes | disallow duplication of attributes | |
vue/no-multiple-template-root | disallow adding multiple root nodes to the template | |
vue/no-mutating-props | disallow mutation of component props | |
vue/no-parsing-error | disallow parsing errors in <template> | |
vue/no-reserved-keys | disallow overwriting reserved keys | |
vue/no-shared-component-data | enforce component's data property to be a function | 🔧 |
vue/no-side-effects-in-computed-properties | disallow side effects in computed properties | |
vue/no-template-key | disallow key attribute on <template> | |
vue/no-textarea-mustache | disallow mustaches in <textarea> | |
vue/no-unused-components | disallow registering components that are not used inside templates | |
vue/no-unused-vars | disallow unused variable definitions of v-for directives or scope attributes | |
vue/no-use-v-if-with-v-for | disallow use v-if on the same element as v-for | |
vue/no-v-for-template-key | disallow key attribute on <template v-for> | |
vue/no-v-model-argument | disallow adding an argument to v-model used in custom component | |
vue/require-component-is | require v-bind:is of <component> elements | |
vue/require-prop-type-constructor | require prop type to be a constructor | 🔧 |
vue/require-render-return | enforce render function to always return value | |
vue/require-v-for-key | require v-bind:key with v-for directives | |
vue/require-valid-default-prop | enforce props default values to be valid | |
vue/return-in-computed-property | enforce that a return statement is present in computed property | |
vue/use-v-on-exact | enforce usage of exact modifier on v-on | |
vue/valid-template-root | enforce valid template root | |
vue/valid-v-bind-sync | enforce valid .sync modifier on v-bind directives | |
vue/valid-v-bind | enforce valid v-bind directives | |
vue/valid-v-cloak | enforce valid v-cloak directives | |
vue/valid-v-else-if | enforce valid v-else-if directives | |
vue/valid-v-else | enforce valid v-else directives | |
vue/valid-v-for | enforce valid v-for directives | |
vue/valid-v-html | enforce valid v-html directives | |
vue/valid-v-if | enforce valid v-if directives | |
vue/valid-v-model | enforce valid v-model directives | |
vue/valid-v-on | enforce valid v-on directives | |
vue/valid-v-once | enforce valid v-once directives | |
vue/valid-v-pre | enforce valid v-pre directives | |
vue/valid-v-show | enforce valid v-show directives | |
vue/valid-v-slot | enforce valid v-slot directives | |
vue/valid-v-text | enforce valid v-text directives |
# Priority B: Strongly Recommended (Improving Readability) for Vue.js 2.x
Enforce all the rules in this category, as well as all higher priority rules, with:
{
"extends": "plugin:vue/strongly-recommended"
}
Rule ID | Description | |
---|---|---|
vue/attribute-hyphenation | enforce attribute naming style on custom components in template | 🔧 |
vue/component-definition-name-casing | enforce specific casing for component definition name | 🔧 |
vue/html-closing-bracket-newline | require or disallow a line break before tag's closing brackets | 🔧 |
vue/html-closing-bracket-spacing | require or disallow a space before tag's closing brackets | 🔧 |
vue/html-end-tags | enforce end tag style | 🔧 |
vue/html-indent | enforce consistent indentation in <template> | 🔧 |
vue/html-quotes | enforce quotes style of HTML attributes | 🔧 |
vue/html-self-closing | enforce self-closing style | 🔧 |
vue/max-attributes-per-line | enforce the maximum number of attributes per line | 🔧 |
vue/multiline-html-element-content-newline | require a line break before and after the contents of a multiline element | 🔧 |
vue/mustache-interpolation-spacing | enforce unified spacing in mustache interpolations | 🔧 |
vue/no-multi-spaces | disallow multiple spaces | 🔧 |
vue/no-spaces-around-equal-signs-in-attribute | disallow spaces around equal signs in attribute | 🔧 |
vue/no-template-shadow | disallow variable declarations from shadowing variables declared in the outer scope | |
vue/one-component-per-file | enforce that each component should be in its own file | |
vue/prop-name-casing | enforce specific casing for the Prop name in Vue components | |
vue/require-default-prop | require default value for props | |
vue/require-prop-types | require type definitions in props | |
vue/singleline-html-element-content-newline | require a line break before and after the contents of a singleline element | 🔧 |
vue/v-bind-style | enforce v-bind directive style | 🔧 |
vue/v-on-style | enforce v-on directive style | 🔧 |
vue/v-slot-style | enforce v-slot directive style | 🔧 |
# Priority C: Recommended (Minimizing Arbitrary Choices and Cognitive Overhead) for Vue.js 2.x
Enforce all the rules in this category, as well as all higher priority rules, with:
{
"extends": "plugin:vue/recommended"
}
Rule ID | Description | |
---|---|---|
vue/attributes-order | enforce order of attributes | 🔧 |
vue/component-tags-order | enforce order of component top-level elements | |
vue/no-lone-template | disallow unnecessary <template> | |
vue/no-multiple-slot-args | disallow to pass multiple arguments to scoped slots | |
vue/no-v-html | disallow use of v-html to prevent XSS attack | |
vue/order-in-components | enforce order of properties in components | 🔧 |
vue/this-in-template | disallow usage of this in template |
# Uncategorized
No preset enables the rules in this category. Please enable each rule if you want.
For example:
{
"rules": {
"vue/block-tag-newline": "error"
}
}
Rule ID | Description | |
---|---|---|
vue/block-tag-newline | enforce line breaks after opening and before closing block-level tags | 🔧 |
vue/component-name-in-template-casing | enforce specific casing for the component naming style in template | 🔧 |
vue/custom-event-name-casing | enforce specific casing for custom event name | |
vue/html-button-has-type | disallow usage of button without an explicit type attribute | |
vue/html-comment-content-newline | enforce unified line brake in HTML comments | 🔧 |
vue/html-comment-content-spacing | enforce unified spacing in HTML comments | 🔧 |
vue/html-comment-indent | enforce consistent indentation in HTML comments | 🔧 |
vue/match-component-file-name | require component name property to match its file name | |
vue/new-line-between-multi-line-property | enforce new lines between multi-line properties in Vue components | 🔧 |
vue/next-tick-style | enforce Promise or callback style in nextTick | 🔧 |
vue/no-bare-strings-in-template | disallow the use of bare strings in <template> | |
vue/no-boolean-default | disallow boolean defaults | 🔧 |
vue/no-duplicate-attr-inheritance | enforce inheritAttrs to be set to false when using v-bind="$attrs" | |
vue/no-empty-component-block | disallow the <template> <script> <style> block to be empty | |
vue/no-multiple-objects-in-class | disallow to pass multiple objects into array to class | |
vue/no-potential-component-option-typo | disallow a potential typo in your component property | |
vue/no-reserved-component-names | disallow the use of reserved names in component definitions | |
vue/no-restricted-block | disallow specific block | |
vue/no-restricted-call-after-await | disallow asynchronously called restricted methods | |
vue/no-restricted-component-options | disallow specific component option | |
vue/no-restricted-custom-event | disallow specific custom event | |
vue/no-restricted-props | disallow specific props | |
vue/no-restricted-static-attribute | disallow specific attribute | |
vue/no-restricted-v-bind | disallow specific argument in v-bind | |
vue/no-static-inline-styles | disallow static inline style attributes | |
vue/no-template-target-blank | disallow target="_blank" attribute without rel="noopener noreferrer" | |
vue/no-unregistered-components | disallow using components that are not registered inside templates | |
vue/no-unsupported-features | disallow unsupported Vue.js syntax on the specified version | 🔧 |
vue/no-unused-properties | disallow unused properties | |
vue/no-useless-mustaches | disallow unnecessary mustache interpolations | 🔧 |
vue/no-useless-v-bind | disallow unnecessary v-bind directives | 🔧 |
vue/padding-line-between-blocks | require or disallow padding lines between blocks | 🔧 |
vue/require-direct-export | require the component to be directly exported | |
vue/require-name-property | require a name property in Vue components | |
vue/script-indent | enforce consistent indentation in <script> | 🔧 |
vue/sort-keys | enforce sort-keys in a manner that is compatible with order-in-components | |
vue/static-class-names-order | enforce static class names order | 🔧 |
vue/v-for-delimiter-style | enforce v-for directive's delimiter style | 🔧 |
vue/v-on-event-hyphenation | enforce v-on event naming style on custom components in template | 🔧 |
vue/v-on-function-call | enforce or forbid parentheses after method calls without arguments in v-on directives | 🔧 |
vue/valid-next-tick | enforce valid nextTick function calls | 🔧 |
# Extension Rules
The following rules extend the rules provided by ESLint itself and apply them to the expressions in the <template>
.
Rule ID | Description | |
---|---|---|
vue/array-bracket-newline | enforce linebreaks after opening and before closing array brackets | 🔧 |
vue/array-bracket-spacing | enforce consistent spacing inside array brackets | 🔧 |
vue/arrow-spacing | enforce consistent spacing before and after the arrow in arrow functions | 🔧 |
vue/block-spacing | disallow or enforce spaces inside of blocks after opening block and before closing block | 🔧 |
vue/brace-style | enforce consistent brace style for blocks | 🔧 |
vue/camelcase | enforce camelcase naming convention | |
vue/comma-dangle | require or disallow trailing commas | 🔧 |
vue/comma-spacing | enforce consistent spacing before and after commas | 🔧 |
vue/comma-style | enforce consistent comma style | 🔧 |
vue/dot-location | enforce consistent newlines before and after dots | 🔧 |
vue/dot-notation | enforce dot notation whenever possible | 🔧 |
vue/eqeqeq | require the use of === and !== | 🔧 |
vue/func-call-spacing | require or disallow spacing between function identifiers and their invocations | 🔧 |
vue/key-spacing | enforce consistent spacing between keys and values in object literal properties | 🔧 |
vue/keyword-spacing | enforce consistent spacing before and after keywords | 🔧 |
vue/max-len | enforce a maximum line length | |
vue/no-constant-condition | disallow constant expressions in conditions | |
vue/no-empty-pattern | disallow empty destructuring patterns | |
vue/no-extra-parens | disallow unnecessary parentheses | 🔧 |
vue/no-irregular-whitespace | disallow irregular whitespace | |
vue/no-restricted-syntax | disallow specified syntax | |
vue/no-sparse-arrays | disallow sparse arrays | |
vue/no-useless-concat | disallow unnecessary concatenation of literals or template literals | |
vue/object-curly-newline | enforce consistent line breaks inside braces | 🔧 |
vue/object-curly-spacing | enforce consistent spacing inside braces | 🔧 |
vue/object-property-newline | enforce placing object properties on separate lines | 🔧 |
vue/operator-linebreak | enforce consistent linebreak style for operators | 🔧 |
vue/prefer-template | require template literals instead of string concatenation | 🔧 |
vue/space-in-parens | enforce consistent spacing inside parentheses | 🔧 |
vue/space-infix-ops | require spacing around infix operators | 🔧 |
vue/space-unary-ops | enforce consistent spacing before or after unary operators | 🔧 |
vue/template-curly-spacing | require or disallow spacing around embedded expressions of template strings | 🔧 |
# Deprecated
- ⚠️ We're going to remove deprecated rules in the next major release. Please migrate to successor/new rules.
- 😇 We don't fix bugs which are in deprecated rules since we don't have enough resources.
Rule ID | Replaced by |
---|---|
vue/name-property-casing | vue/component-definition-name-casing |
vue/no-confusing-v-for-v-if | vue/no-use-v-if-with-v-for |