You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Need an ESLint rule that restricts optional chaining with negation. #21984
What's interesting to me is looking at the other, negated instance of this condition, I sense there's going to be a very common pitfall associated with optional chaining:
If someone treats optional chaining as a way to get to the value by any means necessary, it might be easy to overlook that negating would produce true if the optional chaining aborts early:
I proposed a new rule for this at #22041. I'd welcome feedback, but at this time I have a feeling there is likely going to be enough legitimate use-cases for the behavior that creating a rule will be counter-productive.
Going to close the issue for this reason. It can be revisited in the future if continued usage surfaces new insight.
Activity
aduth commentedon May 13, 2020
I proposed a new rule for this at #22041. I'd welcome feedback, but at this time I have a feeling there is likely going to be enough legitimate use-cases for the behavior that creating a rule will be counter-productive.
Going to close the issue for this reason. It can be revisited in the future if continued usage surfaces new insight.
sainthkh commentedon May 14, 2020
When I saw the real-world use cases you mentioned in #22041, I also felt that the warning in coding guideline would be sufficient.
Thank you for spending time on this.