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

feat: support TypeScript config using tsx #18440

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

antfu
Copy link
Contributor

@antfu antfu commented May 10, 2024

Prerequisites checklist

What is the purpose of this pull request? (put an "X" next to an item)

[ ] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofix to a rule
[ ] Add a CLI option
[x] Add something to the core
[ ] Other, please explain:

What changes did you make? (Give an overview)

Support loading eslint.config.ts eslint.config.mts eslint.config.cts files powered by tsx. The support is opt-in by users, where they need to install tsx explicitly (we include it as optional peer deps instead of dependencies)

Based on my previous experiments with eslint-ts-patch(which supports swapping different loaders like jiti tsx bundle-require, feel free to try them out). So for I see that tsx is the best approach as it uses Node's native loader API, support full ESM, top-level await, and does not generate temporary files.

The only downside is that it uses Node's API, which has only been available since v20.8.0 and v18.19.0. But considering this is an opt-in feature, it should be fine, and the ecosystem should catch up soon.

Is there anything you'd like reviewers to focus on?

@antfu antfu requested a review from a team as a code owner May 10, 2024 21:23
@eslint-github-bot eslint-github-bot bot added the feature This change adds a new feature to ESLint label May 10, 2024
@github-actions github-actions bot added cli Relates to ESLint's command-line interface core Relates to ESLint's core APIs and features labels May 10, 2024
Copy link

netlify bot commented May 10, 2024

Deploy Preview for docs-eslint canceled.

Name Link
🔨 Latest commit aa6cdcc
🔍 Latest deploy log https://app.netlify.com/sites/docs-eslint/deploys/663e9a4b72e0a70008240ab6

Co-authored-by: aryaemami59 <aryaemami59@users.noreply.github.com>
@fasttime fasttime added the needs design Important details about this change need to be discussed label May 11, 2024
@nzakas nzakas marked this pull request as draft May 13, 2024 14:39
@nzakas
Copy link
Member

nzakas commented May 13, 2024

Marking as a draft to avoid accidental merging, as there is an RFC being discussed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Relates to ESLint's command-line interface core Relates to ESLint's core APIs and features feature This change adds a new feature to ESLint needs design Important details about this change need to be discussed
Projects
Status: RFC Opened
Development

Successfully merging this pull request may close these issues.

None yet

3 participants