-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[no-useless-constructor] should not report on different constructor type #3820
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
Comments
@bradzacher I've already added comment at |
Ah I apologise - I did not see the snippet had more. MacOS hides the scroll bars and the snippet ended perfectly. This is working as expected - this lint rule does not use type information, only the AST. Either use a disable comment or make the constructor not-useless export class RedirectError extends ResponseError {
constructor(url: string) {
super({message: url})
}
} |
@bradzacher That's OK, but again the limitation could be documented. |
Happy to accept a PR! |
Can you reopen this issue and I'll raise a PR when I'm free, you can assign it to me. |
Like #3796 (comment) Can we ignore different constructor param names and types? Or at least an option? If you agree, I can try to raise a PR for it/them. |
You cannot do this because you don't have access to type information in this extension rule. |
@bradzacher Well, can we include type information in this rule then? Just like It will be a breaking change. |
No. Significant portions of our userbase does not use type-information. This means that introducing it into an existing rule hugely restricts the accessibility of the rule. It is a massive breaking change that likely locks users out of using the rule altogether. So when we make the decision to add type information, it needs to be for a very good reason and add a lot of value. In addition - adding it into an extension rule is something we need to make sure we're doing for the right reason. Extension rules exist to add support for TS code to the core rules (in this case - accessibility and parameter properties) - so we want them to be as accessible as possible. Adding type information to handle this (frankly) very rare case is not worth the cost. |
@JounQin are you still planning on sending a PR? No worries if not, I will soon if you don't have time! |
@JoshuaKGoldberg That would be nice! I have no time working on it temporarily. |
Repro
Expected Result
No error
Actual Result
error
Additional Info
Versions
@typescript-eslint/eslint-plugin
4.29.3
@typescript-eslint/parser
4.29.3
TypeScript
4.4.2
ESLint
7.32.0
node
12.22.5
The text was updated successfully, but these errors were encountered: