@@ -85,25 +85,32 @@ export function parseForESLint(
8585 options = Object . assign (
8686 {
8787 comment : true ,
88- ecmaVersion : 2017 ,
8988 loc : true ,
9089 range : true ,
9190 tokens : true ,
9291 } ,
9392 options || { } ,
9493 )
9594
95+ const optionsWithEcmaVersion = {
96+ ...options ,
97+ ecmaVersion : options . ecmaVersion || 2017 ,
98+ }
99+
96100 let result : AST . ESLintExtendedProgram
97101 let document : AST . VDocumentFragment | null
98102 let locationCalculator : LocationCalculatorForHtml | null
99103 if ( ! isVueFile ( code , options ) ) {
100- result = parseScript ( code , options )
104+ result = parseScript ( code , optionsWithEcmaVersion )
101105 document = null
102106 locationCalculator = null
103107 } else {
104108 const skipParsingScript = options . parser === false
105- const tokenizer = new HTMLTokenizer ( code , options )
106- const rootAST = new HTMLParser ( tokenizer , options ) . parse ( )
109+ const tokenizer = new HTMLTokenizer ( code , optionsWithEcmaVersion )
110+ const rootAST = new HTMLParser (
111+ tokenizer ,
112+ optionsWithEcmaVersion ,
113+ ) . parse ( )
107114
108115 locationCalculator = new LocationCalculatorForHtml (
109116 tokenizer . gaps ,
@@ -124,7 +131,7 @@ export function parseForESLint(
124131
125132 let scriptSetup : VElement | undefined
126133 if ( skipParsingScript || ! scripts . length ) {
127- result = parseScript ( "" , options )
134+ result = parseScript ( "" , optionsWithEcmaVersion )
128135 } else if (
129136 scripts . length === 2 &&
130137 ( scriptSetup = scripts . find ( isScriptSetup ) )
0 commit comments