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

linter: map rules of hooks to react-hooks #3317

Closed
Boshen opened this issue May 16, 2024 · 1 comment · Fixed by #3334
Closed

linter: map rules of hooks to react-hooks #3317

Boshen opened this issue May 16, 2024 · 1 comment · Fixed by #3334
Assignees

Comments

@Boshen
Copy link
Member

Boshen commented May 16, 2024

          BTW, will linter configurations be also supported?
{
  "rules": {
    // ...
    "react-hooks/rules-of-hooks": "error",
    "react-hooks/exhaustive-deps": "warn"
  }
}

https://github.com/facebook/react/tree/main/packages/eslint-plugin-react-hooks#custom-configuration

If we need to change like this, might there be compatibility issues...?

{
  "rules": {
    // ...
    "react/rules-of-hooks": "error",
    "react/exhaustive-deps": "warn"
  }
}

Originally posted by @leaysgur in #3315 (comment)

@Boshen Boshen self-assigned this May 16, 2024
@rzvxa
Copy link
Collaborator

rzvxa commented May 16, 2024

Can we have it in such a way that both the react and react-hooks alias work? this way we can ease the migration while providing easy-to-understand names for newcomers with no eslint experience.


Edit:

Thinking out loud here.

Maybe we can even rename rules-of-hooks to just hooks since react/hooks makes perfect sense in the context of "rules".
If we want to be able to load eslint configs directly we can provide a compatibility layer that would parse eslint configs and have strategies for the mapping, mostly we want to pass options through as is but sometimes we can rename or even combine rules in this process (by combining I mean we can get a from eslintrc and resolve it to plugin b and c in the oxlint).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants