-
-
Notifications
You must be signed in to change notification settings - Fork 171
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: ensure "version" always has a valid value in parseOptions #109
Fix: ensure "version" always has a valid value in parseOptions #109
Conversation
Codecov Report
@@ Coverage Diff @@
## master #109 +/- ##
=======================================
Coverage 98.21% 98.21%
=======================================
Files 43 43
Lines 1065 1065
=======================================
Hits 1046 1046
Misses 19 19
Continue to review full report at Codecov.
|
Oh, thank you for the contribution! It looks a regression in #99 I had overlooked. |
The rule no-unsupported-features would sometimes fail with a TypeError: ``` Error while loading rule 'node/no-unsupported-features': Cannot read property 'split' of null TypeError: Error while loading rule 'node/no-unsupported-features': Cannot read property 'split' of null at new Range (.../node_modules/semver/semver.js:780:20) at Function.intersects (.../node_modules/semver/semver.js:1305:8) at Object.freeze.features.Object.freeze.OPTIONS.reduce (.../node_modules/eslint-plugin-node/lib/rules/no-unsupported-features.js:191:44) at Array.reduce (<anonymous>) at parseOptions (.../node_modules/eslint-plugin-node/lib/rules/no-unsupported-features.js:175:41) at Object.create (.../node_modules/eslint-plugin-node/lib/rules/no-unsupported-features.js:281:25) ``` This happens, when neither "engines" are set in the "package.json", nor "version" is set in the rule configuration but the rule still has configuration options, because version will then be set to `options.version`, even if that is `undefined`. This commit ensures that `version` always has a valid value before trying to construct a semver range from it.
e995a59
to
25aac0a
Compare
@mysticatea updated, please take another look :) |
Hi @mysticatea just wanted to ask whether you had time already to take another look at this and if there's anything I can help with to get the fix released. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I apologize for my delay. LGTM!
No worries, thank you! |
The rule no-unsupported-features would sometimes fail with a TypeError:
This happens, when neither "engines" are set in the "package.json",
nor "version" is set in the rule configuration but the rule still has
configuration options, because version will then be set to
options.version
, even if that isundefined
.This commit ensures that
version
always has a valid value beforetrying to construct a semver range from it.