Skip to content

fix(typescript-eslint): export plugin, parser, and configs that are compatible with both defineConfig() and tseslint.config() #11475

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

Conversation

kirkwaiblinger
Copy link
Member

@kirkwaiblinger kirkwaiblinger commented Aug 13, 2025

PR Checklist

Overview

Third time's the charm 🙃

I realized that, if we're extremely vague about what the parser, plugin, and configs are, we can easily satisfy both the expected types from defineConfig() and tseslint.config(), without running into the many incompatibilities I experienced during previous attempts. While this sacrifices precision, the exact shapes of those objects aren't actually important at all to users; it's only important that they be usable within their configs. So, I think this is a worthwhile tradeoff.

It's possible that some plugin authors, or downstream consumers that use our tools in some way other than in their lint configuration might experience some type errors as a result of this. Fixing these errors should be quite simple, since one can use type assertions to get the previous (also quite vague) types:

tseslint.parser as FlatConfig.Parser;
tseslint.plugin as FlatConfig.Plugin;
tseslint.configs['foo'] as FlatConfig.Config | FlatConfig.ConfigArray

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @kirkwaiblinger!

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.

Copy link

netlify bot commented Aug 13, 2025

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 6dd9d70
🔍 Latest deploy log https://app.netlify.com/projects/typescript-eslint/deploys/689cd9c9a533a20008e4b326
😎 Deploy Preview https://deploy-preview-11475--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 95 (🟢 up 3 from production)
Accessibility: 97 (no change from production)
Best Practices: 100 (no change from production)
SEO: 92 (no change from production)
PWA: 80 (no change from production)
View the detailed breakdown and full score reports

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

Copy link

nx-cloud bot commented Aug 13, 2025

View your CI Pipeline Execution ↗ for commit 6dd9d70

Command Status Duration Result
nx test tsconfig-utils ✅ Succeeded <1s View ↗
nx run types:build ✅ Succeeded 5s View ↗
nx test typescript-eslint ✅ Succeeded 41s View ↗
nx test utils ✅ Succeeded 9s View ↗
nx test eslint-plugin ✅ Succeeded 5s View ↗

☁️ Nx Cloud last updated this comment at 2025-08-13 18:40:02 UTC

@thernstig
Copy link

Shouldn't this also be updated?

<details>
<summary>Aside on ESLint's `defineConfig()`</summary>
ESLint also provides a `defineConfig()` helper similar to `tseslint.config()`.
However, there is a types incompatibility issue that causes type errors to incorrectly be reported when mixing typescript-eslint's configs and `defineConfig()`.
For now we recommend using `tseslint.config()` for use with typescript-eslint's configs.
See [typescript-eslint#10899](https://github.com/typescript-eslint/typescript-eslint/issues/10899) for more details.
</details>

Along with the example on that same page to start using defineConfig instead?

@kirkwaiblinger
Copy link
Member Author

@thernstig

Shouldn't this also be updated?

<details>
<summary>Aside on ESLint's `defineConfig()`</summary>
ESLint also provides a `defineConfig()` helper similar to `tseslint.config()`.
However, there is a types incompatibility issue that causes type errors to incorrectly be reported when mixing typescript-eslint's configs and `defineConfig()`.
For now we recommend using `tseslint.config()` for use with typescript-eslint's configs.
See [typescript-eslint#10899](https://github.com/typescript-eslint/typescript-eslint/issues/10899) for more details.
</details>

Possibly could... Though in the name of caution it might be worth releasing the types change and waiting a week to make sure it's doesn't end up messing up people's configs too before we take down the notice. Could go either way.

Along with the example on that same page to start using defineConfig instead?

This will for sure not happen as part of this PR, but endorsing defineConfig()is tracked separately as #10935

Copy link
Member

Choose a reason for hiding this comment

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

is test-d.ts run by vitest? TIL

@bradzacher bradzacher merged commit 3426f0d into typescript-eslint:main Aug 16, 2025
114 of 121 checks passed
@kirkwaiblinger kirkwaiblinger deleted the fix-define-config-incompatibility branch August 16, 2025 04:12
@Martinspire
Copy link

If another way of configuring the project is supported, shouldn't the overall readme have a way to do this? I mean, if you want people to start using it, it would be nice to know how it works...

@thernstig
Copy link

If another way of configuring the project is supported, shouldn't the overall readme have a way to do this? I mean, if you want people to start using it, it would be nice to know how it works...

See #10935

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: typescript-eslint config types are incompatible with defineConfig() types
4 participants