Skip to content

Types of exports in .nuxt/eslint.config.mjs is broken with pnpm v10 #539

@sushichan044

Description

@sushichan044

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

  1. clone repo
  2. setup pnpm (>=10) and install deps
  3. open eslint.config.mjs
  4. 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions