版本策略不遵循 ESLint 语义化版本,minor 升级可能报出更多错误,建议用 ~ 锁定版本;解析 .vue 文件需依赖 vue-eslint-parser,默认 JS 解析器不适用;具体配置与规则文档在官网 eslint.vuejs.org,README 未展开
npm install --save-dev eslint eslint-plugin-vueREADME 未说明,纯 Node.js 工具,无 GPU 或显存要求
Vue.js 官方 ESLint 插件,为 .vue 单文件组件提供模板与脚本的静态检查规则
Vue.js 官方 ESLint 插件,用来检查 .vue 单文件组件和模板语法,帮你提前发现代码错误和风格问题。
核心能力
- 提供 Vue 模板与 <script> 的官方 lint 规则集
- 内置多套可共享配置,按 Vue 版本选用
- 借助 vue-eslint-parser 解析 SFC 生成增强 AST
- 支持 defineTemplateBodyVisitor 遍历模板节点
容易踩的坑
- v10.12.0最新正式版2026-10-26 · 2026-10-26 13:42 UTC
New rules
- Added new
vue/no-content-outside-blockrule (#3119) - Added new
vue/no-define-model-defaultrule (#3146) - Added new
vue/no-props-shadowrule (#3118)
New rule options
- Added
requiredoption tovue/block-langto report components that omit a required block entirely (#3125) - Added
ignoreMixinsoption tovue/require-explicit-emitsrule (#3141)
Fixed false negatives (may result in more lint issues)
- Added support for refs detected by type information, such as refs returned from composables, to
vue/no-ref-as-operandrule (#3144) - Fixed
vue/no-dupe-keysnot reportingdefineModel()names that collide with a prop, another model, or a<script setup>variable (#3163) - Fixed
vue/no-dupe-keysnot reporting<script setup>variables that shadow a prop while aliasing a different one, such asconst foo = toRef(props, 'bar')(#3124) - Fixed
vue/no-multi-spacesnot reporting multiple spaces in the tags of some top-level blocks, e.g.<script setup>(#3162) - Fixed
vue/no-ref-as-operandandvue/no-ref-object-reactivity-lossto also check refs created withuseTemplateRef()(#3154) - Fixed
vue/no-unused-propertiesnot reporting unused non-props properties in components that use$propsas a whole (e.g.v-bind="$props") (#3161) - Fixed
vue/padding-lines-in-component-definitionto check every pair of adjacent properties, not only the first, whenwithinOptionorwithinEachis not set (#3155) - Fixed
vue/require-default-prop,vue/no-boolean-default,vue/no-required-prop-with-defaultandvue/require-valid-default-propnot handling defaults that are passed towithDefaults()by reference or spread instead of an inline object literal (#3114)
Fixed false positives (may result in fewer lint issues)
- Changed
vue/singleline-html-element-content-newlineandvue/multiline-html-element-content-newlinerules to ignorerouter-linkandnuxt-linkelements by default (#3165) - Fixed [`vue/no-undef-propertie
- Added new
- v10.11.12026-09-24 · 2026-09-24 01:08 UTC
查看更新说明
Patch Changes
- Fixed
vue/no-ref-object-reactivity-lossfalse negatives for values gotten in an immediately invoked function expression (IIFE) (#3115) - Fixed
vue/no-unused-propertiesfalse positive for props explicitly typed asnever(#3113) - Fixed
vue/require-default-propto no longer require a default value fordefineModel(#3138)
- Fixed
- v10.11.02026-09-06 · 2026-09-06 09:58 UTC
查看更新说明
Minor Changes
- Added
defineModelsupport tovue/require-default-propandvue/require-valid-default-proprules (#3032) - Added support for SFCs using
@nuxtjs/composition-api, which is now treated the same asvueor@vue/composition-api(#3100) - Added new
vue/no-shadow-native-eventsrule (#2558)
Patch Changes
- Fixed
vue/use-v-on-exactto avoid reporting@keydown.stopwhen paired with an exact key-specific listener (#3082) - Specified explicit
itemspolicies for array rule option schemas (#3112) - Updated resources (HTML elements) (#3132 and #3133)
- Added
- v10.10.02026-07-20 · 2026-07-20 10:46 UTC
查看更新说明
Minor Changes
- Added support for template literals to
vue/prefer-separate-static-class(#3097) - Added
allowLineSeparatedGroupsoption tovue/sort-keysrule (#3084)
Patch Changes
- Updated
@eslint-community/eslint-utils,semverandxml-name-validatordependencies (#3094)
- Added support for template literals to
- v10.9.22026-06-03 · 2026-06-03 09:04 UTC
查看更新说明
Patch Changes
- Fixed
vue/custom-event-name-casingto check segments of colon-separated event names likeupdate:foo-bar(#3079) - Fixed
vue/one-component-per-fileto not report functions not imported from Vue (#3063) - Fixed
vue/prefer-import-from-vueto not report imports/exports of names that are not re-exported byvue(#3081) - Fixed
vue/return-in-computed-propertyandvue/require-render-returnto not report exhaustive switch statements when TypeScript type information is available (#3067)
- Fixed
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
eslint-plugin-vue
Official ESLint plugin for Vue.js
:book: Documentation
Please refer to the official website.
:anchor: Versioning Policy
This plugin follows Semantic Versioning. However, please note that we do not follow ESLint's Semantic Versioning Policy. In minor version releases, this plugin may change the sharable configs provided by the plugin or the default behavior of the plugin's rules in order to add features to the plugin. Because we want to add many features to the plugin soon, so that users can easily take advantage of new features in Vue and Nuxt.
According to our policy, any minor update may report more linting errors than the previous release. As such, we recommend using the tilde (~) in package.json to guarantee the results of your builds.
:newspaper: Releases
This project uses GitHub Releases.
:beers: Contribution Guide
Contributing is welcome! See the ESLint Vue Plugin Developer Guide.
Working With Rules
Be sure to read the official ESLint guide before you start writing a new rule.
To see what an abstract syntax tree (AST) of your code looks like, you may use AST Explorer. After opening AST Explorer, select Vue as the syntax and vue-eslint-parser as the parser.
The default JavaScript parser must be replaced because Vue.js single file components are not plain JavaScript, but a custom file format. vue-eslint-parser is a replacement parser that generates an enhanced AST with nodes that represent specific parts of the template syntax, as well as the contents of the <script> tag.
To learn more about certain nodes in a produced AST, see the ESTree project page and the vue-eslint-parser AST documentation.
vue-eslint-parser provides a few useful parser services to help traverse the produced AST and access template tokens:
context.parserServices.defineTemplateBodyVisitor(visitor, scriptVisitor)context.parserServices.getTemplateBodyTokenStore()
Check out an example rule to see usage of these services.
Be aware that depending on the code samples you write in tests, the RuleTester parser property must be set accordingly (this can be done on a test by test basis). See an example here.
If you're stuck, remember there are many rules available for reference. If you can't find the right solution, don't hesitate to reach out in issues – we're happy to help!
:lock: License
See the LICENSE file for license rights and limitations (MIT).