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

fix(tasks/lint_rules): Integrate react and react-hooks rules #3315

Merged
merged 2 commits into from
May 16, 2024

Conversation

leaysgur
Copy link
Contributor

Fixes #2174 , now react-hooks plugin and its rules are managed by react plugin issue.

Copy link

graphite-app bot commented May 16, 2024

Your org has enabled the Graphite merge queue for merging into main

Add the label “merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix.

You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link.

Copy link
Contributor

@rzvxa rzvxa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@leaysgur
Copy link
Contributor Author

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"
  }
}

@rzvxa
Copy link
Contributor

rzvxa commented May 16, 2024

Do you mean in the long run? or would it cause issues with this task?

I guess we can alias the old rule name for a while, Or even better we can anticipate the wrong option and produce a nice error message pointing the user toward the right option.

@leaysgur
Copy link
Contributor Author

It was not about this task, but about the implementation of the Linter itself.

I thought that oxlint would be a drop-in replacement for eslint, allowing the use of existing eslintrc.json as is. (Although there are some unsupported rules)

I may just be assuming this on my own though...! 😅

@rzvxa
Copy link
Contributor

rzvxa commented May 16, 2024

Well, I don't know if that is the goal or not, What I know is that there are a few differences in our rules even not considering the unsupported rules, But with a few compromises, we can get this effect for sure.

I just think providing an automated way of upgrading could be easier; Since once we hit a stable release it is going to be a one-way trip.
We can't keep the backward compatibility forever since it would contain a bunch of legacy options and soon enough we would also have our own legacy options to worry about. What we can always do is provide an auto upgrade and/or nice error messages while detecting incompatible rules, And suggesting possible replacement options if there is one.

@Boshen
Copy link
Member

Boshen commented May 16, 2024

Thank you! I'll map the rules.

@Boshen Boshen merged commit 7f9d8b7 into main May 16, 2024
15 checks passed
@Boshen Boshen deleted the fix/lint_rules-react-hooks branch May 16, 2024 15:22
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 this pull request may close these issues.

☂️ eslint-plugin-react-hooks
3 participants