Skip to content

nextjs/no-page-custom-font Correctness

This rule is turned on by default.

What it does

Prevent page-only custom fonts.

Why is this bad?

  • The custom font you're adding was added to a page - this only adds the font to the specific page and not the entire application.
  • The custom font you're adding was added to a separate component within pages/_document.js - this disables automatic font optimization.

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-page-custom-font --nextjs-plugin
json
{
  "plugins": ["nextjs"],
  "rules": {
    "nextjs/no-page-custom-font": "error"
  }
}

References

Released under the MIT License.