noDocumentImportInPage
Ce contenu n’est pas encore disponible dans votre langue.
Diagnostic Category: lint/nursery/noDocumentImportInPage
Since: v1.9.4
Sources:
- Same as:
@next/no-document-import-in-page
Description
Section titled DescriptionPrevents importing next/document
outside of pages/_document.jsx
in Next.js projects.
The next/document
module is intended for customizing the document structure globally in Next.js.
Importing it outside of pages/_document.js
can cause unexpected behavior and break certain features of the framework.
Examples
Section titled ExamplesValid
Section titled Validimport { Document, Html } from 'next/document'
export default class MyDocument extends Document { render() { return ( <Html lang="en"> {/* */} </Html> ) }}
How to configure
Section titled How to configure{ "linter": { "rules": { "nursery": { "noDocumentImportInPage": "error" } } }}