question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ERROR: no-unsafe-optional-chaining

See original GitHub issue

I followed the setup instructions exactly but I get the error:

ERROR in src/components/Contract/Contract.jsx
  Line 90:34:  Unsafe usage of optional chaining. If it short-circuits with 'undefined' the evaluation will throw TypeError  no-unsafe-optional-chaining

I also get 99 warnings about URLs that look like:

WARNING in ./node_modules/antd/dist/antd.css (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[2]!./node_modules/source-map-loader/dist/cjs.js!./node_modules/antd/dist/antd.css)
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map: 'webpack://antd/./components/time-picker/style/index.less' URL is not supported
 @ ./node_modules/antd/dist/antd.css 8:6-231 22:17-24 26:7-21 58:25-39 59:36-47 59:50-64 63:6-73:7 64:54-65 64:68-82 70:42-53 70:56-70 72:21-28 83:0-201 83:0-201 84:22-29 84:33-47 84:50-64 61:4-74:5
 @ ./src/App.jsx 18:0-28
 @ ./src/index.js 6:0-24 24:35-38

I have uninstalled and reinstalled yarn, and deleted and redid the ethereum-boilerplate setup. No matter what, I get 99 warnings and this error. I am on Manjaro Linux.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:17

github_iconTop GitHub Comments

20reactions
JodisWcommented, Mar 15, 2022

Change for (let method of contract?.abi ) to for (let method of contract?.abi ?? method)

It works for me. macOS Monterey

3reactions
mcnorwalkcommented, Mar 12, 2022

The errors magically stopped, but it was all pretty buggy and would randomly crash.

I ended up just building my own thing from scratch. It was faster than trying to get this working

Read more comments on GitHub >

github_iconTop Results From Across the Web

no-unsafe-optional-chaining - Pluggable JavaScript Linter
This rule aims to detect some cases where the use of optional chaining doesn't prevent runtime errors. In particular, it flags optional chaining...
Read more >
JavaScript's unsafe optional chaining is crazy
no-unsafe-optional-chaining is an amazing eslint rule, which help us identify what are we doing wrong with optional chaining and disallows ...
Read more >
no-unsafe-optional-chaining does not work with "||" or condition
no -unsafe-optional-chaining is an amazing eslint rule, which help us identify why we are doing wrong with optional chaining.
Read more >
Add config for no-unsafe-optional-chaining to catch ... - GitHub
I'm this case. .c is always evaluated regardless of the result of a?.b , which can be undefined and cause an error, so...
Read more >
Solved: Optional Chaining no-unused-expressions ESLint Error
Fix for "no-unused-expressions" ESLint error when using JavaScript optional chaining ... If you're seeing the " no-unused-expressions " ESLint ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found