The ESLint custom parser for `.vue` files.
MIT License
This release supported the new syntax in Vue.js 2.6 π
v-bind
directive with .prop
modifier. (actually, this is experimental and behind flag in Vue.js 2.6)v-slot
directive and that shorthand. (https://vuejs.org/v2/api/#v-slot)This release contains a drastic change about VDirectiveKey
AST node because now the directive key have gotten to be able to have JavaScript expression.
export interface VDirectiveKey extends HasLocation, HasParent {
type: "VDirectiveKey"
parent: VAttribute
- name: string
- argument: string | null
- modifiers: string[]
- shorthand: boolean
+ name: VIdentifier
+ argument: VExpressionContainer | VIdentifier | null
+ modifiers: VIdentifier[]
}
name
, argument
, and modifiers
to AST nodes from strings. Especially, argument
will be a VExpressionContainer
node if the directive has dynamic argument syntax.shorthand
member. To check wheather the directive key is a shorthand or not, use name.rawName
member.
:foo
... directiveKey.name.rawName
is ":"
(and directiveKey.name.name
is "bind"
)..foo
... directiveKey.name.rawName
is "."
(and directiveKey.name.name
is "bind"
and directiveKey.modifiers
includes the identifier node of "prop"
).@foo
... directiveKey.name.rawName
is "@"
(and directiveKey.name.name
is "on"
).#foo
... directiveKey.name.rawName
is "#"
(and directiveKey.name.name
is "slot"
).slot-scope
attributes for https://github.com/vuejs/eslint-plugin-vue/issues/722.v-on
directives (https://github.com/vuejs/eslint-plugin-vue/issues/716).v-pre
elements (https://github.com/vuejs/eslint-plugin-vue/issues/733).BinaryExpression
nodes before, but it's VFilterSequenceExpression
nodes now.parserOptions.parser:false
to skip parsing <script>
elements completely. This is useful for the language ESLint community don't provide that custom parser.{{}}
as a part of text rather than an empty mustache.espree
and eslint-scope
packages, vue-eslint-parser
is using internally, to 4.0.0
. This means it dropped the support of parserOptions.ecmaFeatures.experimentalObjectRestSpread
option. Use ecmaVersion
option instead.slot-scope
attribute to define variables which are available on inside of the element. The slot-scope
attribute is expressed as new VSlotScopeExpression
node. And it changed the AST of <template scope>
attribute to the VSlotScopeExpression
node.vue-eslint-parser
has been rewritten completely!
Now vue-eslint-parser
gets the ability to parse <template>
(only HTML) in .vue
files to AST.
parserServices
:
defineTemplateBodyVisitor(templateVisitor, scriptVisitor)
... returns ESLint visitor to traverse <template>
.getTemplateBodyTokenStore()
... returns ESLint TokenStore
to get the tokens of <template>
.<template>
AST specification.This is experimental version.
vue-eslint-parser
parses <template>
of single file components.
<template>
.vue-eslint-parser
supports. It requires 3.9.0 or later.vue-eslint-parser
needs parserServices
feature to release the capabilities to access ASTs of <template>
in future.If no problem, I will release 1.0.0 with this version after a few day.