Description
Overview
A handful of folks have mentioned that after upgrading to v6, trying to import
from @typescript-eslint/*
packages such as @typescript-eslint/utils
causes a new TypeScript type error:
import { ESLintUtils } from '@typescript-eslint/utils';
Cannot find module '@typescript-eslint/utils' or its corresponding type declarations.
This is not a bug. We intentionally dropped support in v6 for Node <16 as those versions of node are EOL. v6 uses package.json exports - which requires Node 16+ and isn't supported by that older module resolution strategy.
To fix the issue, switch your TSConfig's module resolution to a newer version, most likely "bundler"
, "node16"
, or "nodenext"
. See the aka.ms/tsconfig "moduleResolution"
docs for more information.
{
"compilerOptions": {
"moduleResolution": "bundler"
}
}
See TypeScript's new modules reference docs for more information.
Issues that are duplicates of this one:
- Bug: @typescript-eslint/parser - missing types #7279
- Bug: eslint-plugin@6.0.0/index.d.ts contains TS errors #7213 (comment)
- @typescript-eslint/utils imports no longer detect types in moduleResolution: node(10) in 6.0.0 #7185
https://arethetypeswrong.github.io/?p=%40typescript-eslint%2Futils%406.0.0 also shows a nice table of which moduleResolution
values we support. It's all of them except node10
.
Keeping this issue open so it shows up more in searches.