-
-
Notifications
You must be signed in to change notification settings - Fork 209
Regression in v8.2.4+ / v9.0.0.beta: optional chaining without assignments trigger no-unused-expressions #643
Comments
The same problem also occurs in 9.0.0-beta.2 |
This is also still happening in v8.2.6 / v9.0.0-beta.3 |
@existentialism may I point out this issue here that's still happening with optional chaining? I believe this only happens when optional chaining is used outside of an assignment. As soon as I turn the above statement into an assignment, optional chaining works: const res = this.element?.destroy() |
I guess assignments without |
It's a pitty that this made it into 9.0.0 without a fix... @rubennorte since you knew how to fix #595 / #630, perhaps you could take a look at this issue? |
|
The fix for this is most likely in the forked version of Edit: Typo in link |
Where is the forked version? The link doesn't seem to contain it. |
Not sure what you mean with forked version @kaicataldo. The link href is broken, but the actual eslint-plugin-babel repo (link text) also does not seem to use a forked version of babel-eslint. Edit: Ah, i misread what part was forked, sorry! |
I believe it's this file here: https://github.com/babel/eslint-plugin-babel/blob/master/rules/no-unused-expressions.js |
Sorry for the typo in the link. @lehni has the correct one! |
@kaicataldo but what's this file forked from? |
Looking at this more closely, it looks like it's not so much forking code. It's extending the rules contained in this: https://github.com/eslint/eslint/blob/master/lib/rules/no-unused-expressions.js |
Ok, I think I've figured this out now:
Fingers crossed for this getting merged soon. |
If you can't wait for the release, you can already use it now:
|
Update: |
Unfortunately, #595 didn't solve all issues with optional chaining for me, or new ones got introduced in the meantime. While some uses of optional chaining seem to work now, others are causing new linting errors with v8.2.4 and v8.2.5:
The statement in question is:
v8.2.1 is still the last version that I am able to use for optional chaining
The text was updated successfully, but these errors were encountered: