-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat(eslint-plugin): [ban-types] support banning []
#2704
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
feat(eslint-plugin): [ban-types] support banning []
#2704
Conversation
Thanks for the PR, @jsone-studios! typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community. The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately. Thanks again! 🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint. As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitors per day. |
Codecov Report
@@ Coverage Diff @@
## master #2704 +/- ##
=======================================
Coverage 92.79% 92.79%
=======================================
Files 294 294
Lines 9682 9684 +2
Branches 2717 2718 +1
=======================================
+ Hits 8984 8986 +2
Misses 330 330
Partials 368 368
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it might also be worth adding [] to the default banned types.
I can understand why you might want to ban it in your codebase though IMO it doesn't belong in the defaults.
The defaults are setup to increase codebase standardisation and safety. Things like {}
are banned because they work differently to how people think they work.
But []
works exactly as you'd expect - it's an empty array.
LGTM - thanks for your contribution!
Thank you very much!! 🚀 |
@bradzacher just for the your consideration, I've only ever seen |
@dimitropoulos The only time I saw the empty tuple being used was exactly the way you described as well. I couldn't imagine a natural situation in which |
fix #2582
This PR only adds support for banning the empty tuple type
[]
, it does not change the default options of theban-types
rule.I think it might also be worth adding
[]
to the default banned types. As this would be a breaking change, I would do it in another PR, if the maintainers are ok with that.