-
-
Notifications
You must be signed in to change notification settings - Fork 59
no-unused-expressions error when optional chaining + array method #185
Comments
When would an array lack forEach? Separately, that looks like an eslint error from a core rule - but eslint doesn’t support anything that’s not stage 4, so the rule wouldn’t be able to handle those parse nodes (even with babel-eslint handling the parsing) until then. |
May be a mistake from me, but the form |
optional chaining is on the edge of stage 3, see tc39/ecma262#1646 |
Try using the |
@nicolo-ribaudo can you please elaborate ? i'm completly lost... |
As the README states, there are some ESLint rules which don't correctly work with new language features:
That's the only reason for this plugin to exist. In your case, you need to use |
My
But the same error continue to show up |
Per the readme:
You need to explicitly disable You can do this by adding |
Thanks. |
The complete answer is, disable |
Just wanted to confirm a few items about the syntax and a quick note about top level access: If you want to test x.forEach?.() If you want to test x?.forEach?.() Gotcha is that if x?.forEach?.() will throw |
got an error on
array
: error Expected an assignment or function call and instead saw an expression no-unused-expressionsMy configuration
package.json
The text was updated successfully, but these errors were encountered: