Skip to content

fix: run ESLint directly on Next.js 16+ in next_lint tool - #711

Closed
szupzj18 wants to merge 1 commit into
peteromallet:mainfrom
szupzj18:chris/fix/next16-lint-command
Closed

fix: run ESLint directly on Next.js 16+ in next_lint tool#711
szupzj18 wants to merge 1 commit into
peteromallet:mainfrom
szupzj18:chris/fix/next16-lint-command

Conversation

@szupzj18

Copy link
Copy Markdown

Problem

Fixes #709

Next.js 16 removed the next lint subcommand. The hardcoded npx --no-install next lint --format json in NEXTJS_SPEC is now parsed as next <dir> and exits without linting:

Invalid project directory provided, no such directory: /path/to/project/lint

The tool phase records reduced coverage (parser_error) and reports zero lint issues, so a Next 16 codebase reads as lint-clean.

Fix

  • next_lint_cmd(scan_root) resolves the command from the installed Next.js major (node_modules/next/package.json, not the declared range — ^15.0.0 can resolve to 16). On >= 16 it runs npx --no-install eslint --format json . directly; ESLint's JSON output has the same shape the next_lint parser already consumes.
  • ToolIntegration.cmd now accepts str | Callable[[Path], str]; _framework_tool_phase resolves it per scan root.
  • Falls back to next lint when Next is not installed, the version is unreadable, or the major is < 16.

Tests

  • next_lint_cmd: Next 16 → ESLint command; Next 15 → next lint; missing install → fallback; malformed package.json → fallback.
  • Tool-phase integration: a project with installed next@16 executes the ESLint command (verified RED with the old static command — argv contained lint); next@15 still executes next lint.
  • desloppify/tests/detectors + tests/scan: 974 passed. Full suite: only the pre-existing test_bash_unused_source_directive_is_flagged failure (fails on main without this change too).

Checklist

  • Tests added (RED before fix, GREEN after)
  • Existing tests pass
  • Syntax lint clean (ruff --select E9,F63,F7,F82 scope)

Next.js 16 removed the `next lint` subcommand, so the hardcoded
`npx --no-install next lint --format json` invocation is parsed as
`next <dir>` and exits without linting. The scan then records reduced
coverage (parser_error) and reports zero lint issues, making a Next 16
codebase read as lint-clean.

Resolve the command from the installed Next.js major (node_modules/next,
not the declared range) and run ESLint directly on >=16; its JSON output
has the same shape the next_lint parser expects. ToolIntegration.cmd now
accepts a callable resolved per scan root.

Fixes peteromallet#709
@szupzj18
szupzj18 force-pushed the chris/fix/next16-lint-command branch from 82ea2fd to 2077e2f Compare August 21, 2026 05:31
@szupzj18

Copy link
Copy Markdown
Author

Closing for now — the repo appears unmaintained (no merges since 2026-03, no response on these PRs). The fixes remain valid against the linked issues; happy to reopen if maintainer activity resumes.

@szupzj18 szupzj18 closed this Aug 27, 2026
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.

next_lint detector silently reports zero issues on Next.js 16 (next lint was removed)

1 participant