Gathering detailed insights and metrics for vue-eslint-parser
Gathering detailed insights and metrics for vue-eslint-parser
Gathering detailed insights and metrics for vue-eslint-parser
Gathering detailed insights and metrics for vue-eslint-parser
vue-eslint-parser-template-tokenizer-pug
This is an internal library. If you just want to lint your pug templates, use [eslint-plugin-vue-pug](https://github.com/rashfael/eslint-plugin-vue-pug).
@vue-vine/eslint-parser
ESLint parser for Vue Vine
typescript-eslint-parser-for-extra-files
An experimental ESLint custom parser for Vue, Svelte, and Astro for use with TypeScript. It provides type information in combination with each framework's ESLint custom parser.
eslint-plugin-tsvue-parser
Used for the JS/TS hybrid project, make vue+ts become another extension
npm install vue-eslint-parser
Typescript
Module System
Min. Node Version
Node Version
NPM Version
TypeScript (93.74%)
JavaScript (6.26%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
477 Stars
412 Commits
79 Forks
10 Watchers
4 Branches
87 Contributors
Updated on Jul 08, 2025
Latest Version
10.2.0
Package Id
vue-eslint-parser@10.2.0
Unpacked Size
1.09 MB
Size
196.93 kB
File Count
6
NPM Version
11.3.0
Node Version
24.2.0
Published on
Jul 01, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
40
The ESLint custom parser for .vue
files.
This parser allows us to lint the <template>
of .vue
files. We can make mistakes easily on <template>
if we use complex directives and expressions in the template. This parser and the rules of eslint-plugin-vue would catch some of the mistakes.
1npm install --save-dev eslint vue-eslint-parser
Write parser
option into your eslint.config.*
file.
1import vueParser from "vue-eslint-parser" 2export default [ 3 js.configs.recommended, 4 { 5 files: ["*.vue", "**/*.vue"], 6 languageOptions: { 7 parser: vueParser, 8 }, 9 } 10]
parserOptions
has the same properties as what espree, the default parser of ESLint, is supporting.
For example:
1import vueParser from "vue-eslint-parser" 2export default [ 3 { 4 files: ["*.vue", "**/*.vue"], 5 languageOptions: { 6 parser: vueParser, 7 sourceType: "module", 8 ecmaVersion: "latest", 9 parserOptions: { 10 ecmaFeatures: { 11 globalReturn: false, 12 impliedStrict: false, 13 jsx: false 14 } 15 } 16 }, 17 } 18]
You can use parserOptions.parser
property to specify a custom parser to parse <script>
tags.
Other properties than parser would be given to the specified parser.
For example:
1import vueParser from "vue-eslint-parser" 2import babelParser from "@babel/eslint-parser" 3export default [ 4 { 5 files: ["*.vue", "**/*.vue"], 6 languageOptions: { 7 parser: vueParser, 8 parserOptions: { 9 parser: babelParser, 10 } 11 }, 12 } 13]
1import vueParser from "vue-eslint-parser" 2import tsParser from "@typescript-eslint/parser" 3export default [ 4 { 5 files: ["*.vue", "**/*.vue"], 6 languageOptions: { 7 parser: vueParser, 8 parserOptions: { 9 parser: tsParser, 10 } 11 }, 12 } 13]
You can also specify an object and change the parser separately for <script lang="...">
.
1import vueParser from "vue-eslint-parser" 2import tsParser from "@typescript-eslint/parser" 3export default [ 4 { 5 files: ["*.vue", "**/*.vue"], 6 languageOptions: { 7 parser: vueParser, 8 parserOptions: { 9 "parser": { 10 // Script parser for `<script>` 11 "js": "espree", 12 13 // Script parser for `<script lang="ts">` 14 "ts": tsParser, 15 16 // Script parser for vue directives (e.g. `v-if=` or `:attribute=`) 17 // and vue interpolations (e.g. `{{variable}}`). 18 // If not specified, the parser determined by `<script lang ="...">` is used. 19 "<template>": "espree", 20 } 21 } 22 }, 23 } 24]
If the parserOptions.parser
is false
, the vue-eslint-parser
skips parsing <script>
tags completely.
This is useful for people who use the language ESLint community doesn't provide custom parser implementation.
You can use parserOptions.vueFeatures
property to specify how to parse related to Vue features.
For example:
1import vueParser from "vue-eslint-parser" 2export default [ 3 { 4 files: ["*.vue", "**/*.vue"], 5 languageOptions: { 6 parser: vueParser, 7 parserOptions: { 8 vueFeatures: { 9 filter: true, 10 interpolationAsNonHTML: true, 11 styleCSSVariableInjection: true, 12 customMacros: [] 13 } 14 } 15 }, 16 } 17]
You can use parserOptions.vueFeatures.filter
property to specify whether to parse the Vue2 filter. If you specify false
, the parser does not parse |
as a filter.
For example:
1{ 2 "parserOptions": { 3 "vueFeatures": { 4 "filter": false 5 } 6 } 7}
If you specify false
, it can be parsed in the same way as Vue 3.
The following template parses as a bitwise operation.
1<template> 2 <div>{{ a | b }}</div> 3</template>
However, the following template that are valid in Vue 2 cannot be parsed.
1<template> 2 <div>{{ a | valid:filter }}</div> 3</template>
You can use parserOptions.vueFeatures.interpolationAsNonHTML
property to specify whether to parse the interpolation as HTML. If you specify true
, the parser handles the interpolation as non-HTML (However, you can use HTML escaping in the interpolation). Default is true
.
For example:
1{ 2 "parserOptions": { 3 "vueFeatures": { 4 "interpolationAsNonHTML": true 5 } 6 } 7}
If you specify true
, it can be parsed in the same way as Vue 3.
The following template can be parsed well.
1<template> 2 <div>{{a<b}}</div> 3</template>
But, it cannot be parsed with Vue 2.
If set to true
, to parse expressions in v-bind
CSS functions inside <style>
tags. v-bind()
is parsed into the VExpressionContainer
AST node and held in the VElement
of <style>
. Default is true
.
See also to here.
Specifies an array of names of custom macros other than Vue standard macros.
For example, if you have a custom macro defineFoo()
and you want it processed by the parser, specify ["defineFoo"]
.
Note that this option only works in <script setup>
.
This is an experimental feature. It may be changed or deleted without notice in the minor version.
You can use parserOptions.templateTokenizer
property to specify custom tokenizers to parse <template lang="...">
tags.
For example to enable parsing of pug templates:
1{ 2 "parserOptions": { 3 "templateTokenizer": { 4 // template tokenizer for `<template lang="pug">` 5 "pug": "vue-eslint-parser-template-tokenizer-pug", 6 } 7 } 8}
This option is only intended for plugin developers. Be careful when using this option directly, as it may change behaviour of rules you might have enabled.
If you just want pug support, use eslint-plugin-vue-pug instead, which uses this option internally.
See implementing-custom-template-tokenizers.md for information on creating your own template tokenizer.
parserServices
to traverse <template>
.
defineTemplateBodyVisitor(templateVisitor, scriptVisitor, options)
... returns ESLint visitor to traverse <template>
.getTemplateBodyTokenStore()
... returns ESLint TokenStore
to get the tokens of <template>
.getDocumentFragment()
... returns the root VDocumentFragment
.defineCustomBlocksVisitor(context, customParser, rule, scriptVisitor)
... returns ESLint visitor that parses and traverses the contents of the custom block.defineDocumentVisitor(documentVisitor, options)
... returns ESLint visitor to traverses the document.<template>
AST specification.defineTemplateBodyVisitor
was moved from context
to context.sourceCode
after major version 9.x
defineTemplateBodyVisitor(templateBodyVisitor, scriptVisitor, options)
Arguments
templateBodyVisitor
... Event handlers for <template>
.scriptVisitor
... Event handlers for <script>
or scripts. (optional)options
... Options. (optional)
templateBodyTriggerSelector
... Script AST node selector that triggers the templateBodyVisitor. Default is "Program:exit"
. (optional)1import { AST } from "vue-eslint-parser" 2 3export function create(context) { 4 return context.sourceCode.parserServices.defineTemplateBodyVisitor( 5 // Event handlers for <template>. 6 { 7 VElement(node: AST.VElement): void { 8 //... 9 } 10 }, 11 // Event handlers for <script> or scripts. (optional) 12 { 13 Program(node: AST.ESLintProgram): void { 14 //... 15 } 16 }, 17 // Options. (optional) 18 { 19 templateBodyTriggerSelector: "Program:exit" 20 } 21 ) 22}
Some rules make warnings due to the outside of <script>
tags.
Please disable those rules for .vue
files as necessary.
Welcome contributing!
Please use GitHub's Issues/PRs.
If you want to write code, please execute npm install
after you cloned this repository.
The npm install
command installs dependencies.
npm test
runs tests and measures coverage.npm run build
compiles TypeScript source code to index.js
, index.js.map
, and index.d.ts
.npm run coverage
shows the coverage result of npm test
command with the default browser.npm run clean
removes the temporary files which are created by npm test
and npm run build
.npm run lint
runs ESLint.npm run update-fixtures
updates files in test/fixtures/ast
directory based on test/fixtures/ast/*/source.vue
files.npm run watch
runs build
, update-fixtures
, and tests with --watch
option.No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
6 commit(s) and 4 issue activity found in the last 90 days -- score normalized to 8
Reason
Found 9/30 approved changesets -- score normalized to 3
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More