Skip to content

nextjs/no-styled-jsx-in-document Correctness

This rule is turned on by default.

What it does

Prevent usage of styled-jsx in pages/_document.js.

Why is this bad?

Custom CSS like styled-jsx is not allowed in a Custom Document.

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-styled-jsx-in-document --nextjs-plugin
json
{
  "plugins": ["nextjs"],
  "rules": {
    "nextjs/no-styled-jsx-in-document": "error"
  }
}

References

Released under the MIT License.