Experience-Monks/nextjs-boilerplate

[Bug] Linter Issue - @next/next/no-document-import-in-page

grez96 opened this issue · 2 comments

npm run linters

generates the following error:
image
Error: next/document should not be imported outside of pages/_document.js. See https://nextjs.org/docs/messages/no-document-import-in-page.

Seems to happen because nextjs expects _document file to end with a .js extension, but in reality it ends with a .tsx extension

Just dropping a note to say still an issue and replicable with "eslint-config-next": "^11.1.2", on Windows

Temporarily adding the ignore line

{
  "extends": ["next", "next/core-web-vitals"],
  "rules": {
    "@next/next/no-document-import-in-page": "off"
  }
}