@@ -189,9 +189,10 @@ function parseScriptFragment(
189
189
code : string ,
190
190
locationCalculator : LocationCalculator ,
191
191
parserOptions : ParserOptions ,
192
+ useSpecifiedParser = false
192
193
) : ESLintExtendedProgram {
193
194
try {
194
- const result = parseScript ( code , parserOptions )
195
+ const result = parseScript ( code , parserOptions , useSpecifiedParser )
195
196
fixLocations ( result , locationCalculator )
196
197
return result
197
198
} catch ( err ) {
@@ -520,9 +521,10 @@ export interface ExpressionParseResult<T extends Node> {
520
521
export function parseScript (
521
522
code : string ,
522
523
parserOptions : ParserOptions ,
524
+ useSpecifiedParser = false
523
525
) : ESLintExtendedProgram {
524
526
const parser : ESLintCustomParser =
525
- typeof parserOptions . parser === "string"
527
+ typeof parserOptions . parser === "string" && useSpecifiedParser
526
528
? // eslint-disable-next-line @mysticatea/ts/no-require-imports
527
529
require ( parserOptions . parser )
528
530
: getEspree ( )
@@ -558,7 +560,7 @@ export function parseScriptElement(
558
560
const locationCalculator = globalLocationCalculator . getSubCalculatorAfter (
559
561
offset ,
560
562
)
561
- const result = parseScriptFragment ( code , locationCalculator , parserOptions )
563
+ const result = parseScriptFragment ( code , locationCalculator , parserOptions , true )
562
564
563
565
// Needs the tokens of start/end tags for `lines-around-*` rules to work
564
566
// correctly.
0 commit comments