Skip to content

nextjs

Next.js apps: the framework and hooks rules, and server code that never reaches the client. An ESLint rule refuses ignoreBuildErrors and ignoreDuringBuilds in next.config. It requires typescript, react, react-dom. Guide: Next.js.

A scope has a dependency on next.

Has Next.js write its types, then type-checks the app with the strict compiler options.

Runs at the push stage, once per scope, and loads your code.

A fresh clone holds no next-env.d.ts and no route types, so a plain tsc run fails on imports the framework resolves.

Fix the first error tsc prints; later errors often come from the same mistake.

const count: number = "one"; reports an incompatible assignment. Assign a number, such as const count: number = 1;.

gspot ignore nextjs/tsc --paths "<path>" --reason "<why>"
gspot ignore nextjs/tsc --rule <rule> --reason "<why>"

To silence one place, write a comment such as:

// @ts-expect-error reason: the library types omit this overload
Lint rules Files Why
import-x/no-default-export **/app/**/{page,layout,default,template,loading,error,global-error,not-found,sitemap,robots,manifest,icon,apple-icon,opengraph-image,twitter-image}.*, **/pages/**/*.{js,jsx,ts,tsx}, **/{middleware,proxy}.{js,ts} Next.js reads the default export of its route, metadata, middleware, and proxy files.
Rule file Installed when
.gspot/rules/NEXTJS.md Always
Tool Version
next 15.5.0 or later, install it yourself
@next/eslint-plugin-next 16.4.2