Skip to content
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

ESLint rule idea: <style> is not allowed inside _document.js #32656

Closed
sa3dany opened this issue Dec 19, 2021 · 4 comments · Fixed by #32678
Closed

ESLint rule idea: <style> is not allowed inside _document.js #32656

sa3dany opened this issue Dec 19, 2021 · 4 comments · Fixed by #32678
Labels
good first issue Easy to fix issues, good for newcomers Linting Related to `next lint` or ESLint with Next.js.

Comments

@sa3dany
Copy link
Contributor

sa3dany commented Dec 19, 2021

Describe the feature you'd like to request

As per the docs: https://nextjs.org/docs/advanced-features/custom-document#caveats
styled-jsx is not allowed inside custom _document.js and I was getting 500 errors on all SSR pages when deploying a site to production that had a <style> tag inside a custom _document.js.

I think it's a good idea to add an ESLint rule to remind users about this since the error I got did not make it straightforward to figure out the root cause of the issue.

Describe the solution you'd like

Add a new ESLint rule warning about the use of <style> tags inside a custom _document.js

Describe alternatives you've considered

Maybe prevent the build if a <style> tag is detected inside a custom _document.js

@balazsorban44 balazsorban44 added Linting Related to `next lint` or ESLint with Next.js. good first issue Easy to fix issues, good for newcomers and removed template: story labels Dec 19, 2021
@radosvet93
Copy link

Hello there! I'd like to work on that. New to codebase, any tips or guides will be highly appreciated, thanks!

@thibautsabot
Copy link
Contributor

thibautsabot commented Dec 20, 2021

Hello @radosvet93.

Make sure to read the Code of Conduct and the Contributing guide first!

ESLint rules are located in this folder: https://github.com/vercel/next.js/tree/canary/packages/eslint-plugin-next/lib/rules

Always add tests along with your new features 🙂 .

Once a PR is opened, automatic tests / lint will be performed on your code.

A Next.js maintainer will review your code whenever they can.

@niicode
Copy link

niicode commented Apr 6, 2022

Hello is there anyone working on this already.
I would like to try my hands on this. I am a first time contributor.

@kodiakhq kodiakhq bot closed this as completed in #32678 May 23, 2022
kodiakhq bot pushed a commit that referenced this issue May 23, 2022
## Bug

- [ ] Related issues linked
fixes #32656



Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
@github-actions
Copy link
Contributor

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
good first issue Easy to fix issues, good for newcomers Linting Related to `next lint` or ESLint with Next.js.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants