Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Request: Support .ts files with TypeScript syntax by default #19373

Closed
1 task done
JoshuaKGoldberg opened this issue Jan 27, 2025 · 5 comments
Closed
1 task done
Labels
core Relates to ESLint's core APIs and features enhancement This change enhances an existing feature of ESLint Stale

Comments

@JoshuaKGoldberg
Copy link
Contributor

ESLint version

9.19.0

What problem do you want to solve?

Now that Node.js supports .ts files and type stripping by default (explainer post from Marco), ESLint is the last mainstream tool amongst the common (build, format, lint, test) list for many repositories to not support .ts files by default. It would be very convenient for users if they could lint TypeScript syntax directly.

What do you think is the correct solution?

Proposal:

  • Add .cts, .mts, and .ts to the list of default checked file extensions
  • Support TypeScript syntax in the default parser

This way, folks can get the standard ESLint flow with an eslint.config.* file and no additional configuration.

Participation

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

Additional comments

I think the adding support for .*ts extensions only makes sense if TypeScript syntax is supported out-of-the-box too. An alternative could be to strip out the syntax à la amaro / ts-blank-space - but then I think users would be confused about the lack of linting for that syntax.

Thus, I think this issue is blocked on #19173 (comment):

TSC Summary: This issue proposes starting to make ESLint core rules TypeScript-aware in order to eliminate duplication with typescript-eslint.

TSC Question: Do we want to accept this proposal?

Related:

@JoshuaKGoldberg JoshuaKGoldberg added core Relates to ESLint's core APIs and features enhancement This change enhances an existing feature of ESLint labels Jan 27, 2025
@github-project-automation github-project-automation bot moved this to Needs Triage in Triage Jan 27, 2025
@nzakas
Copy link
Member

nzakas commented Jan 28, 2025

Support TypeScript syntax in the default parser

This is a heavy lift for such a short sentence. 😄 To double-check: do you literally mean the parser understands and produces an AST containing TypScript? Or do you mean we should strip TypeScript-specific syntax and produce an AST as if it were JS?

Add .cts, .mts, and .ts to the list of default checked file extensions

I'm not in favor of this. As we're moving more to a world where languages exist in plugins, I don't think adding more default extensions makes sense.

@nzakas nzakas moved this from Needs Triage to Triaging in Triage Jan 28, 2025
@JoshuaKGoldberg
Copy link
Contributor Author

do you literally mean the parser understands and produces an AST containing TypScript? Or do you mean we should strip TypeScript-specific syntax and produce an AST as if it were JS?

I'd meant to ideate both, but really just defer to whatever is decided for #19173.

@nzakas
Copy link
Member

nzakas commented Jan 28, 2025

I think #19173 is only tangentially related in that it's on the topic of TypeScript but doesn't really have any bearing on what the default parser does.

I'm not sure if it makes sense to have TypeScript support built in to the default parser or if it would be better to a separate package so non-TS folks don't pay the extra cost. (The effort for this is sufficiently large that we should be sure to think deeply about it.)

Copy link

Oops! It looks like we lost track of this issue. What do we want to do here? This issue will auto-close in 7 days without an update.

@github-actions github-actions bot added the Stale label Feb 27, 2025
Copy link

github-actions bot commented Mar 7, 2025

This issue was auto-closed due to inactivity. While we wish we could keep responding to every issue, we unfortunately don't have the bandwidth and need to focus on high-value issues.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 7, 2025
@github-project-automation github-project-automation bot moved this from Triaging to Complete in Triage Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Relates to ESLint's core APIs and features enhancement This change enhances an existing feature of ESLint Stale
Projects
Status: Complete
Development

No branches or pull requests

2 participants