babel / babel-eslint

:tokyo_tower: A wrapper for Babel's parser used for ESLint (renamed to @babel/eslint-parser)

Home Page:https://github.com/babel/babel/tree/main/eslint/babel-eslint-parser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`RegExpLiteral` is not converted to `Literal` in an edge case

futpib opened this issue · comments

Broken example:

> require('babel-eslint').parse('1 * /a/').body[0].expression.right.type
'RegExpLiteral'

Changing * to + makes babel-eslint behave properly:

> require('babel-eslint').parse('1 + /a/').body[0].expression.right.type
'Literal'

Version:

$ npm list babel-eslint
eslint-template-visitor@2.1.1 /home/futpib/code/eslint-template-visitor
└── babel-eslint@10.1.0

Of course no one writes x * /a/, but this bug breaks my fuzzing test.

Thanks for the bug report. babel-eslint is currently being moved into the babel/babel monorepo. You can follow along on this issue. I'll be adding this to the list in that issue and take a look at it.

Thank you for the PR. Now that @babel/eslint-parser has been released, we are making this repository read-only. If this is a change you would still like to advocate for, please reopen this in the babel/babel monorepo.