Skip to content

Commit

Permalink
Add warning messages for the packageManager setting
Browse files Browse the repository at this point in the history
  • Loading branch information
William Wilkinson committed May 18, 2023
1 parent 5db8956 commit 14ccd19
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions client/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<PackageManagers>(
'npm.packageManager'
);
const packageManager = await getPackageManager(uri);
const localInstall = {
npm: 'npm install eslint',
pnpm: 'pnpm install eslint',
Expand Down Expand Up @@ -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<PackageManagers>('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 [];
Expand Down

0 comments on commit 14ccd19

Please sign in to comment.