Skip to content

Bug: Type checking of eslint.config.mjs fails with the new eslint/config defineConfig with @ts-check #11017

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

Closed
4 tasks done
segevfiner opened this issue Mar 31, 2025 · 1 comment
Labels
bug Something isn't working duplicate This issue or pull request already exists locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.

Comments

@segevfiner
Copy link

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have searched for related issues and found none that matched my issue.
  • I have read the FAQ and my problem is not listed.

Issue Description

You get an error on a vanilla ESLint config generated by the latest @eslint/create-config package if you add // @ts-check to the file.

[{
	"resource": "/Users/segevfiner/junk/typescript-eslint-define-config-issue/eslint.config.mjs",
	"owner": "typescript",
	"code": "2322",
	"severity": 8,
	"message": "Type 'ConfigArray' is not assignable to type 'InfiniteArray<ConfigWithExtends>'.\n  Type 'Config[]' is not assignable to type 'InfiniteArray<ConfigWithExtends>[]'.\n    Type 'Config' is not assignable to type 'InfiniteArray<ConfigWithExtends>'.\n      Type 'Config' is not assignable to type 'ConfigWithExtends'.\n        Types of property 'languageOptions' are incompatible.\n          Type 'import(\"/Users/segevfiner/junk/typescript-eslint-define-config-issue/node_modules/@typescript-eslint/utils/dist/ts-eslint/Config\").FlatConfig.LanguageOptions | undefined' is not assignable to type 'import(\"/Users/segevfiner/junk/typescript-eslint-define-config-issue/node_modules/eslint/lib/types/index\").Linter.LanguageOptions | undefined'.\n            Type 'import(\"/Users/segevfiner/junk/typescript-eslint-define-config-issue/node_modules/@typescript-eslint/utils/dist/ts-eslint/Config\").FlatConfig.LanguageOptions' is not assignable to type 'import(\"/Users/segevfiner/junk/typescript-eslint-define-config-issue/node_modules/eslint/lib/types/index\").Linter.LanguageOptions'.\n              Types of property 'parser' are incompatible.\n                Type 'LooseParserModule | undefined' is not assignable to type 'Parser | undefined'.\n                  Type '{ meta?: { name?: string | undefined; version?: string | undefined; } | undefined; parseForESLint(text: string, options?: unknown): { ast: unknown; scopeManager?: unknown; services?: unknown; visitorKeys?: unknown; }; }' is not assignable to type 'Parser | undefined'.\n                    Type '{ meta?: { name?: string | undefined; version?: string | undefined; } | undefined; parseForESLint(text: string, options?: unknown): { ast: unknown; scopeManager?: unknown; services?: unknown; visitorKeys?: unknown; }; }' is not assignable to type 'Omit<ESTreeParser, \"parseForESLint\"> & { parseForESLint(text: string, options?: any): Omit<ESLintParseResult, \"ast\" | \"scopeManager\"> & { ...; }; }'.\n                      Type '{ meta?: { name?: string | undefined; version?: string | undefined; } | undefined; parseForESLint(text: string, options?: unknown): { ast: unknown; scopeManager?: unknown; services?: unknown; visitorKeys?: unknown; }; }' is not assignable to type '{ parseForESLint(text: string, options?: any): Omit<ESLintParseResult, \"ast\" | \"scopeManager\"> & { ast: unknown; scopeManager?: unknown; }; }'.\n                        The types returned by 'parseForESLint(...)' are incompatible between these types.\n                          Type '{ ast: unknown; scopeManager?: unknown; services?: unknown; visitorKeys?: unknown; }' is not assignable to type 'Omit<ESLintParseResult, \"ast\" | \"scopeManager\"> & { ast: unknown; scopeManager?: unknown; }'.\n                            Type '{ ast: unknown; scopeManager?: unknown; services?: unknown; visitorKeys?: unknown; }' is not assignable to type 'Omit<ESLintParseResult, \"ast\" | \"scopeManager\">'.\n                              Types of property 'visitorKeys' are incompatible.\n                                Type 'unknown' is not assignable to type 'VisitorKeys | undefined'.",
	"source": "ts",
	"startLineNumber": 12,
	"startColumn": 3,
	"endLineNumber": 12,
	"endColumn": 31
}]

#10935 (comment)
#10935 (comment)
cc @JoshuaKGoldberg

Reproduction Repository Link

https://github.com/segevfiner/typescript-eslint-define-config-issue

Repro Steps

  1. Clone the repo
  2. npm install
  3. npx tsc

Versions

package version
@typescript-eslint/eslint-plugin 8.29.0
@typescript-eslint/parser 8.29.0
@typescript-eslint/utils 8.29.0
TypeScript 5.8.2
ESLint 9.23.0
node 22.14.0
@segevfiner segevfiner added bug Something isn't working triage Waiting for team members to take a look labels Mar 31, 2025
@bradzacher
Copy link
Member

duplicate of #10899

@bradzacher bradzacher added duplicate This issue or pull request already exists and removed triage Waiting for team members to take a look labels Mar 31, 2025
@github-actions github-actions bot added the locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing. label Apr 8, 2025
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 8, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working duplicate This issue or pull request already exists locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.
Projects
None yet
Development

No branches or pull requests

2 participants