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 'range' of null with arrow-body-style #12884

Closed
paulschreiber opened this issue Feb 7, 2020 · 1 comment · Fixed by #12886
Closed

TypeError: Cannot read property 'range' of null with arrow-body-style #12884

paulschreiber opened this issue Feb 7, 2020 · 1 comment · Fixed by #12886
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 autofix This change is related to ESLint's autofixing capabilities bug ESLint is working incorrectly rule Relates to ESLint's core rules

Comments

@paulschreiber
Copy link

Tell us about your environment

  • ESLint Version: 6.8.0
  • Node Version: 10.16.3
  • npm Version: 6.13.7

Please show your full configuration:

{
    "parserOptions": {
        "ecmaVersion": 2015
    },
    "rules": {
        "arrow-body-style": ["error", "always"]
    }
}

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

87        parsedYears     = _map(years, (year) => (
88            {
89                index : year,
90                title : splitYear(year)
91            }
92        ));
./node_modules/.bin/eslint src --fix --ext=js --ext=jsx

What did you expect to happen?

The linter ran to completion

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

TypeError: Cannot read property 'range' of null
Occurred while linting /home/paul/src/node_modules/my-parser/soccer.js:87
    at SourceCode.getTokenBefore (/home/paul/node_modules/eslint/lib/source-code/token-store/index.js:298:18)
    at Object.isParenthesised (/home/paul/node_modules/eslint/lib/rules/utils/ast-utils.js:257:38)
    at findClosingParen (/home/paul/node_modules/eslint/lib/rules/arrow-body-style.js:96:30)
    at Object.fix (/home/paul/node_modules/eslint/lib/rules/arrow-body-style.js:225:50)
    at normalizeFixes (/home/paul/node_modules/eslint/lib/linter/report-translator.js:178:28)
    at args (/home/paul/node_modules/eslint/lib/linter/report-translator.js:343:49)
    at Object.report (/home/paul/node_modules/eslint/lib/linter/linter.js:905:41)
    at validate (/home/paul/node_modules/eslint/lib/rules/arrow-body-style.js:202:29)
    at listeners.(anonymous function).forEach.listener (/home/paul/node_modules/eslint/lib/linter/safe-emitter.js:45:58)
    at Array.forEach (<anonymous>)
error Command failed with exit code 2.

Other rules work as expected (arrow-parens, keyword-spacing, indent, etc.)

@paulschreiber paulschreiber added bug ESLint is working incorrectly triage An ESLint team member will look at this issue soon labels Feb 7, 2020
@mdjermanovic mdjermanovic added accepted There is consensus among the team that this change meets the criteria for inclusion rule Relates to ESLint's core rules and removed triage An ESLint team member will look at this issue soon labels Feb 7, 2020
@mdjermanovic
Copy link
Member

Hi @paulschreiber, thanks for the bug report!

Confirmed in our Online Demo, working on this.

@mdjermanovic mdjermanovic added the autofix This change is related to ESLint's autofixing capabilities label Feb 8, 2020
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Aug 28, 2020
@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 Aug 28, 2020
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 autofix This change is related to ESLint's autofixing capabilities 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.

2 participants