-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Merged
bradzacher
merged 2 commits into
typescript-eslint:main
from
kirkwaiblinger:fix-define-config-incompatibility
Aug 16, 2025
+134
−22
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| /* | ||
| * This file contains types that are intentionally wide/inaccurate, that exist | ||
| * for the purpose of satisfying both `defineConfig()` and `tseslint.config()`. | ||
| * See https://github.com/typescript-eslint/typescript-eslint/issues/10899 | ||
| */ | ||
|
|
||
| export interface CompatibleParser { | ||
| parseForESLint(text: string): { | ||
| ast: unknown; | ||
| scopeManager: unknown; | ||
| }; | ||
| } | ||
|
|
||
| export interface CompatibleConfig { | ||
| name?: string; | ||
| rules?: object; | ||
| } | ||
|
|
||
| export type CompatibleConfigArray = CompatibleConfig[]; | ||
|
|
||
| export interface CompatiblePlugin { | ||
| meta: { | ||
| name: string; | ||
| }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
packages/typescript-eslint/tests/type-compatibility.test-d.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| import { defineConfig } from 'eslint/config'; | ||
|
|
||
| import tseslint from '../src/index'; | ||
|
|
||
| describe('test for compatibility with config helpers', () => { | ||
| test('exported plugin is compatible with tseslint.config()', () => { | ||
| tseslint.config({ | ||
| plugins: { | ||
| '@typescript-eslint': tseslint.plugin, | ||
| }, | ||
| }); | ||
| }); | ||
|
|
||
| test('exported plugin is compatible with defineConfig()', () => { | ||
| defineConfig({ | ||
| plugins: { | ||
| '@typescript-eslint': tseslint.plugin, | ||
| }, | ||
| }); | ||
| }); | ||
|
|
||
| test('exported parser is compatible with tseslint.config()', () => { | ||
| tseslint.config({ | ||
| languageOptions: { | ||
| parser: tseslint.parser, | ||
| }, | ||
| }); | ||
| }); | ||
|
|
||
| test('exported parser is compatible with defineConfig()', () => { | ||
| defineConfig({ | ||
| languageOptions: { | ||
| parser: tseslint.parser, | ||
| }, | ||
| }); | ||
| }); | ||
|
|
||
| test('exported configs are compatible with tseslint.config()', () => { | ||
| tseslint.config(tseslint.configs.recommendedTypeChecked); | ||
| tseslint.config(tseslint.configs.strict); | ||
| tseslint.config(tseslint.configs.eslintRecommended); | ||
| }); | ||
|
|
||
| test('exported configs are compatible with defineConfig()', () => { | ||
| defineConfig(tseslint.configs.recommendedTypeChecked); | ||
| defineConfig(tseslint.configs.strict); | ||
| defineConfig(tseslint.configs.eslintRecommended); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is
test-d.tsrun by vitest? TIL