From 14ccd19175b289ea3a666886cfbd16080d15eb45 Mon Sep 17 00:00:00 2001 From: William Wilkinson Date: Thu, 18 May 2023 15:45:29 -0500 Subject: [PATCH] Add warning messages for the `packageManager` setting --- client/src/client.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/client/src/client.ts b/client/src/client.ts index 8c673b3a..9b64f3a6 100644 --- a/client/src/client.ts +++ b/client/src/client.ts @@ -238,9 +238,7 @@ export namespace ESLintClient { const uri: Uri = Uri.parse(params.source.uri); const workspaceFolder = Workspace.getWorkspaceFolder(uri); - const packageManager = await commands.executeCommand( - 'npm.packageManager' - ); + const packageManager = await getPackageManager(uri); const localInstall = { npm: 'npm install eslint', pnpm: 'pnpm install eslint', @@ -584,6 +582,18 @@ export namespace ESLintClient { return clientOptions; } + async function getPackageManager(uri: Uri) { + const userProvidedPackageManager:PackageManagers = Workspace.getConfiguration('eslint', uri).get('packageManager', 'npm'); + const detectedPackageMananger = await commands.executeCommand('npm.packageManager'); + + if (userProvidedPackageManager === detectedPackageMananger) { + client.warn('The ESLint setting packageManager is deprecated, and will be removed in the future. Please update your configuration.', {}, true); + return detectedPackageMananger; + } + client.warn('The ESLint setting packageManager is deprecated, and will be removed in the future. We will honor this setting until it is removed.', {}, true); + return userProvidedPackageManager; + } + async function readConfiguration(params: ConfigurationParams): Promise<(ConfigurationSettings | null)[]> { if (params.items === undefined) { return [];