[TOC]
# Available rules
# 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 | San | Desc | Schedule |
---|---|---|---|---|
vue/comment-directive (opens new window) | support comment-directives in <template> | ✅ | 已完成 | |
vue/experimental-script-setup-vars (opens new window) | prevent variables defined in <script setup> to be marked as undefined | ❌ | ||
vue/jsx-uses-vars (opens new window) | prevent variables used in JSX to be marked as unused | ❌ |
# Priority A: Essential (Error Prevention)
Enforce all the rules in this category, as well as all higher priority rules, with:
{
"extends": "plugin:vue/essential"
}
Rule ID | Description | San | Desc | Schedule |
---|---|---|---|---|
vue/custom-event-name-casing (opens new window) | enforce custom event names always use "kebab-case" | ✅ | 已完成 | |
vue/no-arrow-functions-in-watch (opens new window) | disallow using arrow functions to define watcher | ❌ | 没有相关语法 | |
vue/no-async-in-computed-properties (opens new window) | disallow asynchronous actions in computed properties | ✅ | 已完成 | |
vue/no-custom-modifiers-on-v-model (opens new window) | disallow custom modifiers on v-model used on the component | ❌ | 没有相关语法 | |
vue/no-dupe-keys (opens new window) | disallow duplication of field names | ✅ | 待开发 | |
vue/no-dupe-v-else-if (opens new window) | disallow duplicate conditions in v-if / v-else-if chains | ✅ | 已完成 | |
vue/no-duplicate-attributes (opens new window) | disallow duplication of attributes | ✅ | 已完成 | |
vue/no-multiple-template-root (opens new window) | disallow adding multiple root nodes to the template | ✅ | 已完成 | |
vue/no-mutating-props (opens new window) | disallow mutation of component props | ❌ | 没有相关语法 | |
vue/no-parsing-error (opens new window) | disallow parsing errors in <template> | ✅ | 已完成 | |
vue/no-reserved-keys (opens new window) | disallow overwriting reserved keys | ✅ | 已完成 | |
vue/initdata-in-component (opens new window) | enforce component's data property to be a function | ✅ | 已完成 | |
vue/no-side-effects-in-computed-properties (opens new window) | disallow side effects in computed properties | ✅ | 已完成 | |
vue/no-template-key (opens new window) | disallow key attribute on <template> | ✅ | 已完成 | |
vue/no-textarea-mustache (opens new window) | disallow mustaches in <textarea> | ✅ | 已完成 | |
vue/no-unused-components (opens new window) | disallow registering components that are not used inside templates | ✅ | 已完成 | |
vue/no-unused-vars (opens new window) | disallow unused variable definitions of v-for directives or scope attributes | ✅ | 已完成 | |
vue/no-use-v-if-with-v-for (opens new window) | disallow use v-if on the same element as v-for | ✅ | 已完成 | |
vue/no-v-for-template-key (opens new window) | disallow key attribute on <template v-for> | ❌ | ||
vue/no-v-model-argument (opens new window) | disallow adding an argument to v-model used in custom component | ❌ | ||
vue/require-component-is (opens new window) | require v-bind:is of <component> elements | ❌ | ||
vue/require-prop-type-constructor (opens new window) | require prop type to be a constructor | ❌ | ||
vue/require-render-return (opens new window) | enforce render function to always return value | ❌ | ||
vue/require-v-for-key (opens new window) | require v-bind:key with v-for directives | ❌ | ||
vue/require-valid-default-prop (opens new window) | enforce props default values to be valid | ❌ | ||
vue/return-in-computed-property (opens new window) | enforce that a return statement is present in computed property | ✅ | 已完成 | |
vue/use-v-on-exact (opens new window) | enforce usage of exact modifier on v-on | ❌ | ||
vue/valid-template-root (opens new window) | enforce valid template root | ✅ | 已完成 | |
vue/valid-v-bind-sync (opens new window) | enforce valid .sync modifier on v-bind directives | ❌ | ||
vue/valid-v-bind (opens new window) | enforce valid v-bind directives | ❌ | ||
vue/valid-v-cloak (opens new window) | enforce valid v-cloak directives | ❌ | ||
vue/valid-v-else-if (opens new window) | enforce valid v-else-if directives | ✅ | san/valid-s-else-if | 已完成 |
vue/valid-v-else (opens new window) | enforce valid v-else directives | ✅ | san/valid-s-else | 已完成 |
vue/valid-v-for (opens new window) | enforce valid v-for directives | ✅ | san/valid-s-for | 已完成 |
vue/valid-v-html (opens new window) | enforce valid v-html directives | ❌ | san/valid-s-html | |
vue/valid-v-if (opens new window) | enforce valid v-if directives | ✅ | san/valid-s-if | 已完成 |
vue/valid-v-model (opens new window) | enforce valid v-model directives | ❌ | ||
vue/valid-v-on (opens new window) | enforce valid v-on directives | ✅ | san/valid-on | 待开发 |
vue/valid-v-once (opens new window) | enforce valid v-once directives | ❌ | ||
vue/valid-v-pre (opens new window) | enforce valid v-pre directives | ❌ | ||
vue/valid-v-show (opens new window) | enforce valid v-show directives | ✅ | 已完成 | |
vue/valid-v-slot (opens new window) | enforce valid v-slot directives | ❌ | ||
vue/valid-v-text (opens new window) | enforce valid v-text directives | ❌ |
# Priority B: Strongly Recommended (Improving Readability)
Enforce all the rules in this category, as well as all higher priority rules, with:
{
"extends": "plugin:vue/strongly-recommended"
}
eRule ID | Description | San | Desc | Schedule |
---|---|---|---|---|
vue/attribute-hyphenation (opens new window) | enforce attribute naming style on custom components in template | ✅ | 已完成 | |
vue/component-definition-name-casing (opens new window) | enforce specific casing for component definition name | ❌ | ||
vue/html-closing-bracket-newline (opens new window) | require or disallow a line break before tag's closing brackets | ✅ | 已完成 | |
vue/html-closing-bracket-spacing (opens new window) | require or disallow a space before tag's closing brackets | ✅ | 已完成 | |
vue/html-end-tags (opens new window) | enforce end tag style | ✅ | 已完成 | |
vue/html-indent (opens new window) | enforce consistent indentation in <template> | ✅ | 已完成 | |
vue/html-quotes (opens new window) | enforce quotes style of HTML attributes | ✅ | 已完成 | |
vue/html-self-closing (opens new window) | enforce self-closing style | ✅ | 已完成 | |
vue/max-attributes-per-line (opens new window) | enforce the maximum number of attributes per line | ✅ | 已完成 | |
vue/multiline-html-element-content-newline (opens new window) | require a line break before and after the contents of a multiline element | ✅ | 已完成 | |
vue/mustache-interpolation-spacing (opens new window) | enforce unified spacing in mustache interpolations | ✅ | 已完成 | |
vue/no-multi-spaces (opens new window) | disallow multiple spaces | ✅ | 已完成 | |
vue/no-spaces-around-equal-signs-in-attribute (opens new window) | disallow spaces around equal signs in attribute | ✅ | 已完成 | |
vue/no-template-shadow (opens new window) | disallow variable declarations from shadowing variables declared in the outer scope | ✅ | 已完成 | |
vue/one-component-per-file (opens new window) | enforce that each component should be in its own file | ✅ | 已完成 | |
vue/prop-name-casing (opens new window) | enforce specific casing for the Prop name in Vue components | ❌ | prop | |
vue/require-default-prop (opens new window) | require default value for props | ❌ | ||
vue/require-prop-types (opens new window) | require type definitions in props | ❌ | ||
vue/singleline-html-element-content-newline (opens new window) | require a line break before and after the contents of a singleline element | ✅ | 已完成 | |
vue/v-bind-style (opens new window) | enforce v-bind directive style | ❌ | ||
vue/v-on-style (opens new window) | enforce v-on directive style | ❌ | v-on 与 @ | |
vue/v-slot-style (opens new window) | enforce v-slot directive style | ❌ |
# Priority C: Recommended (Minimizing Arbitrary Choices and Cognitive Overhead)
Enforce all the rules in this category, as well as all higher priority rules, with:
{
"extends": "plugin:vue/recommended"
}
Rule ID | Description | San | Desc | Sechdule |
---|---|---|---|---|
vue/attributes-order (opens new window) | enforce order of attributes | ✅ | 已完成 | |
vue/component-tags-order (opens new window) | enforce order of component top-level elements | ✅ | 已完成 | |
vue/no-lone-template (opens new window) | disallow unnecessary <template> | ✅ | 已完成 | |
vue/no-multiple-slot-args (opens new window) | disallow to pass multiple arguments to scoped slots | ❌ | ||
vue/no-v-html (opens new window) | disallow use of v-html to prevent XSS attack | ❌ | ||
vue/order-in-components (opens new window) | enforce order of properties in components | ✅ | 已完成 | |
vue/this-in-template (opens new window) | 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/component-name-in-template-casing": "error"
}
}
Rule ID | Description | San | Desc | Schedule |
---|---|---|---|---|
vue/component-name-in-template-casing (opens new window) | enforce specific casing for the component naming style in template | |||
vue/html-comment-content-newline (opens new window) | enforce unified line brake in HTML comments | |||
vue/html-comment-content-spacing (opens new window) | enforce unified spacing in HTML comments | |||
vue/html-comment-indent (opens new window) | enforce consistent indentation in HTML comments | |||
vue/match-component-file-name (opens new window) | require component name property to match its file name | |||
vue/no-bare-strings-in-template (opens new window) | disallow the use of bare strings in <template> | |||
vue/no-boolean-default (opens new window) | disallow boolean defaults | |||
vue/no-duplicate-attr-inheritance (opens new window) | enforce inheritAttrs to be set to false when using v-bind="$attrs" | ❌ | ||
vue/no-empty-component-block (opens new window) | disallow the <template> <script> <style> block to be empty | |||
vue/no-multiple-objects-in-class (opens new window) | disallow to pass multiple objects into array to class | |||
vue/no-potential-component-option-typo (opens new window) | disallow a potential typo in your component property | |||
vue/no-reserved-component-names (opens new window) | disallow the use of reserved names in component definitions | |||
vue/no-restricted-component-options (opens new window) | disallow specific component option | |||
vue/no-restricted-static-attribute (opens new window) | disallow specific attribute | |||
vue/no-restricted-v-bind (opens new window) | disallow specific argument in v-bind | |||
vue/no-static-inline-styles (opens new window) | disallow static inline style attributes | |||
vue/no-template-target-blank (opens new window) | disallow target="_blank" attribute without rel="noopener noreferrer" | |||
vue/no-unregistered-components (opens new window) | disallow using components that are not registered inside templates | |||
vue/no-unsupported-features (opens new window) | disallow unsupported Vue.js syntax on the specified version | |||
vue/no-unused-properties (opens new window) | disallow unused properties | |||
vue/no-useless-mustaches (opens new window) | disallow unnecessary mustache interpolations | |||
vue/no-useless-v-bind (opens new window) | disallow unnecessary v-bind directives | ❌ | ||
vue/padding-line-between-blocks (opens new window) | require or disallow padding lines between blocks | |||
vue/require-direct-export (opens new window) | require the component to be directly exported | |||
vue/require-name-property (opens new window) | require a name property in Vue components | |||
vue/script-indent (opens new window) | enforce consistent indentation in <script> | |||
vue/sort-keys (opens new window) | enforce sort-keys in a manner that is compatible with order-in-components | |||
vue/static-class-names-order (opens new window) | enforce static class names order | |||
vue/v-for-delimiter-style (opens new window) | enforce v-for directive's delimiter style | |||
vue/v-on-function-call (opens new window) | enforce or forbid parentheses after method calls without arguments in v-on directives |
# Extension Rules
The following rules extend the rules provided by ESLint itself and apply them to the expressions in the <template>
.
Rule ID | Description | San | Desc | Sechdule |
---|---|---|---|---|
vue/array-bracket-spacing (opens new window) | enforce consistent spacing inside array brackets | Baidu | ||
vue/arrow-spacing (opens new window) | enforce consistent spacing before and after the arrow in arrow functions | Baidu | ||
vue/block-spacing (opens new window) | disallow or enforce spaces inside of blocks after opening block and before | Baidu | ||
vue/brace-style (opens new window) | enforce consistent brace style for blocks | Baidu | ||
vue/camelcase (opens new window) | enforce camelcase naming convention | Baidu | ||
vue/comma-dangle (opens new window) | require or disallow trailing commas | Baidu | ||
vue/comma-spacing (opens new window) | enforce consistent spacing before and after commas | Baidu | ||
vue/comma-style (opens new window) | enforce consistent comma style | Baidu | ||
vue/dot-location (opens new window) | enforce consistent newlines before and after dots | Baidu | ||
vue/dot-notation (opens new window) | enforce dot notation whenever possible | Baidu | ||
vue/eqeqeq (opens new window) | require the use of === and !== | Baidu | ||
vue/func-call-spacing (opens new window) | require or disallow spacing between function identifiers and their | Baidu | ||
vue/key-spacing (opens new window) | enforce consistent spacing between keys and values in object literal properties | Baidu | ||
vue/keyword-spacing (opens new window) | enforce consistent spacing before and after keywords | Baidu | ||
vue/max-len (opens new window) | enforce a maximum line length | Baidu | ||
vue/no-empty-pattern (opens new window) | disallow empty destructuring patterns | Baidu | ||
vue/no-extra-parens (opens new window) | disallow unnecessary parentheses | Baidu | ||
vue/no-irregular-whitespace (opens new window) | disallow irregular whitespace | Baidu | ||
vue/no-restricted-syntax (opens new window) | disallow specified syntax | Baidu | ||
vue/no-sparse-arrays (opens new window) | disallow sparse arrays | Baidu | ||
vue/no-useless-concat (opens new window) | disallow unnecessary concatenation of literals or template literals | Baidu | ||
vue/object-curly-newline (opens new window) | enforce consistent line breaks inside braces | Baidu | ||
vue/object-curly-spacing (opens new window) | enforce consistent spacing inside braces | Baidu | ||
vue/object-property-newline (opens new window) | enforce placing object properties on separate lines | Baidu | ||
vue/operator-linebreak (opens new window) | enforce consistent linebreak style for operators | Baidu | ||
vue/prefer-template (opens new window) | require template literals instead of string concatenation | Baidu | ||
vue/space-in-parens (opens new window) | enforce consistent spacing inside parentheses | Baidu | ||
vue/space-infix-ops (opens new window) | require spacing around infix operators | Baidu | ||
vue/space-unary-ops (opens new window) | enforce consistent spacing before or after unary operators | Baidu | ||
vue/template-curly-spacing (opens new window) | require or disallow spacing around embedded expressions of | Baidu |
# 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.