-
-
Notifications
You must be signed in to change notification settings - Fork 482
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
enhancement(linter) expand only-used-in-recursion to support jsx #5530
Comments
… creation (#6513) ### Overview This PR refactors `only-used-in-recursion` codebase to make the implementation of #5530 easier. The diff isn't displaying cleanly, so it might be better to review it commit by commit when looking at the changes. ### Key changes 1. Extracted diagnostic logic into `craete_diagnostic` function: 3bf0015 2. Removed redundant check in `is_function_maybe_reassigned`: a133ec6 3. Simplified `is_argument_only_used_in_recursion` by removing nesting: 6e6bd04
i can't seem to assign this. But @no-yan is going to work on it! |
You can only assign an outside contributor when they make a comment here. |
It would have been better to comment here. Thanks for the reminder!
For example, in this case, the spread operator might alter the program’s behavior, which is why no fix is applied: function Test(props) { // could be {key: 0}
return (
<Test key={2} {...props} />
);
} But in most cases, like the one below, removing an argument seems safe in JSX: - <Item innerItem={item} width={width} />
+ <Item width={width} /> |
i think reporting the spread should be fine. i can't think of any other edges.
reporting here should be fine right? i don't think From the react docs
|
Thanks for the clarification!
(This might be off-topic) |
currently,
only-used-in-recursion
only supports cases such as:it could be expanded to support cases such as:
cc @no-yan
The text was updated successfully, but these errors were encountered: