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
❯ npx eslint .
Oops! Something went wrong! :(
ESLint: 8.45.0
TypeError: Cannot read properties of null (reading 'name')
Occurred while linting /home/fengyu/projects/AlphaWallet/common-api/backend/src/handlers/attestationKeysActions.ts:93
Rule: "security-node/detect-unhandled-async-errors"
at isTryCatchStatement (/home/fengyu/projects/AlphaWallet/common-api/backend/node_modules/eslint-plugin-security-node/lib/rules/detect-unhandled-async-errors.js:42:73)
at FunctionDeclaration (/home/fengyu/projects/AlphaWallet/common-api/backend/node_modules/eslint-plugin-security-node/lib/rules/detect-unhandled-async-errors.js:99:29)
at ruleErrorHandler (/home/fengyu/projects/AlphaWallet/common-api/backend/node_modules/eslint/lib/linter/linter.js:1050:28)
at /home/fengyu/projects/AlphaWallet/common-api/backend/node_modules/eslint/lib/linter/safe-emitter.js:45:58
at Array.forEach (<anonymous>)
at Object.emit (/home/fengyu/projects/AlphaWallet/common-api/backend/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
at NodeEventGenerator.applySelector (/home/fengyu/projects/AlphaWallet/common-api/backend/node_modules/eslint/lib/linter/node-event-generator.js:297:26)
at NodeEventGenerator.applySelectors (/home/fengyu/projects/AlphaWallet/common-api/backend/node_modules/eslint/lib/linter/node-event-generator.js:326:22)
at NodeEventGenerator.enterNode (/home/fengyu/projects/AlphaWallet/common-api/backend/node_modules/eslint/lib/linter/node-event-generator.js:340:14)
at CodePathAnalyzer.enterNode (/home/fengyu/projects/AlphaWallet/common-api/backend/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js:795:23)
The text was updated successfully, but these errors were encountered:
I am having the same issue with following syntax. In the code below, initServer type signature is (method) mybutton.initServer(): Promise<void | Error>. So we know for sure if the err is defined it's an Error object but still getting the same issue.
The current work around is to create a new Error instance.
mybutton.initServer().then((err)=>{if(err){/** * Calling this.myEvents.emit('error', err) * resulting eslint "security-node/detect-unhandled-event-errors" rule * to crash and throw an error. Seems like this is a bug in eslint rule. * * */this.myEvents.emit('error',newError(err.message))}})
I would expect passing err object to work just fine.
Could you please take a look 🙏🏻 I can help to fix this once I have time as well.
Here is the sample:
And here is the error:
The text was updated successfully, but these errors were encountered: