Skip to content

Commit d692baf

Browse files
ptrxyzota-meshi
andauthored
Allow to specify TS target using parserOptions (#375)
Co-authored-by: Yosuke Ota <[email protected]>
1 parent 3643e15 commit d692baf

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

.changeset/many-cougars-act.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"eslint-plugin-svelte": minor
3+
---
4+
5+
Change to use `parserServices.program.getCompilerOptions().target` for TS transpile in `svelte/valid-compile` rule.
6+

src/shared/svelte-compile-warns/transform/typescript.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ export function transform(
2929
const output = ts.transpileModule(code, {
3030
reportDiagnostics: false,
3131
compilerOptions: {
32-
target: ts.ScriptTarget.ESNext,
32+
target:
33+
context.parserServices.program?.getCompilerOptions()?.target ||
34+
ts.ScriptTarget.ESNext,
35+
module: ts.ModuleKind.ESNext,
3336
importsNotUsedAsValues: ts.ImportsNotUsedAsValues.Preserve,
3437
sourceMap: true,
3538
},

0 commit comments

Comments
 (0)