Eslint-plugin-react: Error in 7.8.0 Cannot read property 'split' of undefined

Created on 11 May 2018  路  17Comments  路  Source: yannickcr/eslint-plugin-react

Cannot read property 'split' of undefined
TypeError: Cannot read property 'split' of undefined
at test (....node_modules/eslint-plugin-react/lib/util/version.js:30:25)
at Object.testReactVersion (...node_modules/eslint-plugin-react/lib/util/version.js:39:10)

My eslint version is "4.19.1"
My node version is 9.11.1

bug

All 17 comments

Same with node 10.0.0 & eslint 4.19.1

Same with node version 7 and node version 8 and eslint 4.19.1

Same w/ Node LTS, [email protected], and [email protected]

Can anyone affected by this share their eslint config, and also more of the stack trace?

I think I found something. Might open a PR soon

@taddei I have a fix already, I just need a regression test.

ok cool, np.
feel free to discard this: https://github.com/yannickcr/eslint-plugin-react/pull/1786

the hotfix is just a patch though. I noticed that it's trying to see if the method constructor is deprecated, should probably skip core class methods like this one?

aha, thanks, that did it :-)

thanks for fixing this so quickly!

I'm still seeing this error when using eslint-plugin-react v7.8.2 with eslint v4.19.1, it supposed to have been fixed with v7.8.1. Here's the output I see:

[Error - 17:34:55] ESLint stack trace:
[Error - 17:34:55] TypeError: Cannot read property 'split' of undefined
    at test (.../node_modules/eslint-plugin-react/lib/util/version.js:30:24)
    at Object.testReactVersion (.../node_modules/eslint-plugin-react/lib/util/version.js:39:10)
    at isDeprecated (.../node_modules/eslint-plugin-react/lib/rules/no-deprecated.js:104:21)
    at checkDeprecation (.../node_modules/eslint-plugin-react/lib/rules/no-deprecated.js:109:12)
    at methods.forEach.method (.../node_modules/eslint-plugin-react/lib/rules/no-deprecated.js:162:35)
    at Array.forEach (native)
    at Object.checkLifeCycleMethods (.../node_modules/eslint-plugin-react/lib/rules/no-deprecated.js:162:17)
    at updatedRuleInstructions.(anonymous function) (.../node_modules/eslint-plugin-react/lib/util/Components.js:698:75)
    at listeners.(anonymous function).forEach.listener (.../node_modules/eslint/lib/util/safe-emitter.js:47:58)
    at Array.forEach (native)

I'm getting this one again with

    "eslint": "5.11.1",
    "eslint-plugin-react": "7.12.1",

Setting this in .eslintrc.yaml is my work-around
react/forbid-prop-types: 0

ST:

> node ./node_modules/eslint/bin/eslint.js --ext .js,.jsx .
TypeError: Cannot read property 'split' of undefined
    at Object.isPropWrapperFunction (/project/node_modules/eslint-plugin-react/lib/util/propWrapper.js:12:26)
    at checkNode (/project/node_modules/eslint-plugin-react/lib/rules/forbid-prop-types.js:128:31)
    at MemberExpression (/project/node_modules/eslint-plugin-react/lib/rules/forbid-prop-types.js:158:9)
    at listeners.(anonymous function).forEach.listener (/project/node_modules/eslint/lib/util/safe-emitter.js:45:58)
    at Array.forEach (<anonymous>)
    at Object.emit (/project/node_modules/eslint/lib/util/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (/project/node_modules/eslint/lib/util/node-event-generator.js:251:26)
    at NodeEventGenerator.applySelectors (/project/node_modules/eslint/lib/util/node-event-generator.js:280:22)
    at NodeEventGenerator.enterNode (/project/node_modules/eslint/lib/util/node-event-generator.js:294:14)
    at CodePathAnalyzer.enterNode (/project/node_modules/eslint/lib/code-path-analysis/code-path-analyzer.js:632:23)

@jethrolarson that might be #2104 - can you add your details to that issue?

done

This bug is in 7.12.3. Issue should be re-opened.

@dylanvann instead, a new issue should be filed - but luckily #2131 was filed and fixed already, and will be included in the next release.

@ljharb Awesome, and it has a test too 馃槃 . Thank you for letting me know

Was this page helpful?
0 / 5 - 0 ratings