-
-
Couldn't load subscription status.
- Fork 29
Description
Describe the bug
The TypeScript types for the package fail to resolve if the package uses node10 module resolution instead of the newer node16 module resolution. node10 module resolution is the default and remains widely used.
Reproduction
Install @eslint-react/eslint-plugin in a TypeScript project.
In tsconfig.json:
{
"compilerOptions": {
"module": "esnext",
"moduleResolution": "node",
}
}And in eslint.config.mjs:
// @ts-check
import eslintReact from "@eslint-react/eslint-plugin";Run the type checker and you'll get this error:
eslint.config.mjs(2,12): error TS2307: Cannot find module '@eslint-react/eslint-plugin' or its corresponding type declarations.
There are types at '/Volumes/workplace-ci/BasinUIFrontEnd/src/BasinUIFrontEnd/node_modules/@eslint-react/eslint-plugin/dist/index.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'.
This matches up with what the invaluable AreTheTypesWrong tool reports for node10 ("Resolution failed"): https://arethetypeswrong.github.io/?p=%40eslint-react%2Feslint-plugin%402.2.2
Expected behavior
Types should resolve under both node10 and node16 resolution.
This can be challenging to achieve manually, but I've had good luck passing all AreTheTypesWrong checks by building my packages with tsup or tsdown.
Platform and versions
* @eslint-react/eslint-plugin v2.2.2
* Node.js v22.17.1
Stack trace
Additional context
The use of node10 resolution is mandated by Next.js, so anyone who wants to use this plugin in their Next.js ESLint configuration (and to type check that configuration) is affected.