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

boolean-prop-naming triggers "Cannot read property 'type' of undefined" #1369

Closed
mindtricksdev opened this issue Aug 14, 2017 · 5 comments
Closed
Assignees

Comments

@mindtricksdev
Copy link

Hello,

When I add this rule to my .eslintrc file Visual Studio Code triggers a popup error Cannot read property 'type' of undefined.

This is my rule:
"react/boolean-prop-naming": [1, { "rule": "(^(is|has)[A-Z]([A-Za-z0-9]?)+)|(^[a-z]+(ed|able)$)" }],

I think this is related somehow to the spread operator as the errors trigger when I type ...test

@mindtricksdev mindtricksdev changed the title boolean-prop-naming triggers Cannot read property 'type' of undefined boolean-prop-naming triggers "Cannot read property 'type' of undefined" Aug 14, 2017
@yannickcr
Copy link
Member

Can you show us the full piece of code that trigger the crash ? It will help us to fix the issue.

@mindtricksdev
Copy link
Author

Here's a screenshot:

image

The error is triggered after typing ...x.

Not sure why, but if I disable the boolean rule the error stops occurring.

@EvHaus
Copy link
Collaborator

EvHaus commented Aug 14, 2017

I can reproduce this. Will fix.

@roubaobaozi
Copy link

roubaobaozi commented Sep 27, 2017

Hi, I’m running 7.4.0 and still getting this error:

package.json:
"eslint-plugin-react": "^7.4.0"

eslint is 4.7.2

.eslintrc.js:

"react/boolean-prop-naming": [
    "error",
    { "rule": "^(is|has)[A-Z]([A-Za-z0-9]?)+" }
],

Error:

Cannot read property 'properties' of undefined
TypeError: Cannot read property 'properties' of undefined
    at EventEmitter.MemberExpression (/Users/user/repos/myrepo/node_modules/eslint-plugin-react/lib/rules/boolean-prop-naming.js:183:45)
    at emitOne (events.js:120:20)
    at EventEmitter.emit (events.js:210:7)
    at NodeEventGenerator.applySelector (/Users/user/repos/myrepo/node_modules/eslint/lib/util/node-event-generator.js:265:26)
    at NodeEventGenerator.applySelectors (/Users/user/repos/myrepo/node_modules/eslint/lib/util/node-event-generator.js:294:22)
    at NodeEventGenerator.enterNode (/Users/user/repos/myrepo/node_modules/eslint/lib/util/node-event-generator.js:308:14)
    at CodePathAnalyzer.enterNode (/Users/user/repos/myrepo/node_modules/eslint/lib/code-path-analysis/code-path-analyzer.js:606:23)
    at Traverser.enter (/Users/user/repos/myrepo/node_modules/eslint/lib/linter.js:962:32)
    at Traverser.__execute (/Users/user/repos/myrepo/node_modules/estraverse/estraverse.js:397:31)
    at Traverser.traverse (/Users/user/repos/myrepo/node_modules/estraverse/estraverse.js:501:28)

@ljharb
Copy link
Member

ljharb commented Sep 27, 2017

@setek please file a new issue, and ideally include the code it's crashing on :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

5 participants