Skip to content

Commit

Permalink
[utils] [refactor] parse: avoid using a regex here
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Oct 3, 2024
1 parent d225176 commit 3f1ac24
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions utils/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange

## Unreleased

### Changed
- [refactor] `parse`: avoid using a regex here (thanks [@ljharb])

## v2.12.0 - 2024-09-26

### Added
Expand Down
2 changes: 1 addition & 1 deletion utils/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function keysFromParser(parserPath, parserInstance, parsedResult) {
// up with a `parsedResult` here. It also doesn't expose the visitor keys on the parser itself,
// so we have to try and infer the visitor-keys module from the parserPath.
// This is NOT supported in flat config!
if (typeof parserPath === 'string' && (/.*babel-eslint.*/).test(parserPath)) {
if (typeof parserPath === 'string' && parserPath.indexOf('babel-eslint') > -1) {
return getBabelEslintVisitorKeys(parserPath);
}
// The espree parser doesn't have the `parseForESLint` function, so we don't end up with a
Expand Down

0 comments on commit 3f1ac24

Please sign in to comment.