Skip to content

Upgrade babel-eslint to resolve template strings bug #3

Open
@cnrudd

Description

A client developer is seeing this eslint error when running yarn lint:

$yarn lint
yarn run v1.22.10
$ yarn lint:js
$ eslint --ext .js,.jsx .
TypeError: Cannot read property 'range' of null
Occurred while linting xyz.jsx:1

The bug is triggered by a template string in a loop preceded by an optional chaining operator. This error prevents teamcity builds from succeeding as well.

The bug is reproduced in this toolbox branch:
https://github.com/xh/toolbox/tree/babel-eslint-bug

This issue is discussed extensively here:
babel/babel-eslint#799

The issue in the project can be resolved by not using an optional chaining operator in that jsx file, but
it might be worth seeing if the issue can be resolved by migrating from
use of
parser: 'babel-eslint',
to
parser: "@babel/eslint-parser"
in this project's (eslint-config) index.js file

as is described here:
https://babeljs.io/blog/2020/07/13/the-state-of-babel-eslint

Activity

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

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions