-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
no-misused-generics
: false negative
#30
Comments
If you have TypeScript configured to parse JSX, the RHS of that variable declaration will be parsed as a const myFunction = <T,>(param: T) => 1;
// ^ |
Unfortunately that doesn't seem to help. Reduced test case: https://github.com/OliverJAsh/eslint-no-misused-generics-test |
Not going to fix this 'cause I don't have the time to figure out why it's doing what it's doing: eslint-plugin-etc/tests/rules/no-misused-generics.ts Lines 105 to 117 in 4152f18
I didn't write this rule; I just ported it. And, TBH, I'm beginning to think that it's more trouble than it's worth. It's too simplistic and won't work with valid, but context-sensitive generic usage. I'm inclined to delete it and give the package a major version bump. |
Thinking about it some more, my guess is that the original author made the (correct) decision that it's too difficult to determine whether what's returned relates to the parameter with the type parameter. E.g. this would be okay: const myFunction = <T>(param: T) => param; |
You're totally right. I actually filed the same issue back when we were using Wotan 🤦. Sorry! fimbullinter/wotan#690 |
The text was updated successfully, but these errors were encountered: