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

require-usememo rule options enhancements #56

Open
paztis opened this issue Jan 22, 2025 · 2 comments
Open

require-usememo rule options enhancements #56

paztis opened this issue Jan 22, 2025 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@paztis
Copy link

paztis commented Jan 22, 2025

I just discover your lint plugin and it is really powerful.
The issue I have is I already have a giant project where I want to introduce your rules. But I have too much error returned.
We may need a more configurable rule to let us progressively fix everything

in a 1st time we want to detect missing useMemo on Objects and Arrays. We don't want to check the JSX props.

Is it possible to enhance this rule to define the property types we want to lint ?
supportedPropTypes: ["object", "array", "function", "JSX"] for example.

@paztis
Copy link
Author

paztis commented Jan 22, 2025

for example below cases:

  • Function definition should be wrapped in useCallback() or be static when used as a prop => this is already catch with eslint-react/jsx-no-bind rule. So it is a doucle check that is expansive in term of cost. we need to be able to disable the checks ofr functions
  • JSX should be wrapped in useMemo() when used as a prop => we can disable the JSX cases if we want
  • An error was identified inside this expression, but it can't be fixed because it'd break the rule of hooks. JSX logic should be extracted into a separate component => same

@arthurgeron
Copy link
Owner

This is possible. I'll slice it down into some tasks and keep you updated. Thank you for the suggestion

@arthurgeron arthurgeron self-assigned this Jan 31, 2025
@arthurgeron arthurgeron added the enhancement New feature or request label Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants