Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Error: Cannot read property 'type' of null #702

Closed
glennreyes opened this issue Sep 14, 2016 · 9 comments
Closed

Error: Cannot read property 'type' of null #702

glennreyes opened this issue Sep 14, 2016 · 9 comments

Comments

@glennreyes
Copy link

Getting following notification while typing:
sep -14-2016 10-18-03 pm

Thats the full message:

TypeError: Cannot read property 'type' of null
    at EventEmitter.JSXAttribute (/Users/glennreyes/Projects/femcare/node_modules/eslint-plugin-react/lib/rules/style-prop-object.js:70:21)
    at emitOne (events.js:95:20)
    at EventEmitter.emit (events.js:182:7)
    at NodeEventGenerator.enterNode (/Users/glennreyes/Projects/femcare/node_modules/eslint/lib/util/node-event-generator.js:40:22)
    at CodePathAnalyzer.enterNode (/Users/glennreyes/Projects/femcare/node_modules/eslint/lib/code-path-analysis/code-path-analyzer.js:608:23)
    at CommentEventGenerator.enterNode (/Users/glennreyes/Projects/femcare/node_modules/eslint/lib/util/comment-event-generator.js:97:23)
    at Controller.enter (/Users/glennreyes/Projects/femcare/node_modules/eslint/lib/eslint.js:918:36)
    at Controller.__execute (/Users/glennreyes/Projects/femcare/node_modules/estraverse/estraverse.js:397:31)
    at Controller.traverse (/Users/glennreyes/Projects/femcare/node_modules/estraverse/estraverse.js:501:28)
    at Controller.Traverser.controller.traverse (/Users/glennreyes/Projects/femcare/node_modules/eslint/lib/util/traverser.js:36:33)
    at EventEmitter.module.exports.api.verify (/Users/glennreyes/Projects/femcare/node_modules/eslint/lib/eslint.js:915:23)
    at processText (/Users/glennreyes/Projects/femcare/node_modules/eslint/lib/cli-engine.js:262:31)
    at CLIEngine.executeOnText (/Users/glennreyes/Projects/femcare/node_modules/eslint/lib/cli-engine.js:749:26)
    at Object.execute (/Users/glennreyes/Projects/femcare/node_modules/eslint/lib/cli.js:174:42)
    at lintJob (/Users/glennreyes/.atom/packages/linter-eslint/lib/worker.js:37:10)
    at /Users/glennreyes/.atom/packages/linter-eslint/lib/worker.js:71:20

Not sure if it is an issue for this or eslint-plugin-react.

Appreciate your work and support! 🙌

@Arcanemagus
Copy link
Member

Definitely a bug in eslint-plugin-react, it looks like it was when the content of that line was just <div style> that triggered it.

@Arcanemagus
Copy link
Member

Interesting, I can reproduce your error in Atom, but it doesn't show anything on the CLI. Looking into this more.

@Arcanemagus
Copy link
Member

Nevermind, had copied a package.json from a reproduction of a different bug report that named the file foo.js and forgot to update the script. I see this on the CLI as well so it's definitely a bug in eslint-plugin-react.

I used the following files to reproduce this: linter-eslint_GH702.zip

Running npm run lint in that directory shows the following:
image

Do you want to file a bug over there referencing this?

@glennreyes
Copy link
Author

These are the versions I was using

"eslint": "^3.5.0",
"eslint-config-airbnb": "^11.1.0",
"eslint-plugin-import": "^1.15.0",
"eslint-plugin-jsx-a11y": "^2.2.2",
"eslint-plugin-react": "^6.2.1",

linter-eslint is at 7.3.1

@Arcanemagus
Copy link
Member

Minimal test case: linter-eslint_GH702.zip

Turns out just this is enough to trigger it:

'use strict';

const foo = (
  <div style></div>
);

@glennreyes
Copy link
Author

@Arcanemagus
Copy link
Member

Oh, those are all just related to the react/require-extension rule that eslint-config-airbnb uses (You didn't post your config, so I guessed that's what you were using). That's just a deprecation warning and isn't relevant here.

Your comment did remind me to minimize the rule set as well, turns out it's just the react/style-prop-object rule that is crashing here. I'll go ahead and file a bug on this over there.

@Arcanemagus
Copy link
Member

Filed the above bug, marking this as closed since the bug isn't related to linter-eslint, follow that issue for any updates 😉.

@Arcanemagus
Copy link
Member

Looks like the next release of eslint-plugin-react should fix this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants