user2297996
user2297996

Reputation: 1574

How to resolve Eslint plugin ambiguity?

I have a eslint config which extends some others. Those packages depend on "@typescript/eslint-plugin" but they use different versions.

  extends: ['airbnb', 'airbnb-typescript', '@some-private-eslint-cfg'],

This results in Eslint being unable to start. It complains about ambiguity, it cannot determine which version to use.

The error:

Oops! Something went wrong! :(

ESLint: 8.19.0

ESLint couldn't determine the plugin "@typescript-eslint" uniquely.

Please remove the "plugins" setting from either config or remove either plugin installation.

However, since I can't edit the configs of those packages I'm extending, I can't remove it from plugins[] and I can't uninstall it.

How to solve this? Ideally, I would like to add something to my top level .eslintrc to handle this. Is this possible?

Upvotes: 0

Views: 2240

Answers (1)

Josh
Josh

Reputation: 3543

This issue happens when there are multiple versions of the plugin in question. ESLint not being able to resolve it "uniquely" means it found multiple (so, not "unique") versions.

This is resolved by upgrading to typescript-eslint@6. See Parsing error: DeprecationError: 'originalKeywordKind' has been deprecated since v5.0.0 and can no longer be used.

If you're seeing this error, it means that somewhere in your installed packages, an unexpected typescript-eslint version is floating around. Try:

  • Bumping versions of all packages that mention ESLint and/or TypeScript to their latest version
  • Clearing your node_modules/ directory and re-installing
  • Clearing whatever lockfile your package manager uses (package-lock.json, pnpm-lock.yaml, yarn.lock, etc.) and re-installing

If all else fails, you can set package.json overrides or an equivalent feature for your package manager of choice - to make sure all typescript-eslint packages mentioned in your lockfile are set to v6. But this really should not be necessary. Most of the time, this issue is from out of date packages.

Upvotes: 0

Related Questions