From 35ed0a58bc557403025aa89c04f86a50c02bf0cf Mon Sep 17 00:00:00 2001 From: Micah Rairdon Date: Wed, 12 Jun 2024 17:20:19 -0400 Subject: [PATCH] Added support for workingDirectories --- client/src/tasks.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/client/src/tasks.ts b/client/src/tasks.ts index f8dd508f..d4b348ef 100644 --- a/client/src/tasks.ts +++ b/client/src/tasks.ts @@ -40,8 +40,6 @@ class FolderTaskProvider { return undefined; } try { - const command = await findEslint(rootPath); - const kind: EslintTaskDefinition = { type: 'eslint' }; @@ -49,15 +47,25 @@ class FolderTaskProvider { const options: vscode.ShellExecutionOptions = { cwd: this.workspaceFolder.uri.fsPath }; const config = vscode.workspace.getConfiguration('eslint', this._workspaceFolder.uri); const lintTaskOptions= config.get('lintTask.options', '.'); + + const eslintCommands: string[] = []; + for (const workingDirectory of this.workingDirectories()) { + const eslint = await findEslint(workingDirectory); + eslintCommands.push(`pushd ${workingDirectory} && ${eslint} ${lintTaskOptions} && popd`); + } return new vscode.Task( kind, this.workspaceFolder, - 'lint whole folder', 'eslint', new vscode.ShellExecution(`${command} ${lintTaskOptions}`, options), + 'lint whole folder', 'eslint', new vscode.ShellExecution(eslintCommands.join(' && '), options), '$eslint-stylish' ); } catch (error) { return undefined; } } + + private workingDirectories() : string []{ + return vscode.workspace.getConfiguration('eslint', this._workspaceFolder.uri).get('workingDirectories', undefined) || ['.']; + } } /**