class

Analyzer::Javascript::ReactRouter

Inherits Analyzer::Javascript::Remix < Analyzer::Javascript::JavascriptEngine < Analyzer < FileHelper < Reference < Object

React Router v7 framework mode — the Remix successor. Route modules are Remix's (loader / action exports, a default-exported page), so this rides the Remix analyzer; what differs is where routes come from.

app/routes.ts declares them:

index("routes/home.tsx") → GET / route("users/:id", "routes/user.tsx") → /users/{id}, verbs from the module ...(await flatRoutes()) → the Remix app/routes/ convention

The file convention therefore applies only where the config spreads flatRoutes() in. A config that reads as nothing we recognise, or a scan with no config at all, falls back to it rather than report nothing.

Out of scope: flatRoutes({ rootDirectory }) and a non-default appDirectory for the file convention (config routes resolve against whatever directory holds routes.ts, so those are covered), and route arrays imported from another file, which are not followed — a split-out routes.ts is still read on its own, without the importer's prefix.

Constants

AUTO_FOLDER_MODULES = Set {"index", "_index", "route", "_layout"}

Index and layout modules sit at their folder's URL; route is the legacy name for the index.

AUTO_ROUTES_RE = /\bautoRoutes\s*\(/
CONFIG_BASENAMES = ["react-router.config.ts", "react-router.config.js", "react-router.config.mjs", "react-router.config.cjs"]
PACKAGE_MARKERS = ["@react-router/dev"]

Class methods

tech_name
Source

Instance methods

analyze
Source
tech

Instance-side view of the same declaration. The per-file rescues live on this base class, which has no way to name the analyzer that is running inside them, so a skipped file could not be attributed to a tech. Deriving it from analyzer_for keeps the name written exactly once.

Source