eslint-plugin-next-pages-router
An ESLint plugin that catches invalid Pages Router routes before they reach the browser.
2026·Open source tool·live
The plugin began with a routing mistake in a real Next.js project.
The bug came from comparing the wrong Pages Router value. The difference between route, pathname, and asPath had stayed invisible until QA surfaced a mismatch in one of the navigation flows.
Instead of adding another convention for the team to remember, I turned the distinction into an ESLint rule.
The first version checked route comparisons and navigation calls against the actual pages/ tree. Version 1.1 extended the same model to next/link, static next.config.mjs files, faster dynamic-route lookup, and more reliable cache invalidation.
In a real-project benchmark, the mixed rules averaged 2.26 ms of overhead across 80 files and a 48-route Pages Router tree.
- Role: Creator and maintainer
- The rules validate route comparisons and navigation calls against the project’s actual `pages/` tree.
- A real-project benchmark averaged 2.26 ms across 80 files and 48 routes.
- Good tooling shortens the distance between a mistake and its correction.
- Static checks are most helpful when they understand the shape of the project.
- eslint
- next.js
- routing