File tree Expand file tree Collapse file tree 1 file changed +21
-6
lines changed
Expand file tree Collapse file tree 1 file changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -219,18 +219,33 @@ module.exports = function (eleventyConfig) {
219219
220220 const isRuleRemoved = ! Object . hasOwn ( env . rules_meta , env . title ) ;
221221
222- /*
223- * TypeScript isn't yet supported on the playground:
224- * https://github.com/eslint/eslint.org/issues/709
225- */
226- if ( isRuleRemoved || isTypeScriptCode ) {
222+ const tsLanguageOptions = {
223+ languageOptions : {
224+ ...languageOptions ,
225+ parser : "@typescript-eslint/parser" ,
226+ parserOptions : {
227+ ecmaFeatures : {
228+ jsx : true ,
229+ } ,
230+ sourceType : "module" ,
231+ } ,
232+ } ,
233+ } ;
234+
235+ const languageOptionsForPlayground = languageOptions
236+ ? { languageOptions }
237+ : void 0 ;
238+
239+ if ( isRuleRemoved ) {
227240 return `<div class="${ type } ">` ;
228241 }
229242
230243 // See https://github.com/eslint/eslint.org/blob/29e1d8a000592245e4a30c1996e794643e9b263a/src/playground/App.js#L91-L105
231244 const state = encodeToBase64 (
232245 JSON . stringify ( {
233- options : languageOptions ? { languageOptions } : void 0 ,
246+ options : isTypeScriptCode
247+ ? tsLanguageOptions
248+ : languageOptionsForPlayground ,
234249 text : code ,
235250 } ) ,
236251 ) ;
You can’t perform that action at this time.
0 commit comments