diff --git a/utils/CHANGELOG.md b/utils/CHANGELOG.md index 619d05063..bb9372512 100644 --- a/utils/CHANGELOG.md +++ b/utils/CHANGELOG.md @@ -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 diff --git a/utils/parse.js b/utils/parse.js index 03022ac40..793e37152 100644 --- a/utils/parse.js +++ b/utils/parse.js @@ -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