Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions client/src/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,32 @@ class FolderTaskProvider {
return undefined;
}
try {
const command = await findEslint(rootPath);

const kind: EslintTaskDefinition = {
type: 'eslint'
};

const options: vscode.ShellExecutionOptions = { cwd: this.workspaceFolder.uri.fsPath };
const config = vscode.workspace.getConfiguration('eslint', this._workspaceFolder.uri);
const lintTaskOptions= config.get<string>('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) || ['.'];
}
}

/**
Expand Down