-
Notifications
You must be signed in to change notification settings - Fork 27k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docs: Update eslint document for Script Component on strategy 'beforeInteractive' #50096
Labels
Documentation
Related to Next.js' official documentation.
Comments
Found this PR has been merged but the lint is still on going. |
kodiakhq bot
pushed a commit
that referenced
this issue
May 26, 2023
## Why? ``` src/app/layout.tsx ``` ![code](https://github.com/vercel/next.js/assets/120007119/3cc991f8-a96d-4ffb-9f84-4dfdbcac5318) **eslint[@next/next/no-before-interactive-script-outside-document](https://nextjs.org/docs/messages/no-before-interactive-script-outside-document)** > `next/script`'s `beforeInteractive` strategy should not be used outside of `pages/_document.js`. ## How? - Possibility of pathname starts with "/" on OS X and Linux, so added condition to check file path starting with "/" - e.g. "/src/app" or "/app" - Added test code Passed - `pnpm build && pnpm lint` - `pnpm jest test/unit/eslint-plugin-next/no-before-interactive-script-outside-document.test.ts` Extends #46609 Fixes #50096 Fixes NEXT-1230
hydRAnger
pushed a commit
to hydRAnger/next.js
that referenced
this issue
Jun 12, 2023
## Why? ``` src/app/layout.tsx ``` ![code](https://github.com/vercel/next.js/assets/120007119/3cc991f8-a96d-4ffb-9f84-4dfdbcac5318) **eslint[@next/next/no-before-interactive-script-outside-document](https://nextjs.org/docs/messages/no-before-interactive-script-outside-document)** > `next/script`'s `beforeInteractive` strategy should not be used outside of `pages/_document.js`. ## How? - Possibility of pathname starts with "/" on OS X and Linux, so added condition to check file path starting with "/" - e.g. "/src/app" or "/app" - Added test code Passed - `pnpm build && pnpm lint` - `pnpm jest test/unit/eslint-plugin-next/no-before-interactive-script-outside-document.test.ts` Extends vercel#46609 Fixes vercel#50096 Fixes NEXT-1230
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
What is the improvement or update you wish to see?
Since we moved on from
Page Router
toApp Router
, eslint should not show a lint aboutpages/_document.js
if it is onApp Router
.When using the Script component inside
page.tsx
with strategybeforeInteractive
,The example from the docs for Script Components in
App Router
shows that the Script Component is in thepage.tsx
.Is there any context that might help us understand?
Does the docs page already exist? Please link to it.
https://nextjs.org/docs/app/api-reference/components/script#strategy
The text was updated successfully, but these errors were encountered: