-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Bug: typescript-eslint config types are incompatible with defineConfig()
types
#10899
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
Comments
I just ran into the same problem trying to enable |
👍 Minimum reproduction here: https://github.com/JoshuaKGoldberg/repros/tree/eslint-defineconfig-with-typescript-eslint import { defineConfig } from "eslint/config";
import tseslint from "typescript-eslint";
export default defineConfig(tseslint.configs.recommended); |
Noting for reference that when this gets worked on, we can also switch ourselves internally to |
defineConfig()
types
All right, so the trouble here seems to be that the configs that we export are of our own typescript-eslint/packages/eslint-plugin/raw-plugin.d.ts Lines 5 to 25 in 69e2f6c
... which is (intentionally) loose, e.g. typescript-eslint/packages/utils/src/ts-eslint/Parser.ts Lines 19 to 52 in 6250dab
... in ways that unfortunately are incompatible with eslint's So, our options look roughly like:
Thoughts? @typescript-eslint/triage-team , especially @bradzacher |
So the reason that the types we use for the config function are loose is because we want to be more permissive in what the types allow. So for example we have strict types for Why do we do this? Well we don't want some 3rd party package to release with bad types and have that cause issues for users. The package's types might be poorly written, or they might be out of date, or they might be written for a newer version of ESLint than the user uses, or they might not even have types (so you're at the mercy of what TS infers from the JS code). Either way we don't want that cruft to impact a user's config typechecking -- so we just define types that describe generalties like "a parser must have a However we definitely shouldn't be using these loose types for our exported configs -- the loose types should only be used for the |
Before You File a Proposal Please Confirm You Have Done The Following...
Description
I just installed eslint with typescript-eslint (
npm init @eslint/config@latest
) - I haven't done anything yet - right away I get this error.Impacted Configurations
Additional Info
I am using vscode with:
https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint @ latest
https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode @ latest
I have read that the problem is with the eslint types (#10872) but maybe you will find another way to fix this - so I leave this bug here :P
The text was updated successfully, but these errors were encountered: