Skip to content

nextjs/no-document-import-in-page Correctness ​

✅ This rule is turned on by default.

What it does ​

Prevent importing next/document outside of pages/_document.js.

Why is this bad? ​

Example ​

javascript

How to use ​

To enable this rule in the CLI or using the config file, you can use:

bash
oxlint --deny nextjs/no-document-import-in-page --nextjs-plugin
json
{
  "plugins": ["nextjs"],
  "rules": {
    "nextjs/no-document-import-in-page": "error"
  }
}

References ​

Released under the MIT License.