Environment
- Operating System: Linux
- Node Version: v22.13.0
- Nuxt Version: 3.15.4
- CLI Version: 3.21.1
- Nitro Version: 2.10.4
- Package Manager: pnpm@10.2.0
- Builder: -
- User Config: compatibilityDate, devtools, modules
- Runtime Modules: @nuxt/eslint@1.0.0
- Build Modules: -
Package
@nuxt/eslint
Reproduction
repo: https://github.com/sushichan044/nuxt-eslint-type-broken-pnpm-v10
- clone repo
- setup pnpm (>=10) and install deps
- open
eslint.config.mjs
withNuxt and configs are treated as any by TypeScript
Describe the bug
When using pnpm v10 with @nuxt/eslint module, types of exports from .nuxt/eslint.config.mjs is broken and
we cannot get completion when editing eslint.config.js.
This is because pnpm v10 no longer hoists packages that include eslint in the name unless they are explicitly installed.
ref: pnpm/pnpm#8378
Because of this, @nuxt/eslint-config and eslint-flat-config-utils are no longer hoisted,
TypeScript cannot find the type definition, and the types of exports in .nuxt/eslint.config.mjs is treated as any.
Additional context
There are two possible measures to address this.
One is to include @nuxt/eslint-config and eslint-flat-config-utils in the required peer dependencies
so that they are explicitly installed when we run nuxi module add eslint.
(This is because nuxi automatically and explicitly installs required peer dependencies when adding a module.)
The second is to update the documentation and add caution with pnpm v10.
It would be good to do both, and I am willing to do it!
Logs
Environment
Package
@nuxt/eslint
Reproduction
repo: https://github.com/sushichan044/nuxt-eslint-type-broken-pnpm-v10
eslint.config.mjswithNuxtandconfigsare treated as any by TypeScriptDescribe the bug
When using pnpm v10 with
@nuxt/eslintmodule, types of exports from.nuxt/eslint.config.mjsis broken andwe cannot get completion when editing
eslint.config.js.This is because pnpm v10 no longer hoists packages that include
eslintin the name unless they are explicitly installed.ref: pnpm/pnpm#8378
Because of this,
@nuxt/eslint-configandeslint-flat-config-utilsare no longer hoisted,TypeScript cannot find the type definition, and the types of exports in
.nuxt/eslint.config.mjsis treated as any.Additional context
There are two possible measures to address this.
One is to include
@nuxt/eslint-configandeslint-flat-config-utilsin the required peer dependenciesso that they are explicitly installed when we run
nuxi module add eslint.(This is because nuxi automatically and explicitly installs required peer dependencies when adding a module.)
The second is to update the documentation and add caution with pnpm v10.
It would be good to do both, and I am willing to do it!
Logs