From f765688399bd7aaf3e6cc906f9959591b3865566 Mon Sep 17 00:00:00 2001 From: Tanuj Kanti Date: Sat, 26 Jul 2025 22:14:26 +0530 Subject: [PATCH 1/3] fix: playground crash due to ts parser --- src/playground/App.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/playground/App.js b/src/playground/App.js index b779f54eb..32a2a77ba 100644 --- a/src/playground/App.js +++ b/src/playground/App.js @@ -227,9 +227,18 @@ const App = () => { const storeState = useCallback( ({ newText, newOptions }) => { + const opts = { ...options }; + + if ( + opts.languageOptions && + opts.languageOptions.parser === typeScriptESLintParser + ) { + opts.languageOptions.parser = "@typescript-eslint/parser"; + } + const serializedState = JSON.stringify({ text: newText, - options: newOptions || options, + options: newOptions || opts, }); if (hasLocalStorage()) { From 958f59709b4ed9f2c83f17764bb3768a53165e29 Mon Sep 17 00:00:00 2001 From: Tanuj Kanti Date: Sun, 27 Jul 2025 17:54:25 +0530 Subject: [PATCH 2/3] remove the parser update logic for default options --- src/playground/App.js | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/src/playground/App.js b/src/playground/App.js index 32a2a77ba..430b11c1a 100644 --- a/src/playground/App.js +++ b/src/playground/App.js @@ -48,10 +48,6 @@ const fillOptionsDefaults = options => ({ ...options, languageOptions: { ...options.languageOptions, - ...(options?.languageOptions?.parser === - "@typescript-eslint/parser" && { - parser: typeScriptESLintParser, - }), parserOptions: { ecmaFeatures: {}, ...options.languageOptions?.parserOptions, @@ -227,18 +223,9 @@ const App = () => { const storeState = useCallback( ({ newText, newOptions }) => { - const opts = { ...options }; - - if ( - opts.languageOptions && - opts.languageOptions.parser === typeScriptESLintParser - ) { - opts.languageOptions.parser = "@typescript-eslint/parser"; - } - const serializedState = JSON.stringify({ text: newText, - options: newOptions || opts, + options: newOptions || options, }); if (hasLocalStorage()) { From ccc7e5ca06be2db0c9916d34ce997ec0b746685f Mon Sep 17 00:00:00 2001 From: Tanuj Kanti Date: Tue, 5 Aug 2025 13:12:52 +0530 Subject: [PATCH 3/3] remove the function to check parser object --- src/playground/components/Configuration.js | 23 +++------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/src/playground/components/Configuration.js b/src/playground/components/Configuration.js index 12ca8c5db..0393ec7c8 100644 --- a/src/playground/components/Configuration.js +++ b/src/playground/components/Configuration.js @@ -108,18 +108,6 @@ const defaultOption = { const isEmpty = obj => Object.keys(obj).length === 0; -const parserValue = parser => { - if ( - (typeof parser === "object" && - parser.meta.name === "typescript-eslint/parser") || - parser === "@typescript-eslint/parser" - ) { - return "@typescript-eslint/parser"; - } - - return null; -}; - export default function Configuration({ initialOptions, rulesMeta, @@ -260,11 +248,7 @@ export default function Configuration({ if (config.languageOptions && config.languageOptions.parser) { const parser = config.languageOptions.parser; - if ( - parser === "@typescript-eslint/parser" || - (typeof parser === "object" && - parser?.meta?.name === "typescript-eslint/parser") - ) { + if (parser === "@typescript-eslint/parser") { config.languageOptions.parser = "___TS_PARSER_PLACEHOLDER___"; } } @@ -493,9 +477,8 @@ export default function Configuration({ value={ESLintParserOptions.filter( eslintParser => eslintParser.value === - (parserValue( - options.languageOptions?.parser, - ) || "default"), + (options.languageOptions?.parser || + "default"), )} options={ESLintParserOptions} onChange={selected => {