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

Disable certain rules for next.js #251

Closed
nahtnam opened this issue Sep 2, 2024 · 2 comments · Fixed by #293 · May be fixed by #294
Closed

Disable certain rules for next.js #251

nahtnam opened this issue Sep 2, 2024 · 2 comments · Fixed by #293 · May be fixed by #294
Assignees
Labels
accepted The issue is accepted and a PR can be proposed. plugins

Comments

@nahtnam
Copy link
Contributor

nahtnam commented Sep 2, 2024

It would be great if the following rules were disabled for the app folder (could be in either /app or /src/app):

import/no-default-export - every tsx/jsx file has a default export
react/function-component-definition - its common for next.js apps to just do `export default function Page() {}`, seems weird to enforce switching to `export default const Page = () => {}`
@typescript-eslint/explicit-module-boundary-types - return type seems redundant, every file in a route file will be returning a jsx element
react-refresh/only-export-components - jsx/tsx files often export config or metadata functions and files
@nahtnam
Copy link
Contributor Author

nahtnam commented Sep 2, 2024

I know we are entering opinionated territory but I personally believe if next: true then function-component-definition should go from anonymous components to function declaration for consistency (pretty much all next.js docs use export function)

@AndreaPontrandolfo AndreaPontrandolfo added plugins triaging Issue is still being evaluated. PRs not yet accepted. labels Sep 2, 2024
@AndreaPontrandolfo
Copy link
Owner

Hey @nahtnam , great suggestions!

import/no-default-export - every tsx/jsx file has a default export

Sure, i will PR this.

I know we are entering opinionated territory but I personally believe if next: true then function-component-definition should go from anonymous components to function declaration for consistency (pretty much all next.js docs use export function)

Sure, makes sense.

@typescript-eslint/explicit-module-boundary-types - return type seems redundant, every file in a route file will be returning a jsx element

Mmmm, i still find this valuable. I'll keep this. If some user don't want this, they can disable it easily anyway.

react-refresh/only-export-components - jsx/tsx files often export config or metadata functions and files

Mmm, i think i'll put my trust in the developer of that plugin and let it do it's thing. The plugin ensures that HMR will keep working is JSX files. I don't think anybody wants broken HMR in next.js files.

@AndreaPontrandolfo AndreaPontrandolfo self-assigned this Nov 1, 2024
@AndreaPontrandolfo AndreaPontrandolfo added accepted The issue is accepted and a PR can be proposed. and removed triaging Issue is still being evaluated. PRs not yet accepted. labels Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted The issue is accepted and a PR can be proposed. plugins
Projects
None yet
2 participants