Skip to content

ESLint plugin conflict when setting up a new Nx workspace with @nx/nuxt and FlatConfig #31326

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 of 4 tasks
vorapongsan opened this issue May 24, 2025 · 1 comment
Open
1 of 4 tasks
Assignees
Labels
priority: medium Medium Priority (not high, not low priority) scope: vue type: bug

Comments

@vorapongsan
Copy link

Current Behavior

When running any command in the Nx workspace after setting up Nuxt with @nx/nuxt, an error occurs related to the ESLint plugin configuration.

import { FlatCompat } from '@eslint/eslintrc';
import { dirname } from 'path';
import { fileURLToPath } from 'url';
import js from '@eslint/js';
import baseConfig from '../../eslint.config.mjs';
const compat = new FlatCompat({
  baseDirectory: dirname(fileURLToPath(import.meta.url)),
  recommendedConfig: js.configs.recommended,
});

export default [
  ...baseConfig,
  {
    files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx', '**/*.vue'],
    // Override or add rules here
    rules: {},
  },
  ...compat.extends('@nuxt/eslint-config'),
  {
    files: ['**/*.vue'],
    languageOptions: {
      parserOptions: {
        parser: await import('@typescript-eslint/parser'),
      },
    },
  },
  {
    ignores: ['.nuxt/**', '.output/**', 'node_modules'],
  },
];

Specifically, the @nx/eslint/plugin fails when processing the ESLint config that uses @nuxt/eslint-config with FlatConfig.

NX   Failed to process project graph.

An error occurred while processing files for the @nx/eslint/plugin plugin (Defined at nx.json#plugins[1])
.
  - apps/nuxt-app/eslint.config.mjs: Failed to load plugin '@typescript-eslint' declared in ' » @nuxt/eslint-config': Cannot find module '@typescript-eslint/eslint-plugin'
Require stack:
- E:\apps\nuxt-test\apps\nuxt-app\__placeholder__.js
Referenced from: E:\apps\nuxt-test\node_modules\@nuxt\eslint-config\dist\legacy.cjs

This appears to be due to how @nx/eslint/plugin loads and interprets FlatConfig-based ESLint setups that use Nuxt presets.

Expected Behavior

The Nx workspace should successfully process the ESLint configuration when setting up a new Nx workspace

  • Running any Nx commands (e.g., nx graph, nx lint , nx run-many) should not fail due to ESLint config parsing.

GitHub Repo

No response

Steps to Reproduce

  1. Create a new Nx workspace with @nx/nuxt with enable eslint
  2. Run any Nx command (e.g. nx graph, nx build nuxt-app)
  3. Observe the error

Nx Report

NX   Report complete - copy this into the issue template

Node           : 22.16.0
OS             : win32-x64
Native Target  : x86_64-windows
yarn           : 4.9.1

nx                 : 21.1.2
@nx/js             : 21.1.2
@nx/eslint         : 21.1.2
@nx/workspace      : 21.1.2
@nx/cypress        : 21.1.2
@nx/devkit         : 21.1.2
@nx/eslint-plugin  : 21.1.2
@nx/nuxt           : 21.1.2
@nx/vite           : 21.1.2
@nx/vue            : 21.1.2
@nx/web            : 21.1.2
typescript         : 5.7.3
---------------------------------------
Registered Plugins:
@nx/js/typescript
@nx/eslint/plugin
@nx/vite/plugin
@nx/nuxt/plugin
@nx/cypress/plugin
---------------------------------------
Cache Usage: 4.04 MB / 25.60 GB
---------------------------------------

Failure Logs

NX   Failed to process project graph.

An error occurred while processing files for the @nx/eslint/plugin plugin (Defined at nx.json#plugins[1])
.
  - apps/nuxt-app/eslint.config.mjs: Failed to load plugin '@typescript-eslint' declared in ' » @nuxt/eslint-config': Cannot find module '@typescript-eslint/eslint-plugin'
Require stack:
- E:\apps\nuxt-test\apps\nuxt-app\__placeholder__.js
Referenced from: E:\apps\nuxt-test\node_modules\@nuxt\eslint-config\dist\legacy.cjs

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

From my investigation, the issue maybe from @nuxt/eslint-config package. According to Nuxt documentation, @nuxtjs/eslint-config is for legacy setup in eslint, while @nuxt/eslint-config (current package version) use for exports a helper function to generate the configuration:

https://eslint.nuxt.com/packages/config

import { createConfigForNuxt } from '@nuxt/eslint-config'

export default createConfigForNuxt({
  // options here
})

From Starter Template, In Nuxt's ESLint config using:

...compat.extends('@nuxt/eslint-config')

After commenting out that line, ESLint started working correctly again in the Nx workspace

@Stanzilla
Copy link
Contributor

The whole ESLint story is sadly pretty outdated/busted in NX, I would advise you to ignore it for now and create everything manually

@FrozenPandaz FrozenPandaz added the priority: medium Medium Priority (not high, not low priority) label Jun 2, 2025
@FrozenPandaz FrozenPandaz assigned leosvelperez and unassigned Coly010 Jun 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: medium Medium Priority (not high, not low priority) scope: vue type: bug
Projects
None yet
Development

No branches or pull requests

5 participants