Skip to content

Conversation

@BridgeAR
Copy link
Member

@BridgeARBridgeAR commented Feb 12, 2018

Currently the call can lead to a TypeError.

This fixes it by first checking that there are arguments to validate.

The error is triggered by writing: require(). Due to my auto completion in my editor the closing bracket is added as soon as I have a open one and this triggers the eslint rule for e.g. crypto-check or inspector-check and there are obviously no arguments yet in that case.

[Error - 12:54:43 PM] ESLint stack trace: [Error - 12:54:43 PM] TypeError: Cannot read property 'value' of undefined at Object.module.exports.isRequired (/home/ruben/repos/node/node/tools/eslint-rules/rules-utils.js:12:39) at checkAssertNode (/home/ruben/repos/node/node/tools/eslint-rules/prefer-assert-iferror.js:27:17) at CallExpression (/home/ruben/repos/node/node/tools/eslint-rules/prefer-assert-iferror.js:33:35) at listeners.(anonymous function).forEach.listener (/home/ruben/repos/node/node/tools/node_modules/eslint/lib/util/safe-emitter.js:47:58) at Array.forEach (native) at Object.emit (/home/ruben/repos/node/node/tools/node_modules/eslint/lib/util/safe-emitter.js:47:38) at NodeEventGenerator.applySelector (/home/ruben/repos/node/node/tools/node_modules/eslint/lib/util/node-event-generator.js:251:26) at NodeEventGenerator.applySelectors (/home/ruben/repos/node/node/tools/node_modules/eslint/lib/util/node-event-generator.js:280:22) at NodeEventGenerator.enterNode (/home/ruben/repos/node/node/tools/node_modules/eslint/lib/util/node-event-generator.js:294:14) at CodePathAnalyzer.enterNode (/home/ruben/repos/node/node/tools/node_modules/eslint/lib/code-path-analysis/code-path-analyzer.js:608:23) at Traverser.enter [as _enter] (/home/ruben/repos/node/node/tools/node_modules/eslint/lib/linter.js:998:32) 
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

tools

Currently the call can lead to a TypeError with the message: `Cannot read property 'value' of undefined`. This fixes it by first checking that the first argument is truthy.
@nodejs-github-botnodejs-github-bot added the tools Issues and PRs related to the tools directory. label Feb 12, 2018
@apapirovskiapapirovski added the fast-track PRs that do not need to wait for 48 hours to land. label Feb 12, 2018
@apapirovski
Copy link
Contributor

apapirovski commented Feb 12, 2018

CI: https://ci.nodejs.org/job/node-test-pull-request/13121/

😉

@BridgeARBridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Feb 12, 2018
@BridgeAR
Copy link
MemberAuthor

Landed in 1a5f670

BridgeAR added a commit to BridgeAR/node that referenced this pull request Feb 12, 2018
Currently the call can lead to a TypeError with the message: `Cannot read property 'value' of undefined`. This fixes it by first checking that the first argument is truthy. PR-URL: nodejs#18729 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
MylesBorins pushed a commit that referenced this pull request Feb 21, 2018
Currently the call can lead to a TypeError with the message: `Cannot read property 'value' of undefined`. This fixes it by first checking that the first argument is truthy. PR-URL: #18729 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
MylesBorins pushed a commit that referenced this pull request Feb 21, 2018
Currently the call can lead to a TypeError with the message: `Cannot read property 'value' of undefined`. This fixes it by first checking that the first argument is truthy. PR-URL: #18729 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
MylesBorins pushed a commit that referenced this pull request Feb 21, 2018
Currently the call can lead to a TypeError with the message: `Cannot read property 'value' of undefined`. This fixes it by first checking that the first argument is truthy. PR-URL: #18729 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
@MylesBorinsMylesBorins mentioned this pull request Feb 21, 2018
MylesBorins pushed a commit that referenced this pull request Feb 21, 2018
Currently the call can lead to a TypeError with the message: `Cannot read property 'value' of undefined`. This fixes it by first checking that the first argument is truthy. PR-URL: #18729 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
MayaLekova pushed a commit to MayaLekova/node that referenced this pull request May 8, 2018
Currently the call can lead to a TypeError with the message: `Cannot read property 'value' of undefined`. This fixes it by first checking that the first argument is truthy. PR-URL: nodejs#18729 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
MylesBorins pushed a commit that referenced this pull request Aug 7, 2018
Currently the call can lead to a TypeError with the message: `Cannot read property 'value' of undefined`. This fixes it by first checking that the first argument is truthy. PR-URL: #18729 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
rvagg pushed a commit that referenced this pull request Aug 16, 2018
Currently the call can lead to a TypeError with the message: `Cannot read property 'value' of undefined`. This fixes it by first checking that the first argument is truthy. PR-URL: #18729 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
@MylesBorinsMylesBorins mentioned this pull request Aug 16, 2018
@BridgeARBridgeAR deleted the fix-lint-issue branch April 1, 2019 23:38
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.fast-trackPRs that do not need to wait for 48 hours to land.toolsIssues and PRs related to the tools directory.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@BridgeAR@apapirovski@benjamingr@MylesBorins@nodejs-github-bot