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

jsx-no-leaked-render can work better if it checks the TS type of the left-side value #3761

Closed
yusufkinatas opened this issue May 29, 2024 · 1 comment

Comments

@yusufkinatas
Copy link

Seems like this issue is closed, but I think the code can be improved for checking if left side is boolean or not. Currently, the implementation only looks if the variable is assigned to a boolean in it's current scope. So it is not working if I am using a TS-typed component prop.

I think this can be improved by actually checking TS-type of the variable on the left-side.

Here is an example demonstrating the pain-point.

image

I checked the codebase a bit, but could not find an easy way to get it right by checking the TS type.
I think we need to somehow get to what IDE shows as variable type when hovered.
Screenshot 2024-05-29 at 12 09 19

PS: This post originated from this comment. But I am sure if it makes sense to add new comments to a closed issue. So I opened this as a new one.

Related issue: #3719

@yusufkinatas yusufkinatas changed the title 'jsx-no-leaked-render' can work better if it checks the TS type of the left-side value jsx-no-leaked-render can work better if it checks the TS type of the left-side value May 29, 2024
@AhmedBaset
Copy link

Duplicate of #3754

@yusufkinatas yusufkinatas closed this as not planned Won't fix, can't repro, duplicate, stale May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants