Skip to content

fix(module): resolve the ESLint class from the main entry in checker - #713

Open
mansurkhoja wants to merge 1 commit into
nuxt:mainfrom
mansurkhoja:fix/checker-eslint-entry
Open

fix(module): resolve the ESLint class from the main entry in checker#713
mansurkhoja wants to merge 1 commit into
nuxt:mainfrom
mansurkhoja:fix/checker-eslint-entry

Conversation

@mansurkhoja

Copy link
Copy Markdown

checker: true throws on ESLint 10 and the dev server never starts linting:

Failed to initialize ESLint. Have you installed and configured correctly? TypeError: ESLintClass is not a constructor

For flat config the checker defaults eslintPath to eslint/use-at-your-own-risk, but ESLint 10 removed the class exports from that entry:

await import('eslint/use-at-your-own-risk')
// ESLint 9.39.5:  { builtinRules, FlatESLint, LegacyESLint, shouldUseFlatConfig, FileEnumerator }
// ESLint 10.8.1: { builtinRules, shouldUseFlatConfig }

vite-plugin-eslint2 looks for loadESLint / ESLint / FlatESLint / LegacyESLint on that module, finds none of them and ends up calling new undefined().

The main eslint entry exports ESLint and loadESLint(), and has been flat-config aware since v9 — the lowest version in the peer range (^9.0.0 || ^10.0.0). So the dedicated entry is no longer needed for either config type, and the branch can go away entirely.

Checked with eslint 10.8.1, nuxt 4.5.2, vite 8.2.1, vite-plugin-eslint2 5.3.0: the checker lints on start and on save again. Same result as the eslintPath: 'eslint' workaround @sebbayer found in #657.

Closes #657

@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9354bdc2-d5ee-4e2e-b0d9-c9aa425bddd3

📥 Commits

Reviewing files that changed from the base of the PR and between 07aebbc and 5d32369.

📒 Files selected for processing (1)
  • packages/module/src/modules/checker.ts

📝 Walkthrough

Walkthrough

The checker now uses the main eslint entry point for all configurations. It no longer selects eslint/use-at-your-own-risk for flat configuration. Explicit eslintPath overrides remain supported. Comments document compatibility with ESLint 9 and ESLint 10.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Mergeability Score: ⚪ Minimal · up to 5d323

This localized change restores checker linting with supported ESLint versions and presents no actionable merge-blocking risk beyond normal checks and review.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: resolving ESLint from the main entry point.
Description check ✅ Passed The description explains the ESLint 10 failure, the root cause, and the implemented fix.
Linked Issues check ✅ Passed The change addresses issue #657 by removing the incompatible ESLint entry and restoring checker initialization with ESLint 10.
Out of Scope Changes check ✅ Passed The changes are limited to ESLint entry-point resolution and align with the linked issue objectives.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failed to initialize ESLint. Have you installed and configured correctly? TypeError: ESLintClass is not a constructor

1 participant