Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: be defensive when given a falsy context value #56

Merged
merged 4 commits into from
Aug 14, 2019
Merged

fix: be defensive when given a falsy context value #56

merged 4 commits into from
Aug 14, 2019

Conversation

snyamathi
Copy link
Collaborator

@redonkulus @BillDorn when given a falsy context value, value.constructor === Array throws a runtime error. We can instead use Array.isArray which is probably a bit neater anyhow.

It's possible that we could also fix this by putting an early return/continue before any such falsy values but given my limited familiarity with this repo I'd rather keep the scope of the change small.

I confirm that this contribution is made under the terms of the license found in the root directory of this repository's source tree and that I have the authority necessary to make this contribution on behalf of its copyright owner.

@snyamathi
Copy link
Collaborator Author

It looks like node 6 failed at the lint step since they're using the spread operator w/in eslint iteslf.

> [email protected] lint /home/travis/build/yahoo/ycb
> eslint .
/home/travis/build/yahoo/ycb/node_modules/eslint/lib/cli-engine/cli-engine.js:257
        ...calculateStatsPerFile(messages)
        ^^^
SyntaxError: Unexpected token ...
    at NativeCompileCache._moduleCompile (/home/travis/build/yahoo/ycb/node_modules/v8-compile-cache/v8-compile-cache.js:242:18)
    at Module._compile (/home/travis/build/yahoo/ycb/node_modules/v8-compile-cache/v8-compile-cache.js:186:36)
    at Object.Module._extensions..js (module.js:586:10)
    at Module.load (module.js:494:32)
    at tryModuleLoad (module.js:453:12)
    at Function.Module._load (module.js:445:3)
    at Module.require (module.js:504:17)
    at require (/home/travis/build/yahoo/ycb/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
    at Object.<anonymous> (/home/travis/build/yahoo/ycb/node_modules/eslint/lib/cli-engine/index.js:3:23)
    at Module._compile (/home/travis/build/yahoo/ycb/node_modules/v8-compile-cache/v8-compile-cache.js:194:30)

@@ -24,7 +24,7 @@
"npm": ">1.0"
},
"devDependencies": {
"eslint": "^6.0.1",
"eslint": "^5.0.0",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@redonkulus
Copy link
Collaborator

Node 8 and 10 are breaking too

@redonkulus redonkulus merged commit af832bb into yahoo:master Aug 14, 2019
@snyamathi snyamathi deleted the array branch August 14, 2019 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants