Skip to content

docs: update documentation for --experimental-strip-types #19594

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 1 commit into from
Apr 3, 2025

Conversation

nwidynski
Copy link
Contributor

@nwidynski nwidynski commented Apr 2, 2025

The process.features.typescript flag, which #19401 relies on, was added in Node.js v22.10, meaning there currently is only support for >= v22.10.0. Manually parsing the flag to support v22.6.x - v22.9.x is pretty cumbersome, so I would suggest to document support only starting >= v22.10.0 👍

Prerequisites checklist

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

[x] 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
[ ] Other, please explain:

What changes did you make? (Give an overview)

Adjusted the node version in configuration-files docs to accurately reflect #19401 limitations.

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

@nwidynski nwidynski requested a review from a team as a code owner April 2, 2025 14:22
@github-project-automation github-project-automation bot moved this to Needs Triage in Triage Apr 2, 2025
Copy link

linux-foundation-easycla bot commented Apr 2, 2025

CLA Signed


The committers listed above are authorized under a signed CLA.

@eslint-github-bot eslint-github-bot bot added the bug ESLint is working incorrectly label Apr 2, 2025
Copy link

netlify bot commented Apr 2, 2025

Deploy Preview for docs-eslint ready!

Name Link
🔨 Latest commit 8b5f974
🔍 Latest deploy log https://app.netlify.com/sites/docs-eslint/deploys/67ed4842d3c2910008fbe5e0
😎 Deploy Preview https://deploy-preview-19594--docs-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@nwidynski nwidynski changed the title fix: update documentation for --experimental-strip-types fix: update documentation for --experimental-strip-types Apr 2, 2025
@nzakas
Copy link
Member

nzakas commented Apr 2, 2025

@nwidynski please update the description of this PR to describe the change you actually made.

@snitin315
Copy link
Contributor

@nwidynski What's the error message you got when using this feature with Node v22.6.0

@nwidynski
Copy link
Contributor Author

nwidynski commented Apr 3, 2025

@snitin315 I did not compile ESLint locally to test this feature yet, as it just got merged yesterday and hasn't been released.
I noticed this issue while reviewing the changes made in #19401, but unfortunately was too late to comment before merge.

This line here will always resolve to false in 22.6.x - 22.9.x, since process.features.typescript is undefined:

https://github.com/aryaemami59/eslint/blob/6d979ccc183454e616bc82a598db5402e9d63dcf/lib/config/config-loader.js#L129

This means we will run into the following error, rendering the unstable_native_nodejs_ts_config useless:

https://github.com/aryaemami59/eslint/blob/6d979ccc183454e616bc82a598db5402e9d63dcf/lib/config/config-loader.js#L250-L252

To mitigate, we either need to parse the flag manually ourselves or document support for unstable_native_nodejs_ts_config only starting Node.js >= 22.10.0, which this PR does.

@fasttime fasttime moved this from Needs Triage to Triaging in Triage Apr 3, 2025
@fasttime
Copy link
Member

fasttime commented Apr 3, 2025

The process.features.typescript flag, which #19401 relies on, was added in Node.js v22.10, meaning there currently is only support for >= v22.10.0.

You are correct, process.features.typescript was added in Node.js v22.10 despite --experimental-strip-types being available since Node.js v22.6.

When I try using the unstable_native_nodejs_ts_config flag in Node.js v22.6 I'm getting an error:

$ npx --node-options='--experimental-strip-types' eslint --flag unstable_native_nodejs_ts_config -c tests/fixtures/ts-config-files/ts/eslint.config.ts
(node:71533) ExperimentalWarning: Type Stripping is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
(node:71533) ESLintIgnoreWarning: The ".eslintignore" file is no longer supported. Switch to using the "ignores" property in "eslint.config.js": https://eslint.org/docs/latest/use/configure/migration-guide#ignoring-files

Oops! Something went wrong! :(

ESLint: 9.23.0

Error: The unstable_native_nodejs_ts_config flag is not supported in older versions of Node.js.
    at loadConfigFile (.../eslint/lib/config/config-loader.js:250:11)
    at async ConfigLoader.calculateConfigArray (.../eslint/lib/config/config-loader.js:584:23)
    at async #calculateConfigArray (.../eslint/lib/config/config-loader.js:765:23)
    at async entryFilter (.../eslint/lib/eslint/eslint-helpers.js:287:5)
    at async NodeHfs.<anonymous> (.../eslint/node_modules/@humanfs/core/src/hfs.js:574:24)
    at async NodeHfs.walk (.../eslint/node_modules/@humanfs/core/src/hfs.js:614:3)
    at async globSearch (.../eslint/lib/eslint/eslint-helpers.js:329:20)
    at async Promise.allSettled (index 0)
    at async globMultiSearch (.../eslint/lib/eslint/eslint-helpers.js:420:18)
    at async findFiles (.../eslint/lib/eslint/eslint-helpers.js:591:24)

@fasttime fasttime moved this from Triaging to Evaluating in Triage Apr 3, 2025
@fasttime fasttime added documentation Relates to ESLint's documentation accepted There is consensus among the team that this change meets the criteria for inclusion and removed bug ESLint is working incorrectly labels Apr 3, 2025
@fasttime fasttime changed the title fix: update documentation for --experimental-strip-types docs: update documentation for --experimental-strip-types Apr 3, 2025
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!

@fasttime fasttime merged commit f857820 into eslint:main Apr 3, 2025
32 checks passed
@github-project-automation github-project-automation bot moved this from Evaluating to Complete in Triage Apr 3, 2025
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 documentation Relates to ESLint's documentation
Projects
Status: Complete
Development

Successfully merging this pull request may close these issues.

4 participants