diff --git a/common/changes/@rushstack/eslint-config/user-danade-EslintResolverTweaks2_2023-09-25-23-36.json b/common/changes/@rushstack/eslint-config/user-danade-EslintResolverTweaks2_2023-09-25-23-36.json index 2852448fe04..03de21cff45 100644 --- a/common/changes/@rushstack/eslint-config/user-danade-EslintResolverTweaks2_2023-09-25-23-36.json +++ b/common/changes/@rushstack/eslint-config/user-danade-EslintResolverTweaks2_2023-09-25-23-36.json @@ -2,7 +2,7 @@ "changes": [ { "packageName": "@rushstack/eslint-config", - "comment": "Adds an optional patch which can be used to allow ESLint to extend configurations from packages that do not have the \"eslint-config-\" prefix", + "comment": "Add an optional patch which can be used to allow ESLint to extend configurations from packages that do not have the \"eslint-config-\" prefix", "type": "minor" } ], diff --git a/common/changes/@rushstack/eslint-patch/user-danade-EslintResolverTweaks2_2023-09-25-23-36.json b/common/changes/@rushstack/eslint-patch/user-danade-EslintResolverTweaks2_2023-09-25-23-36.json index 89a160af8bb..890044c31e4 100644 --- a/common/changes/@rushstack/eslint-patch/user-danade-EslintResolverTweaks2_2023-09-25-23-36.json +++ b/common/changes/@rushstack/eslint-patch/user-danade-EslintResolverTweaks2_2023-09-25-23-36.json @@ -2,7 +2,7 @@ "changes": [ { "packageName": "@rushstack/eslint-patch", - "comment": "Adds an optional patch which can be used to allow ESLint to extend configurations from packages that do not have the \"eslint-config-\" prefix", + "comment": "Add an optional patch which can be used to allow ESLint to extend configurations from packages that do not have the \"eslint-config-\" prefix", "type": "minor" } ], diff --git a/common/changes/@rushstack/heft-node-rig/user-danade-EslintResolverTweaks2_2023-09-25-23-36.json b/common/changes/@rushstack/heft-node-rig/user-danade-EslintResolverTweaks2_2023-09-25-23-36.json index 89c27565361..4e93a3e8d46 100644 --- a/common/changes/@rushstack/heft-node-rig/user-danade-EslintResolverTweaks2_2023-09-25-23-36.json +++ b/common/changes/@rushstack/heft-node-rig/user-danade-EslintResolverTweaks2_2023-09-25-23-36.json @@ -2,7 +2,7 @@ "changes": [ { "packageName": "@rushstack/heft-node-rig", - "comment": "Adds an optional patch which can be used to allow ESLint to extend configurations from packages that do not have the \"eslint-config-\" prefix. This change also includes the ESLint configurations sourced from \"@rushstack/eslint-config\"", + "comment": "Add an optional patch which can be used to allow ESLint to extend configurations from packages that do not have the \"eslint-config-\" prefix. This change also includes the ESLint configurations sourced from \"@rushstack/eslint-config\"", "type": "minor" } ], diff --git a/common/changes/@rushstack/heft-web-rig/user-danade-EslintResolverTweaks2_2023-09-25-23-36.json b/common/changes/@rushstack/heft-web-rig/user-danade-EslintResolverTweaks2_2023-09-25-23-36.json index 38222140e6e..62a115a6174 100644 --- a/common/changes/@rushstack/heft-web-rig/user-danade-EslintResolverTweaks2_2023-09-25-23-36.json +++ b/common/changes/@rushstack/heft-web-rig/user-danade-EslintResolverTweaks2_2023-09-25-23-36.json @@ -2,7 +2,7 @@ "changes": [ { "packageName": "@rushstack/heft-web-rig", - "comment": "Adds an optional patch which can be used to allow ESLint to extend configurations from packages that do not have the \"eslint-config-\" prefix. This chang", + "comment": "Add an optional patch which can be used to allow ESLint to extend configurations from packages that do not have the \"eslint-config-\" prefix. This change also includes the ESLint configurations sourced from \"@rushstack/eslint-config\"", "type": "minor" } ], diff --git a/eslint/eslint-patch/src/_patch-base.ts b/eslint/eslint-patch/src/_patch-base.ts index b2b533bc14e..12792ee016b 100644 --- a/eslint/eslint-patch/src/_patch-base.ts +++ b/eslint/eslint-patch/src/_patch-base.ts @@ -108,8 +108,8 @@ if (!eslintFolder) { ); if (resolvedConfigArrayFactoryPath === currentModule.filename) { configArrayFactoryPath = resolvedConfigArrayFactoryPath; - moduleResolverPath = path.join(eslintrcFolder, 'lib/shared/relative-module-resolver'); - namingPath = path.join(eslintrcFolder, 'lib/shared/naming'); + moduleResolverPath = `${eslintrcFolder}/lib/shared/relative-module-resolver`; + namingPath = `${eslintrcFolder}/lib/shared/naming`; } } catch (ex: unknown) { // Module resolution failures are expected, as we're walking @@ -157,9 +157,9 @@ if (!eslintFolder) { // .../eslint/lib/cli-engine/config-array-factory.js if (/[\\/]eslint[\\/]lib[\\/]cli-engine[\\/]config-array-factory\.js$/i.test(currentModule.filename)) { eslintFolder = path.join(path.dirname(currentModule.filename), '../..'); - configArrayFactoryPath = path.join(eslintFolder, 'lib/cli-engine/config-array-factory'); - moduleResolverPath = path.join(eslintFolder, 'lib/shared/relative-module-resolver'); - namingPath = path.join(eslintFolder, 'lib/shared/naming'); + configArrayFactoryPath = `${eslintFolder}/lib/cli-engine/config-array-factory`; + moduleResolverPath = `${eslintFolder}/lib/shared/relative-module-resolver`; + namingPath = `${eslintFolder}/lib/shared/naming`; break; } @@ -176,10 +176,10 @@ if (!eslintFolder) { } // Detect the ESLint package version -const eslintPackageJson = fs.readFileSync(path.join(eslintFolder, 'package.json')).toString(); +const eslintPackageJson = fs.readFileSync(`${eslintFolder}/package.json`).toString(); const eslintPackageObject = JSON.parse(eslintPackageJson); const eslintPackageVersion = eslintPackageObject.version; -const versionMatch = /^([0-9]+)\./.exec(eslintPackageVersion); // parse the SemVer MAJOR part +const versionMatch = parseInt(eslintPackageVersion, 10); if (!versionMatch) { throw new Error('Unable to parse ESLint version: ' + eslintPackageVersion); } diff --git a/eslint/eslint-patch/src/modern-module-resolution.ts b/eslint/eslint-patch/src/modern-module-resolution.ts index f1c3d8b9905..e411aa71574 100644 --- a/eslint/eslint-patch/src/modern-module-resolution.ts +++ b/eslint/eslint-patch/src/modern-module-resolution.ts @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. // See LICENSE in the project root for license information. + // This is a workaround for https://github.com/eslint/eslint/issues/3458 // // To correct how ESLint searches for plugin packages, add this line to the top of your project's .eslintrc.js file: