ESLint plugin to customize restrictions on Next.js imports like next/link and next/image.
npm install eslint-plugin-no-next-restrictedESLint plugin to restrict usage of specific Next.js features.
``bash`
pnpm add -D eslint eslint-plugin-no-next-restricted
Enable the plugin and the recommended config:
`json`
{
"plugins": ["no-next-restricted"],
"extends": ["plugin:no-next-restricted/recommended"]
}
Or configure rules individually:
`json`
{
"plugins": ["no-next-restricted"],
"rules": {
"no-next-restricted/no-next-link": "error",
"no-next-restricted/no-next-image": "error",
"no-next-restricted/no-next-form": "error",
"no-next-restricted/no-next-font": "error",
"no-next-restricted/no-next-script": "error"
}
}
| Rule ID | Purpose | Default | Message example |
| --- | --- | --- | --- |
| no-next-restricted/no-next-link | Disallow next/link | error (recommended) | Do not use next/link. Use instead. |no-next-restricted/no-next-image
| | Disallow next/image | error (recommended) | Do not use next/image. Use instead.
|no-next-restricted/no-next-form
| | Disallow next/form | error (recommended) | Do not use next/form. Use