-
-
Notifications
You must be signed in to change notification settings - Fork 411
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
💅 False positive noUselessConstructor for changed data modifiers #987
Comments
Thanks for bringing this to light! We currently have no way of retrieving the accessibility modifier of the parent's constructor. The only way to fix this is ignoring claases that extend a class. However I see a possible workaround: we could ignore the constructors with an explicit TypeScript ESLint documented the caveat and decided to not fix this rare false positive. Any opinion? |
I can’t say I agree with the TypeScript ESLint reasoning. The reason for using TypeScript is precisely to take advantage of as much typing as possible. I don’t particularly like the explicit How difficult would it be to get access to inheritance chain? |
If the class is in the same file, it isp ossible. Otherwise, the infrastructure is currently uable to query other files. This requires to change the underlying infrastructure. By the way it si something we plan to do to support multi-file analysis. |
It’s not a huge issue for the moment. Better to wait for the proper fix with the planned multi-file analysis. Worth documenting the edge case for now. Thanks for investigating! |
Definitively! We should document this. |
This has been documented |
Environment information
Rule name
noUselessConstructor
Playground link
https://biomejs.dev/playground/?code=YwBsAGEAcwBzACAAQgBhAHMAZQAgAHsACgAgACAAcAByAGkAdgBhAHQAZQAgAHIAZQBhAGQAbwBuAGwAeQAgAHYAYQBsADoAIABzAHQAcgBpAG4AZwA7AAoAIAAgAAoAIAAgAHAAcgBvAHQAZQBjAHQAZQBkACAAYwBvAG4AcwB0AHIAdQBjAHQAbwByACgAdgBhAGwAOgAgAHMAdAByAGkAbgBnACkAIAB7AAoAIAAgACAAIAB0AGgAaQBzAC4AdgBhAGwAIAA9ACAAdgBhAGwAOwAKACAAIAB9AAoAfQAKAAoAYwBsAGEAcwBzACAARABlAHMAYwBlAG4AZABhAG4AdAAgAGUAeAB0AGUAbgBkAHMAIABCAGEAcwBlACAAewAKACAAIABjAG8AbgBzAHQAcgB1AGMAdABvAHIAKAB2AGEAbAA6ACAAcwB0AHIAaQBuAGcAKQAgAHsACgAgACAAIAAgAHMAdQBwAGUAcgAoAHYAYQBsACkACgAgACAAfQAKAH0ACgAKAGMAbwBuAHMAdAAgAGQAIAA9ACAAbgBlAHcAIABEAGUAcwBjAGUAbgBkAGEAbgB0ACgAJwBoAGUAbABsAG8AIQAnACkACgA%3D
Expected result
The rule should not be triggered in this situation. See TypeScript playground link below for error resulting from suggested linter fix.
https://www.typescriptlang.org/play?#code/MYGwhgzhAEBCkFNoG8BQ1oAcBOBLAbmAC5LYJgAmA9gHYgCe0hIAXNBEXjQOYDc60ATiolgJCtGC0O2AK5iq2ABTM2M3DwCUKARiIALXBAB0zaAF4mYEPwwBfVA9ShIMACIIIwBDQpgaRNAIAB4kvjDwEEhoAPQxGJLSnPJEiirWapwa3Nqx8QnsspgIysyaqHEJDk5SNBzQEpY0CADu0B5ePn4BSgDk+gggIFQAhL3lQA
Code of Conduct
The text was updated successfully, but these errors were encountered: