Next.js
Next.js framework rules from @next/eslint-plugin-next, applied to TypeScript and TSX sources inside Next.js apps. Checks Next.js-specific conventions, pages/app routing, <Head> placement, font and script loading, image and link components. That the frameworkβs runtime treats as load-bearing. Rules that need non-TypeScript files or runtime filesystem route discovery are intentionally conservative.
Source: @next/eslint-plugin-next (MIT).
nextjs/google-font-display: Require a non-blockingdisplay=value on Google Fonts stylesheet links; rejectauto,block, andfallback, which keep text invisible while the font loads and hurt LCP.nextjs/google-font-preconnect: Requirerel="preconnect"forfonts.gstatic.comlinks to shave latency off Google Font fetches.nextjs/inline-script-id: Require anidattribute on inline<Script>components fromnext/script.nextjs/next-script-for-ga: Prefer the Next.js Google Analytics integration over hand-writtengtagscript tags.nextjs/no-assign-module-variable: Reject local declarations namedmodule, which shadow the CommonJSmodulebinding Next.js relies on.nextjs/no-async-client-component: Rejectasyncfunction bodies on React Client Components.nextjs/no-before-interactive-script-outside-document: Restrict thenext/scriptstrategy="beforeInteractive"option topages/_document.tsx, anywhere else, the strategy is downgraded silently.nextjs/no-css-tags: Reject raw<link rel="stylesheet">tags.nextjs/no-document-import-in-page: Restrictnext/documentimports topages/_document.tsx,Documentcannot be used in a regular page.nextjs/no-duplicate-head: Reject more than one<Head>element fromnext/documentinpages/_document.tsx.nextjs/no-head-element: Reject raw<head>elements outside theapp/directory. Usenext/heador the metadata exports.nextjs/no-head-import-in-document: Rejectnext/headimports insidepages/_document.tsx. Usenext/documentβsHeadthere.nextjs/no-html-link-for-pages: Prefernext/linkfor internal anchors with a statichref, sinceLinkperforms client-side routing.nextjs/no-img-element: Prefernext/imageover raw<img>elements so the framework can optimize the asset.nextjs/no-page-custom-font: Reject Google font<link>tags inside regular pages files. Load fonts in_document.tsx(pages router) or vianext/font(app router).nextjs/no-script-component-in-head: Rejectnext/scriptinsidenext/head,<Script>must appear in the JSX tree, not in<Head>.nextjs/no-styled-jsx-in-document: Reject styled-jsx tags insidepages/_document.tsx, which the server renders incorrectly.nextjs/no-sync-scripts: Requireasyncordeferon external raw<script>tags so loading does not block render.nextjs/no-title-in-document-head: Reject<title>insideHeadfromnext/document.nextjs/no-typos: Catch near-miss typos in Next.js data-fetching export names (getStaticProps,getStaticPaths,getServerSideProps).nextjs/no-unwanted-polyfillio: Reject Polyfill.io script URLs, Next.js already polyfills modern browsers, and Polyfill.io has a checkered history.
Last updated on