Skip to content

Commit 3f1ac24

Browse files
committed
[utils] [refactor] parse: avoid using a regex here
1 parent d225176 commit 3f1ac24

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

utils/CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
55

66
## Unreleased
77

8+
### Changed
9+
- [refactor] `parse`: avoid using a regex here (thanks [@ljharb])
10+
811
## v2.12.0 - 2024-09-26
912

1013
### Added

utils/parse.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function keysFromParser(parserPath, parserInstance, parsedResult) {
3333
// up with a `parsedResult` here. It also doesn't expose the visitor keys on the parser itself,
3434
// so we have to try and infer the visitor-keys module from the parserPath.
3535
// This is NOT supported in flat config!
36-
if (typeof parserPath === 'string' && (/.*babel-eslint.*/).test(parserPath)) {
36+
if (typeof parserPath === 'string' && parserPath.indexOf('babel-eslint') > -1) {
3737
return getBabelEslintVisitorKeys(parserPath);
3838
}
3939
// The espree parser doesn't have the `parseForESLint` function, so we don't end up with a

0 commit comments

Comments
 (0)