Skip to content

Fix A Crash #187

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

Merged
merged 1 commit into from
Aug 13, 2015
Merged

Fix A Crash #187

merged 1 commit into from
Aug 13, 2015

Conversation

xjamundx
Copy link
Contributor

In standard (latest master) when I enable experimentalObjectRestSpread in eslint. We run into this issue when using eslint 1.1.0 and eslint-plugin-react 3.2.1.

~/dev/standard (master) $ node bin/cmd.js test.js
standard: Unexpected linter output:

TypeError: Cannot read property 'type' of undefined
    at isPropTypesDeclaration (/Users/jamuferguson/dev/standard/node_modules/eslint-plugin-react/lib/rules/prop-types.js:49:13)
    at /Users/jamuferguson/dev/standard/node_modules/eslint-plugin-react/lib/rules/prop-types.js:589:14
    at Array.forEach (native)
    at EventEmitter.ObjectExpression (/Users/jamuferguson/dev/standard/node_modules/eslint-plugin-react/lib/rules/prop-types.js:588:23)
    at EventEmitter.emit (events.js:129:20)
    at Controller.controller.traverse.enter (/Users/jamuferguson/dev/standard/node_modules/eslint/lib/eslint.js:824:25)
    at Controller.__execute (/Users/jamuferguson/dev/standard/node_modules/estraverse/estraverse.js:397:31)
    at Controller.traverse (/Users/jamuferguson/dev/standard/node_modules/estraverse/estraverse.js:495:28)
    at EventEmitter.module.exports.api.verify (/Users/jamuferguson/dev/standard/node_modules/eslint/lib/eslint.js:817:24)
    at processText (/Users/jamuferguson/dev/standard/node_modules/eslint/lib/cli-engine.js:199:27)

By all means tell me to file an issue first or whatever the correct approach is :)

By the way the code that caused the crash was the following:

// rest params
let { a, ...b } = obj

// object spread
let c = { ...d };

In standard (latest `master`) when I enable `experimentalObjectRestSpread` in eslint. We run into this issue when using eslint 1.1.0 and eslint-plugin-react 3.2.1.


```js
~/dev/standard (master) $ node bin/cmd.js test.js
standard: Unexpected linter output:

TypeError: Cannot read property 'type' of undefined
    at isPropTypesDeclaration (/Users/jamuferguson/dev/standard/node_modules/eslint-plugin-react/lib/rules/prop-types.js:49:13)
    at /Users/jamuferguson/dev/standard/node_modules/eslint-plugin-react/lib/rules/prop-types.js:589:14
    at Array.forEach (native)
    at EventEmitter.ObjectExpression (/Users/jamuferguson/dev/standard/node_modules/eslint-plugin-react/lib/rules/prop-types.js:588:23)
    at EventEmitter.emit (events.js:129:20)
    at Controller.controller.traverse.enter (/Users/jamuferguson/dev/standard/node_modules/eslint/lib/eslint.js:824:25)
    at Controller.__execute (/Users/jamuferguson/dev/standard/node_modules/estraverse/estraverse.js:397:31)
    at Controller.traverse (/Users/jamuferguson/dev/standard/node_modules/estraverse/estraverse.js:495:28)
    at EventEmitter.module.exports.api.verify (/Users/jamuferguson/dev/standard/node_modules/eslint/lib/eslint.js:817:24)
    at processText (/Users/jamuferguson/dev/standard/node_modules/eslint/lib/cli-engine.js:199:27)
```

By all means tell me to file an issue first or whatever the correct approach is :)
@yannickcr
Copy link
Member

Thanks for the quick fix. Can you add a test in the test suite to validate the fix?

@feross
Copy link

feross commented Aug 13, 2015

Let's get this merged!

@yannickcr yannickcr merged commit 93cbbe7 into jsx-eslint:master Aug 13, 2015
@xjamundx
Copy link
Contributor Author

Sorry for the lack of test!

@xjamundx xjamundx deleted the patch-1 branch August 13, 2015 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants