Skip to content

feat: support loading TS config files using --experimental-strip-types #19401

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

Merged
merged 44 commits into from
Apr 2, 2025

Conversation

aryaemami59
Copy link
Contributor

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
[ ] Add something to the core
[X] Other, please explain:

Resolves #19357.

What changes did you make? (Give an overview)

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

@eslint-github-bot
Copy link

Hi @aryaemami59!, thanks for the Pull Request

The pull request title isn't properly formatted. We ask that you update the pull request title to match this format, as we use it to generate changelogs and automate releases.

  • The length of the commit message must be less than or equal to 72

To Fix: You can fix this problem by clicking 'Edit' next to the pull request title at the top of this page.

Read more about contributing to ESLint here

@github-actions github-actions bot added cli Relates to ESLint's command-line interface core Relates to ESLint's core APIs and features github actions labels Feb 3, 2025
Copy link

netlify bot commented Feb 3, 2025

Deploy Preview for docs-eslint canceled.

Name Link
🔨 Latest commit 46b0b6b
🔍 Latest deploy log https://app.netlify.com/sites/docs-eslint/deploys/67ed11a305e0ab00089722fd

@aryaemami59 aryaemami59 changed the title feat: support loading TypeScript config files using --experimental-strip-types feat: support loading TS config files using --experimental-strip-types Feb 3, 2025
@eslint-github-bot eslint-github-bot bot added the feature This change adds a new feature to ESLint label Feb 3, 2025
@aryaemami59 aryaemami59 force-pushed the feat/native-ts-config-files branch 4 times, most recently from b849290 to 65ab10d Compare February 7, 2025 10:24
@aryaemami59 aryaemami59 force-pushed the feat/native-ts-config-files branch 3 times, most recently from 0cc9a68 to 7ce314d Compare February 8, 2025 10:10
@aryaemami59 aryaemami59 force-pushed the feat/native-ts-config-files branch 3 times, most recently from 32aa8da to 28f82e0 Compare February 14, 2025 11:59
Copy link

Hi everyone, it looks like we lost track of this pull request. Please review and see what the next steps are. This pull request will auto-close in 7 days without an update.

@github-actions github-actions bot added the Stale label Feb 24, 2025
@aryaemami59 aryaemami59 force-pushed the feat/native-ts-config-files branch from 28f82e0 to d8710bb Compare February 26, 2025 22:05
@github-actions github-actions bot removed the Stale label Feb 26, 2025
@aryaemami59
Copy link
Contributor Author

I apologize for neglecting this important PR, I will finish it soon. In the meantime I could use some ideas on writing unit-tests.

Copy link
Member

@fasttime fasttime left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this pull request! I left some comments.

@fasttime
Copy link
Member

fasttime commented Mar 1, 2025

In the meantime I could use some ideas on writing unit-tests.

For unit testing probably we will want to check if the current instance of Node.js supports type stripping and only then run the new tests.

describe("TypeScript config files with type stripping", () => {

    if (process.features.typescript !== "strip") {
        return;
    }

    // Unit tests here...

});

Our CI workflow runs unit tests in different versions of Node.js, including Node.js 23.x which has type stripping enabled by default, and the new tests would only run in that versions.

To test with type transformation enabled, we could start by doing something similar, but since no version of Node.js supports type transformation out of the box at the moment, we will have to wait until Node.js 24 is released. Or we could force type transformation support by launching a CI test with Node.js 22.x and the --experimental-transform-types flag set. That could be done by extending our test matrix with a new variable to control if the --experimental-transform-types should be set.

      matrix:
        os: [ubuntu-latest]
        node: [23.x, 22.x, 21.x, 20.x, 18.x, "18.18.0"]
        include:
          - os: windows-latest
            node: "lts/*"
          - os: macOS-latest
            node: "lts/*"
+         - os: ubuntu-latest
+           node: 22.x
+           experimental_transform_types: true

We would then conditionally set the --experimental-transform-types flag in the node command line depending on that value.

@aryaemami59 aryaemami59 force-pushed the feat/native-ts-config-files branch 4 times, most recently from e7ca23d to 849e7d4 Compare March 4, 2025 12:17
@aryaemami59 aryaemami59 force-pushed the feat/native-ts-config-files branch from fcfd834 to f44bd29 Compare April 2, 2025 08:54
Copy link
Member

@fasttime fasttime left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes in 23cf96f go beyond the scope of the issue and some of them would likely need additional discussion. What do you think about reverting lib/cli-engine/cli-engine.js to the version in the main branch, and resubmitting those changes in a new pull request?

Copy link
Member

@fasttime fasttime left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the work!

@fasttime fasttime merged commit 556c25b into eslint:main Apr 2, 2025
30 checks passed
@github-project-automation github-project-automation bot moved this from Second Review Needed to Complete in Triage Apr 2, 2025
@aryaemami59 aryaemami59 deleted the feat/native-ts-config-files branch April 2, 2025 10:41
nwidynski added a commit to nwidynski/eslint that referenced this pull request Apr 2, 2025
fasttime pushed a commit that referenced this pull request Apr 3, 2025
fix: update documentation for --experimental-strip-types

#19401 (comment)
Robot-Inventor added a commit to Robot-Inventor/eslint-config that referenced this pull request Apr 6, 2025
Removed jiti since ESLint can now read TypeScript config files without jiti.

Ref: eslint/eslint#19401
Robot-Inventor added a commit to Robot-Inventor/eslint-config that referenced this pull request Apr 6, 2025
Removed jiti since ESLint can now read TypeScript config files without jiti.

Ref: eslint/eslint#19401
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion cli Relates to ESLint's command-line interface contributor pool core Relates to ESLint's core APIs and features feature This change adds a new feature to ESLint github actions
Projects
Status: Complete
Development

Successfully merging this pull request may close these issues.

Change Request: Use native Node.js TypeScript loading for eslint.config.ts?
5 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy