Skip to content

Commit f7a7a1e

Browse files
authored
Change the default of parserOptions.vueFeatures.interpolationAsNonHTML to true. (#130)
* Change the default of `parserOptions.vueFeatures.interpolationAsNonHTML` to true. * Update tests * format and fix tests
1 parent 2586806 commit f7a7a1e

File tree

19 files changed

+3251
-501
lines changed

19 files changed

+3251
-501
lines changed

Diff for: README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ For example:
121121
"parserOptions": {
122122
"vueFeatures": {
123123
"filter": true,
124-
"interpolationAsNonHTML": false,
124+
"interpolationAsNonHTML": true,
125125
"styleCSSVariableInjection": true,
126126
}
127127
}
@@ -163,7 +163,7 @@ However, the following template that are valid in Vue 2 cannot be parsed.
163163

164164
### parserOptions.vueFeatures.interpolationAsNonHTML
165165

166-
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).
166+
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`.
167167
For example:
168168

169169
```json

Diff for: src/common/parser-options.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export interface ParserOptions {
66
// vue-eslint-parser options
77
parser?: boolean | string
88
vueFeatures?: {
9-
interpolationAsNonHTML?: boolean // default false
9+
interpolationAsNonHTML?: boolean // default true
1010
filter?: boolean // default true
1111
styleCSSVariableInjection?: boolean // default true
1212
}

Diff for: src/html/tokenizer.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -1852,7 +1852,12 @@ export class Tokenizer {
18521852
this.appendTokenValue(LEFT_CURLY_BRACKET, null)
18531853
this.appendTokenValue(LEFT_CURLY_BRACKET, null)
18541854

1855-
if (!this.parserOptions.vueFeatures?.interpolationAsNonHTML) {
1855+
if (
1856+
!(
1857+
this.parserOptions.vueFeatures?.interpolationAsNonHTML ??
1858+
true
1859+
)
1860+
) {
18561861
return this.returnState
18571862
}
18581863

0 commit comments

Comments
 (0)