Repository navigation
feat(parser): add onUnsupportedTypeScriptVersion option to error on unsupported TypeScript versions - #12465
Conversation
|
Thanks for the PR, @zaewc! typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community. The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately. Thanks again! 🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint. |
❌ Deploy Preview for typescript-eslint failed.
|
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx run-many --target=build --parallel --exclude... |
❌ Failed | 14s | View ↗ |
💡 Dealing with memory or CPU issues? See memory and CPU details with the resource usage add-on ↗.
☁️ Nx Cloud last updated this comment at 2026-07-14 09:02:05 UTC
|
The In the failing run, the task table shows The other two reported errors cascade from the same stale Locally, after clearing all So a fresh |
JoshuaKGoldberg
left a comment
There was a problem hiding this comment.
A good start, I like the direction & docs! Requesting changes on the throwing behavior. Thanks! ✨
| :::caution Deprecated | ||
| Use [`onUnsupportedTypeScriptVersion`](#onunsupportedtypescriptversion) instead. | ||
| `true` is equivalent to `'warn'` and `false` is equivalent to `'ignore'`. | ||
| If both options are provided, `onUnsupportedTypeScriptVersion` takes precedence. |
There was a problem hiding this comment.
[Feature] Let's throw an error if both are provided. That's an invalid config and we don't want to have to support that. We've had issues in the past where folks expected technically-invalid configs to run and were surprised when they didn't.
There was a problem hiding this comment.
Done 0c44b7c
parseForESLint now throws when both onUnsupportedTypeScriptVersion and the deprecated warnOnUnsupportedTypeScriptVersion are set, instead of silently picking one. Updated the docs and tests to match.
Thanks 💖
|
Re the builds: odd. I merged the latest master in and rebuilt. It builds locally for me just fine. This might be an issue with our Nx setup. Cc @JamesHenry |
… deprecated warnOnUnsupportedTypeScriptVersion are provided
Codecov Report❌ Patch coverage is Please upload reports for the commit 84777db to get more accurate results.
Additional details and impacted files@@ Coverage Diff @@
## main #12465 +/- ##
==========================================
- Coverage 87.06% 86.91% -0.15%
==========================================
Files 515 511 -4
Lines 16643 16450 -193
Branches 5204 5203 -1
==========================================
- Hits 14490 14298 -192
+ Misses 1462 1460 -2
- Partials 691 692 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
Only Removing that override fixed it. happy to revert if it was there for a reason |
JoshuaKGoldberg
left a comment
There was a problem hiding this comment.
LGTM, thanks! ✨
Just a couple of small touchups that we can always apply before merge. Happy to do them tomorrow before the weekly release.
| "copy-ast-spec" | ||
| ], | ||
| "inputs": [ | ||
| "{projectRoot}/src/generated/**/*" |
There was a problem hiding this comment.
This might be correct, but let's just switch it out to a separate change. We as maintainers can verify this PR works on our local builds. Fiddling with the Nx setup can be very finnicky.
| "{projectRoot}/src/generated/**/*" | |
| ], | |
| "inputs": [ | |
| "{projectRoot}/src/generated/**/*" |
Back-linking to where this was also added in an unrelated PR (which reinforces my hesitation): https://github.com/typescript-eslint/typescript-eslint/pull/11355/changes#r2347376398
…st.ts Co-authored-by: Josh Goldberg ✨ <github@joshuakgoldberg.com>
…st.ts Co-authored-by: Josh Goldberg ✨ <github@joshuakgoldberg.com>
Co-authored-by: Josh Goldberg ✨ <github@joshuakgoldberg.com>
This reverts commit c3f4306. Keeping the Nx setup change out of this PR per review; the parser change is verified on local builds.
Co-authored-by: Evyatar Daud <32631382+StyleShit@users.noreply.github.com>
Co-authored-by: Evyatar Daud <32631382+StyleShit@users.noreply.github.com>
There was a problem hiding this comment.
Build failures still don't happen locally for me. 🚢
Thanks for all the iteration & work on this @zaewc!
d8f1044
into
typescript-eslint:main
| projectFolderIgnoreList?: string[]; | ||
| projectService?: boolean | ProjectServiceOptions; | ||
| tsconfigRootDir?: string; | ||
| warnOnUnsupportedTypeScriptVersion?: boolean; |
There was a problem hiding this comment.
Thanks for this new option, I'm about to enable it in my projects.
But I noticed that it's missing in this overview at the top.
…nsupported TypeScript versions (typescript-eslint#12465) * feat(types): add onUnsupportedTypeScriptVersion parser option * feat(typescript-estree): support onUnsupportedTypeScriptVersion behavior * feat(parser): map onUnsupportedTypeScriptVersion and deprecated boolean * test: cover onUnsupportedTypeScriptVersion warn/error/ignore behavior * docs: document onUnsupportedTypeScriptVersion option * fix(parser): suppress no-deprecated for backwards-compat option read * fix(parser): throw error when both onUnsupportedTypeScriptVersion and deprecated warnOnUnsupportedTypeScriptVersion are provided * chore: remove unused inputs * Update packages/typescript-estree/tests/lib/warn-on-unsupported-ts.test.ts Co-authored-by: Josh Goldberg ✨ <github@joshuakgoldberg.com> * Update packages/typescript-estree/tests/lib/warn-on-unsupported-ts.test.ts Co-authored-by: Josh Goldberg ✨ <github@joshuakgoldberg.com> * Update docs/packages/Parser.mdx Co-authored-by: Josh Goldberg ✨ <github@joshuakgoldberg.com> * Revert "chore: remove unused inputs" This reverts commit c3f4306. Keeping the Nx setup change out of this PR per review; the parser change is verified on local builds. * Update docs/packages/Parser.mdx Co-authored-by: Evyatar Daud <32631382+StyleShit@users.noreply.github.com> * Update docs/users/Dependency_Versions.mdx Co-authored-by: Evyatar Daud <32631382+StyleShit@users.noreply.github.com> * fix: standardize severity argument in buildUnsupportedTSVersionMessage function --------- Co-authored-by: Josh Goldberg ✨ <git@joshuakgoldberg.com> Co-authored-by: Evyatar Daud <32631382+StyleShit@users.noreply.github.com> Co-authored-by: Josh Goldberg ✨ <github@joshuakgoldberg.com>

PR Checklist
onUnsupportedTypeScriptVersion=error) #10092Overview
Adds a new
onUnsupportedTypeScriptVersionparser option that controls how the parser reacts when run with a TypeScript version that isn't officially supported. It accepts:'warn'(default) - log the warning to the console (existing behavior)'error'- log the message and throw, so the lint run fails. This is the use case from the issue: catching unsupported TypeScript versions in CI (e.g. a Dependabot/Renovate bump) where warnings go unnoticed and only non-zero exit codes are detected'ignore'- ignoreThe default stays
'warn', so this is a non-breaking, opt-in changenotes
@typescript-eslint/types: addedonUnsupportedTypeScriptVersiontoParserOptionsand markedwarnOnUnsupportedTypeScriptVersionas@deprecated@typescript-eslint/typescript-estree: added the option toTSESTreeOptions, and reworkedwarnAboutTSVersion->handleUnsupportedTSVersionto branch onwarn/error/ignore.'error'throws regardless of TTY/loggerFn, since the CI scenario this targets is non-TTY@typescript-eslint/parser: maps the option through, falling back to the deprecatedwarnOnUnsupportedTypeScriptVersionboolean when the new option isn't set (true->'warn',false->'ignore').onUnsupportedTypeScriptVersiontakes precedence when both are provideddocs & tests
Parser.mdxandDependency_Versions.mdxwarn/error/ignorebehavior and the precedence of the new option over the deprecated boolean