-
Notifications
You must be signed in to change notification settings - Fork 77
Description
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: [email protected]
- Builder: -
- User Config: compatibilityDate, devtools, modules
- Runtime Modules: @nuxt/[email protected]
- 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 withNuxtandconfigsare 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!