Add eslint rule for importing `next/document` outside of `pages/_document.js`
See original GitHub issueFeature request
Is your feature request related to a problem? Please describe.
Currently next/document
can be imported anywhere even though it should only be used in pages/_document.js
and causes issues when imported elsewhere.
Describe the solution you’d like
- Disallow importing
next/document
outside ofpages/_document.js
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Nextjs - importing next/document outside of pages/_document ...
I am getting this error during build time because of Next.js custom document. So, during the build ...
Read more >no-restricted-imports - ESLint - Pluggable JavaScript Linter
This rule allows you to specify imports that you don't want to use in your application. It applies to static imports only, not...
Read more >Basic Features: ESLint - Next.js
These conformance rules help you use Next.js in the optimal way. ... Prevent importing next/document outside of pages/_document.js .
Read more >eslint-plugin-import - npm
IF YOU ARE USING THIS WITH SUBLIME: see the bottom section for important info. Rules. Static analysis. Ensure imports point to a file/module ......
Read more >ESLint | WebStorm Documentation - JetBrains
Besides JavaScript and TypeScript, ESLint can be applied to files of ... more information about ESLint configuration files and adding rules.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I am not importing document anywhere besides in _document, but this lint error is now showing up as I update to the latest version of next. Maybe I updated wrong?
I’m getting a warning for this starting in version 11.1.2 in my
pages/_document.tsx
file.