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

TypeError: Cannot read property 'value' of null #10372

Closed
FelixVicis opened this issue May 18, 2018 · 9 comments · Fixed by #10379
Closed

TypeError: Cannot read property 'value' of null #10372

FelixVicis opened this issue May 18, 2018 · 9 comments · Fixed by #10379
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly rule Relates to ESLint's core rules

Comments

@FelixVicis
Copy link

Tell us about your environment

  • ESLint Version: v4.15.0
  • Node Version: v8.9.4
  • npm Version: 5.6.0

What parser (default, Babel-ESLint, etc.) are you using?

  • babel-eslint

Please show your full configuration:

Configuration
module.exports = {
	parser: "babel-eslint",
	rules   : {
		'arrow-body-style' : ['warn', 'as-needed'],
	},
};

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

test = () => { return }
./node_modules/.bin/eslint FILE

What did you expect to happen?

Eslint to lint the file

What actually happened? Please include the actual, raw output from ESLint.

Error received TypeError: Cannot read property 'value' of null

Cannot read property 'value' of null
TypeError: Cannot read property 'value' of null
    at Object.isOpeningBraceToken (./node_modules/eslint/lib/ast-utils.js:354:18)
    at validate (./node_modules/eslint/lib/rules/arrow-body-style.js:119:41)
    at listeners.(anonymous function).forEach.listener (./node_modules/eslint/lib/util/safe-emitter.js:47:58)
    at Array.forEach (<anonymous>)
    at Object.emit (./node_modules/eslint/lib/util/safe-emitter.js:47:38)
    at NodeEventGenerator.applySelector (./node_modules/eslint/lib/util/node-event-generator.js:251:26)
    at NodeEventGenerator.applySelectors (./node_modules/eslint/lib/util/node-event-generator.js:280:22)
    at NodeEventGenerator.leaveNode (./node_modules/eslint/lib/util/node-event-generator.js:303:14)
    at CodePathAnalyzer.leaveNode (./node_modules/eslint/lib/code-path-analysis/code-path-analyzer.js:630:23)
    at Traverser.leave [as _leave] (./node_modules/eslint/lib/linter.js:1001:32)
@eslint-deprecated eslint-deprecated bot added the triage An ESLint team member will look at this issue soon label May 18, 2018
@chatcher
Copy link

chatcher commented May 18, 2018

Also occurs with default parser:

echo '() => { return }' > cannot-read-value-of-null.js
 /usr/bin/env eslint --no-eslintrc --parser-options '{"sourceType":"module"}' --rule '{"arrow-body-style":1}' cannot-read-value-of-null.js

@not-an-aardvark
Copy link
Member

Thanks for the report, I can reproduce this issue.

@not-an-aardvark not-an-aardvark added bug ESLint is working incorrectly rule Relates to ESLint's core rules accepted There is consensus among the team that this change meets the criteria for inclusion and removed triage An ESLint team member will look at this issue soon labels May 18, 2018
@sstern6
Copy link
Contributor

sstern6 commented May 19, 2018

@not-an-aardvark mind if i take this one?

@not-an-aardvark
Copy link
Member

Sure!

@not-an-aardvark
Copy link
Member

@sstern6 Actually it looks like a PR was just submitted: #10379

@sstern6
Copy link
Contributor

sstern6 commented May 19, 2018

Yup ill get another one! all good @not-an-aardvark

@josemigallas
Copy link

Getting exactly this error with following:
.eslintrc

{
    "extends": "airbnb",
    "rules": {
        "quotes": ["error", "double"],
        "comma-dangle": ["error", "never"],
        "arrow-parens": ["error", "as-needed"],
        "curly": ["error", "all"],
        "brace-style": ["error", "1tbs"],
        "padded-blocks": ["error", { "classes": "always", "blocks": "never" }],
        "object-curly-newline": [
            "error",
            {
                "ImportDeclaration": { "multiline": true, "minProperties": 3 }
            }
        ],
        "indent": ["error", 4],
        "class-methods-use-this": "off",
        "import/prefer-default-export": "off",
        "react/jsx-filename-extension": "off",
        "react/jsx-one-expression-per-line": "off",
        "react/prop-types": "warn",
        "react/jsx-indent": ["error", 4],
        "react/jsx-indent-props": ["error", "first"],
        "react/button-has-type": "off",
        "react/destructuring-assignment": "warn",
        "jsx-a11y/label-has-for": "off"
    },
    "plugins": ["mocha"],
    "env": {
        "mocha": true,
        "browser": true
    }
}

.babelrc

{
  "presets": ["env", "react"],
  "plugins": ["transform-object-rest-spread"]
}

dependencies

"eslint": "^4.19.1",
"eslint-config-airbnb": "^17.0.0"
"eslint-plugin-import": "^2.13.0"
"eslint-plugin-jsx-a11y": "^6.0.3"
"eslint-plugin-mocha": "^5.0.0"
"eslint-plugin-react": "^7.10.0"

node v8.11.2
npm 6.1.0

@deanwagman
Copy link

In my case, I had a React Component that had a method that was empty. Inside I had a one comment line.

...
doThing = () => {
  // futureFeature
}

return <div onThing={this.doThing} />
...

@not-an-aardvark
Copy link
Member

If this is still happening with the latest version of ESLint, may you please open a new issue? Thanks!

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Nov 18, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Nov 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly rule Relates to ESLint's core rules
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants