Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: ensure "version" always has a valid value in parseOptions (#109)
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.
- Loading branch information