-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Rule proposal: disallow duplicate union and intersection types #2738
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
I've thought about doing this in the past! |
Sonarqube has this rule Hope to get it soon. |
What is the status of this issue? I'm interested to contribute, perhaps by trying to implement this rule. |
Everything in this project is community maintained! This issue has been open for 2 months and nobody's mentioned they're working on it - so it's safe to assume nobody is. Happy to accept a PR! |
I started an implementation, but lost interest at some point. The basics are pretty simple, but I can into more and more corner cases. I.e. type literals need to be compared, call signatures need to be compared, nested unions and intersections should be handled. I might pick it up at some point, but I won’t complain if someone else wants to fix this issue. :) |
Cool! I'll see if I can send something EOW. :) |
I noticed the sort-type-union-intersection-members rule was added. It might me more worthwile to drop my merge request and reuse some logic of that rule, since basically the difference between the two is that |
What is the status of this issue? (Is anyone working on this issue?) |
Currently open for anyone to work on - just needs a champion to implement it! |
This is available in eslint-plugin-sonar ( |
I would like to propose a new rule:
no-duplicate-union-intersection
.This rule reports duplicates in unions and intersections. The autofixer will remove all duplicates, keeping the first one.
The following lines will be reported:
This will be autofixed to:
The rule won’t try to resolve references. This may be an addition for later.
If this is accepted, I’m willing to implement this.
The text was updated successfully, but these errors were encountered: