Repository navigation
Rule proposal for noUselessOptionalChaining and noUselessNonNullAssertion
#5145
MikeRomaa
started this conversation in
Rule suggestion
Replies: 3 comments 1 reply
This comment has been hidden.
This comment has been hidden.
|
I'd love to see this implemented now that #3187 was completed. |
0 replies
|
Chiming in here to say that https://biomejs.dev/linter/rules/no-useless-type-assertion seems to cover the "non-null assertion" part of the rule. That said, we don't currently have a "useless optional chaining" rule as of 2.6.6 (to my knowledge). |
0 replies
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.
Uh oh!
There was an error while loading. Please reload this page.
I would like to propose two new, related rules for Biome in the "correctness" category. These would both have very simple safe fixes that simply removes the errant operator. Curious to see what others think about these.
If this is something that is desirable in the nursery, I would be interested in implementing myself as I've been long awaiting a chance to contribute to Biome.
noUselessOptionalChainingDisallow the use of the optional chaining operator (
?.) on types that are not unions includingundefinedornull.noUselessNonNullAssertionThis one is related to
noExtraNonNullAssertion.Disallow the use of the non-null assertion operator (
!) on types that may returnundefinedornull.All reactions