Fixed tsfmt and eslint errors.

This commit is contained in:
vsrs 2020-04-30 18:41:48 +03:00
parent eb6f9c23e1
commit 10836543d6
2 changed files with 19 additions and 19 deletions

View File

@ -21,24 +21,24 @@ export class Cargo {
}
public async artifactsFromArgs(cargoArgs: string[]): Promise<CompilationArtifact[]> {
let artifacts: CompilationArtifact[] = [];
const artifacts: CompilationArtifact[] = [];
try {
await this.runCargo(cargoArgs,
message => {
if (message.reason == 'compiler-artifact' && message.executable) {
let isBinary = message.target.crate_types.includes('bin');
let isBuildScript = message.target.kind.includes('custom-build');
if (message.reason === 'compiler-artifact' && message.executable) {
const isBinary = message.target.crate_types.includes('bin');
const isBuildScript = message.target.kind.includes('custom-build');
if ((isBinary && !isBuildScript) || message.profile.test) {
artifacts.push({
fileName: message.executable,
name: message.target.name,
kind: message.target.kind[0],
isTest: message.profile.test
})
});
}
}
else if( message.reason == 'compiler-message') {
else if (message.reason === 'compiler-message') {
this.output.append(message.message.rendered);
}
},
@ -62,9 +62,9 @@ export class Cargo {
cargoArgs.push(...extraArgs);
}
let artifacts = await this.artifactsFromArgs(cargoArgs);
const artifacts = await this.artifactsFromArgs(cargoArgs);
if (artifacts.length == 0 ) {
if (artifacts.length === 0) {
throw new Error('No compilation artifacts');
} else if (artifacts.length > 1) {
throw new Error('Multiple compilation artifacts are not supported.');
@ -79,7 +79,7 @@ export class Cargo {
onStderrString: (data: string) => void
): Promise<number> {
return new Promise<number>((resolve, reject) => {
let cargo = cp.spawn('cargo', cargoArgs, {
const cargo = cp.spawn('cargo', cargoArgs, {
stdio: ['ignore', 'pipe', 'pipe'],
cwd: this.rootFolder,
env: this.env,
@ -92,14 +92,14 @@ export class Cargo {
onStderrString(chunk.toString());
});
let rl = readline.createInterface({ input: cargo.stdout });
const rl = readline.createInterface({ input: cargo.stdout });
rl.on('line', line => {
let message = JSON.parse(line);
const message = JSON.parse(line);
onStdoutJson(message);
});
cargo.on('exit', (exitCode, _) => {
if (exitCode == 0)
if (exitCode === 0)
resolve(exitCode);
else
reject(new Error(`exit code: ${exitCode}.`));

View File

@ -82,9 +82,9 @@ const debugOutput = vscode.window.createOutputChannel("Debug");
async function getCppvsDebugConfig(config: ra.Runnable, sourceFileMap: Record<string, string>): Promise<vscode.DebugConfiguration> {
debugOutput.clear();
let cargo = new Cargo(config.cwd || '.', debugOutput);
let executable = await cargo.executableFromArgs(config.args, config.extraArgs);
const cargo = new Cargo(config.cwd || '.', debugOutput);
const executable = await cargo.executableFromArgs(config.args, config.extraArgs);
// if we are here, there were no compilation errors.
return {
@ -106,9 +106,9 @@ export function debugSingle(ctx: Ctx): Cmd {
const lldbId = "vadimcn.vscode-lldb";
const cpptoolsId = "ms-vscode.cpptools";
let debugEngineId = ctx.config.debug.engine;
const debugEngineId = ctx.config.debug.engine;
let debugEngine = null;
if ( debugEngineId === "auto" ) {
if (debugEngineId === "auto") {
debugEngine = vscode.extensions.getExtension(lldbId);
if (!debugEngine) {
debugEngine = vscode.extensions.getExtension(cpptoolsId);
@ -120,11 +120,11 @@ export function debugSingle(ctx: Ctx): Cmd {
if (!debugEngine) {
vscode.window.showErrorMessage(`Install [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=${lldbId})`
+ ` or [MS C++ tools](https://marketplace.visualstudio.com/items?itemName=${cpptoolsId}) extension for debugging.`);
+ ` or [MS C++ tools](https://marketplace.visualstudio.com/items?itemName=${cpptoolsId}) extension for debugging.`);
return;
}
const debugConfig = lldbId == debugEngine.id
const debugConfig = lldbId === debugEngine.id
? getLldbDebugConfig(config, ctx.config.debug.sourceFileMap)
: await getCppvsDebugConfig(config, ctx.config.debug.sourceFileMap);