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

Add rule mandatory-useEvent #100

Merged
merged 19 commits into from Jun 9, 2022
Merged

Add rule mandatory-useEvent #100

merged 19 commits into from Jun 9, 2022

Conversation

AlexandrHoroshih
Copy link
Member

Closes #30

@AlexandrHoroshih AlexandrHoroshih marked this pull request as ready for review June 4, 2022 17:08
@AlexandrHoroshih AlexandrHoroshih marked this pull request as draft June 4, 2022 17:13
@AlexandrHoroshih AlexandrHoroshih marked this pull request as ready for review June 4, 2022 17:31
@sergeysova
Copy link
Collaborator

What about adding useUnit?

@AlexandrHoroshih
Copy link
Member Author

AlexandrHoroshih commented Jun 5, 2022

@sergeysova useUnit for react is not released yet

But i have added this hook as a valid case too:
https://github.com/effector/eslint-plugin/pull/100/files#diff-f35390e35e563e731537d182912043de45378d5460d488b0c603e46e9a75eeb4R61

Also, this rule (with minor changes) can be transformed to prefer-useUnit, once this api is released

Aliased imports may be useful in near future because of possible clash with React's `useEvent` RFC
Copy link
Member

@igorkamyshev igorkamyshev left a comment

Choose a reason for hiding this comment

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

Great job, thanks ❤️

Please merge as soon as you are ready. I'll prepare the next release in a week.

if (parserServices.hasFullTypeInformation) {
return {
Identifier(node) {
if (isInsideReactComponent(node)) {
Copy link
Member

Choose a reason for hiding this comment

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

🤓 personally, I would prefer early returns rather than 3 levels of nesting.

@AlexandrHoroshih AlexandrHoroshih merged commit 1792ac2 into master Jun 9, 2022
@AlexandrHoroshih AlexandrHoroshih deleted the feat-useevent branch June 9, 2022 03:55
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.

Rule: mandatory-useEvent
3 participants