Skip to content

defineNuxtConfig is missing from the generated globals list for JavaScript files #603

@rockmandash

Description

@rockmandash

Environment

  • Operating System: macOS 15.6
  • Node Version: 24.3.0
  • Nuxt Version: 4.0.3
  • Package Manager: npm
  • @nuxt/eslint Version: 1.8.0

Package

@nuxt/eslint

Reproduction

  1. Create a fresh Nuxt project: npm create nuxt@latest my-app
  2. Add ESLint module: npx nuxi module add eslint
  3. Rename nuxt.config.ts to nuxt.config.js
  4. add eslint . --max-warnings=0 to npm script
  5. Run the eslint script
  6. See the error: 'defineNuxtConfig' is not defined.eslint(no-undef)

Describe the bug

When using @nuxt/eslint module with a JavaScript configuration file (nuxt.config.js), ESLint reports 'defineNuxtConfig' is not defined error due to the no-undef rule. However, the same configuration works fine when using TypeScript (nuxt.config.ts).

Investigation

After examining the generated .nuxt/eslint.config.mjs file, I discovered that defineNuxtConfig is missing from the globals list, while other Nuxt globals are present:

// .nuxt/eslint.config.mjs
{
  name: 'nuxt/import-globals',
  languageOptions: {
    globals: Object.fromEntries([
      "defineAppConfig",
      "__buildAssetsURL",
      // ... many other globals ...
      "defineNuxtPlugin",
      "definePayloadPlugin",
      // defineNuxtConfig is MISSING here!
    ].map(i => [i, 'readonly'])),
  },
}

Additional context

No response

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