Back to directory
vuejs avatar

eslint-plugin-vue

Official ESLint plugin for Vue.js. Read more below about its uses, features, and usage.

Clone repository

git clone https://github.com/vuejs/eslint-plugin-vue.git

4,592

Stars

720

Forks

52

Watchers

MIT

License

eslint-plugin-vue

NPM version NPM downloads CI License

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).

Releases

Minor Changes

Added support for template literals to vue/prefer-separate-static-class (#3097) Added allowLineSeparatedGroups option to vue/sort-keys rule (#3084)

Patch Changes

Updated @eslint-commu...

Patch Changes

Fixed vue/custom-event-name-casing to check segments of colon-separated event names like update:foo-bar (#3079) Fixed vue/one-component-per-file to not report functions not imported fro...

Patch Changes

Updated peer dependency version for vue-eslint-parser to fix parsing errors in Vue SFCs (#3075)

Minor Changes

Added "inject" to groups option in vue/no-unused-properties rule (#3052) Added new ignores option to vue/no-literals-in-template rule (#3072) Added support for :single-line/:multi-line...

Minor Changes

Added ESLint v10 as an allowed peer dependency (needs eslint-parser-vue v10.3.0) (#2962) Added more Promise functions to vue/no-async-in-computed-properties (#3020) Added ignoreVBindObj...

Contributors

ota-meshi avatar ota-meshi 598 commits michalsnik avatar michalsnik 124 commits FloEdelmann avatar FloEdelmann 122 commits ST-DDT avatar ST-DDT 109 commits mysticatea avatar mysticatea 72 commits armano2 avatar armano2 60 commits waynzh avatar waynzh 55 commits 9romise avatar 9romise 36 commits github-actions[bot] avatar github-actions[bot] 21 commits chrisvfritz avatar chrisvfritz 15 commits

250 contributors by commits. Profile dekhne ke liye kisi bhi developer par click karein.