Skip to content

Commit 229a2e1

Browse files
fix parser's value in downloaded config
1 parent d2e6a0e commit 229a2e1

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/playground/components/Configuration.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,13 +253,20 @@ export default function Configuration({
253253
? void 0
254254
: {
255255
...options.languageOptions,
256+
...(options?.languageOptions.parser && {
257+
parser: "tsParser",
258+
}),
256259
parserOptions: !hasEcmaFeatures
257260
? void 0
258261
: options.languageOptions.parserOptions,
259262
},
260263
};
261264

262-
const configFileContent = `${configFileFormat === "ESM" ? "export default" : "module.exports ="} ${JSON.stringify([optionsForConfigFile], null, 4)};`;
265+
const configFileContent =
266+
`${options.languageOptions.parser && 'import tsParser from "@typescript-eslint/parser;"'}\n${configFileFormat === "ESM" ? "export default" : "module.exports ="} ${JSON.stringify([optionsForConfigFile], null, 4)};`.replace(
267+
/"parser": "tsParser"/gu,
268+
'"parser": tsParser',
269+
);
263270

264271
return (
265272
<div className="playground__config-options__sections">

0 commit comments

Comments
 (0)