Skip to content

Suggestion: Support TypeScript syntax in playground #709

Open
@JoshuaKGoldberg

Description

@JoshuaKGoldberg

What problem do you want to solve?

Coming over from eslint/eslint#19431 (comment): the playground on http://eslint.org/play right now does not support TypeScript syntax. Now that rules are adding support for TS syntax (eslint/eslint#19173), this blocks their TS-specific blocks from being represented in the playground.

What do you think is the correct solution?

How about:

  • Adding an opt-in option to use @typescript-eslint/parser
  • Having rule samples that use a TypeScript language enable that option

Participation

  • I am willing to submit a pull request for this change.

Additional comments

No response

Activity

nzakas

nzakas commented on Mar 17, 2025

@nzakas
Member

This seems like a good idea. We'd probably want that option under "Versioning and Config". Would we need any other options for TypeScript parsing?

moved this from Needs Triage to Triaging in Triageon Mar 17, 2025
JoshuaKGoldberg

JoshuaKGoldberg commented on Mar 17, 2025

@JoshuaKGoldberg
ContributorAuthor

TypeScript would need to know:

  • Is it in "jsx" mode or not, for parsing syntax like <div> that might be an assertion or a JSX element
  • Whether the source type is a script or module

Both of those are already in "Versioning and Config".

nzakas

nzakas commented on Mar 17, 2025

@nzakas
Member

Awesome, thanks for the clarification.

moved this from Triaging to Ready to Implement in Triageon Mar 17, 2025
Tanujkanti4441

Tanujkanti4441 commented on Mar 18, 2025

@Tanujkanti4441
Contributor

I'll take this.

moved this from Ready to Implement to Implementing in Triageon May 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

Status

Implementing

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @nzakas@JoshuaKGoldberg@Tanujkanti4441

    Issue actions

      Suggestion: Support TypeScript syntax in playground · Issue #709 · eslint/eslint.org