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

chore: Enforce the use of ReanimatedError instead of Error #6454

Merged
merged 6 commits into from
Aug 30, 2024

Conversation

MatiPl01
Copy link
Member

@MatiPl01 MatiPl01 commented Aug 27, 2024

Summary

This PR adds eslint rule that will enforce the use of the new ReanimatedError in favor of Error in the library source files.

Example image

Screenshot 2024-08-28 at 17 25 11

Test plan

Just try to use throw new Error inside the packages/react-native-reanimated instead of throw new ReanimatedError and see that eslint complains about incorrect usage.

@MatiPl01 MatiPl01 self-assigned this Aug 27, 2024
@MatiPl01 MatiPl01 marked this pull request as ready for review August 28, 2024 15:23
@MatiPl01 MatiPl01 requested review from Latropos and tjzel August 28, 2024 15:28
Copy link
Collaborator

@tjzel tjzel left a comment

Choose a reason for hiding this comment

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

Looks good, let's just work on some of these TODOs first.

I recall having some issues with Jest hanging on ESLint unit tests. From what I remember I wasn't able to solve it back in the day though. You can run Jest from the JavaScript debug terminal and, if you have source maps generated, the breakpoints will work - hope this piece of info is going to be helpful 🤞

Copy link
Contributor

@Latropos Latropos left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@MatiPl01
Copy link
Member Author

Looks good, let's just work on some of these TODOs first.

I recall having some issues with Jest hanging on ESLint unit tests. From what I remember I wasn't able to solve it back in the day though. You can run Jest from the JavaScript debug terminal and, if you have source maps generated, the breakpoints will work - hope this piece of info is going to be helpful 🤞

Thanks for suggestion about fixing tests. I spent some time looking into a potential cause of the issue, tried upgrading @typescript-eslint/* dependencies and nothing helps. When I was digging in the source code of @typescript-eslint/rule-tester I noticed that it hangs no the import of the @typescript-eslint/parser dependency and @typescript-eslint/typescript-estree.

I will merge this PR for now and look into the issue later on, since it seems to be better to solve it separately from this PR that just adds a new rule and doesn't break test which already don't work.

@MatiPl01 MatiPl01 added this pull request to the merge queue Aug 30, 2024
Merged via the queue into main with commit 4f5b96a Aug 30, 2024
8 checks passed
@MatiPl01 MatiPl01 deleted the @matipl01/use-reanimated-error-eslint-rule branch August 30, 2024 11:07
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.

3 participants