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.
Selected when
Section titled “Selected when”A scope has a dependency on next.
Checks
Section titled “Checks”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.
What to do
Section titled “What to do”Fix the first error tsc prints; later errors often come from the same mistake.
Example
Section titled “Example”const count: number = "one"; reports an incompatible assignment. Assign a number, such as const count: number = 1;.
Turn it off
Section titled “Turn it off”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 overloadLint rules turned off
Section titled “Lint rules turned off”| 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. |
Rules for coding agents
Section titled “Rules for coding agents”| Rule file | Installed when |
|---|---|
.gspot/rules/NEXTJS.md |
Always |
Tools and versions
Section titled “Tools and versions”| Tool | Version |
|---|---|
| next | 15.5.0 or later, install it yourself |
| @next/eslint-plugin-next | 16.4.2 |