feat: noUnnecessaryCoalescingOperator
for TypeScript
#7675
rsiebertdev
started this conversation in
Rule suggestion
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
For those using the
prefer-nullish-coalescing
rule derived from typescript-eslint (still yet to be implemented), it'd be very nice to see Biome support anoUnnecessaryCoalescingOperator
rule.Take an example like this:
🚨 This code will never produce
bar
in its output.💭 This is because a string can only ever be truthy or falsy, and can never be nullish. This is something that, to my knowledge, is not yet checked by any major IDE's or linters.
Code like this could easily fall into production code, especially when using a rule like
prefer-nullish-coalescing
, and can be quite difficult to diagnose.👉 Having a rule like
noUnnecessaryCoalescingOperator
would help to prevent this.Beta Was this translation helpful? Give feedback.
All reactions