Skip to content

Commit abf41e4

Browse files
committed
Correct additional lint issues detected by ESLint.
The set of ESLint rules will be configured according to the recommended ESLint rules, with exceptions added to mimic as closely as possible the current set of TSLint rules that were explicitly disabled. The expectation is that the project will move towards using the recommended rules without exceptions. Prior to performing the switch-over to using ESLint, corrections are being performed that would otherwise be flagged by ESLint.
1 parent 8420b1a commit abf41e4

File tree

9 files changed

+68
-66
lines changed

9 files changed

+68
-66
lines changed

src/backend/backend.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export class VariableObject {
103103

104104
public applyChanges(node: MINode) {
105105
this.value = MINode.valueOf(node, "value");
106-
if (!!MINode.valueOf(node, "type_changed")) {
106+
if (MINode.valueOf(node, "type_changed")) {
107107
this.type = MINode.valueOf(node, "new_type");
108108
}
109109
this.dynamic = !!MINode.valueOf(node, "dynamic");

src/backend/gdb_expansion.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export function expandValue(variableCreate: Function, value: string, root: strin
115115
values.push(createValue("[0]", val));
116116
const remaining = value;
117117
let i = 0;
118-
while (true) {
118+
for (;;) {
119119
stack.push("[" + (++i) + "]");
120120
if (!(val = parseCommaValue())) {
121121
stack.pop();

src/backend/mi2/mi2.ts

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export class MI2 extends EventEmitter implements IBackend {
3838
// Overwrite with user specified variables
3939
for (const key in procEnv) {
4040
if (procEnv.hasOwnProperty(key)) {
41-
if (procEnv === null)
41+
if (procEnv === undefined)
4242
delete env[key];
4343
else
4444
env[key] = procEnv[key];
@@ -120,8 +120,8 @@ export class MI2 extends EventEmitter implements IBackend {
120120
if (args.useAgent) {
121121
connectionArgs.agent = process.env.SSH_AUTH_SOCK;
122122
} else if (args.keyfile) {
123-
if (require("fs").existsSync(args.keyfile))
124-
connectionArgs.privateKey = require("fs").readFileSync(args.keyfile);
123+
if (fs.existsSync(args.keyfile))
124+
connectionArgs.privateKey = fs.readFileSync(args.keyfile);
125125
else {
126126
this.log("stderr", "SSH key file does not exist!");
127127
this.emit("quit");
@@ -365,54 +365,54 @@ export class MI2 extends EventEmitter implements IBackend {
365365
if (trace)
366366
this.log("stderr", "stop: " + reason);
367367
switch (reason) {
368-
case "breakpoint-hit":
369-
this.emit("breakpoint", parsed);
370-
break;
371-
case "watchpoint-trigger":
372-
case "read-watchpoint-trigger":
373-
case "access-watchpoint-trigger":
374-
this.emit("watchpoint", parsed);
375-
break;
376-
case "function-finished":
368+
case "breakpoint-hit":
369+
this.emit("breakpoint", parsed);
370+
break;
371+
case "watchpoint-trigger":
372+
case "read-watchpoint-trigger":
373+
case "access-watchpoint-trigger":
374+
this.emit("watchpoint", parsed);
375+
break;
376+
case "function-finished":
377377
// identical result → send step-end
378378
// this.emit("step-out-end", parsed);
379379
// break;
380-
case "location-reached":
381-
case "end-stepping-range":
382-
this.emit("step-end", parsed);
383-
break;
384-
case "watchpoint-scope":
385-
case "solib-event":
386-
case "syscall-entry":
387-
case "syscall-return":
380+
case "location-reached":
381+
case "end-stepping-range":
382+
this.emit("step-end", parsed);
383+
break;
384+
case "watchpoint-scope":
385+
case "solib-event":
386+
case "syscall-entry":
387+
case "syscall-return":
388388
// TODO: inform the user
389-
this.emit("step-end", parsed);
390-
break;
391-
case "fork":
392-
case "vfork":
393-
case "exec":
389+
this.emit("step-end", parsed);
390+
break;
391+
case "fork":
392+
case "vfork":
393+
case "exec":
394394
// TODO: inform the user, possibly add second inferior
395-
this.emit("step-end", parsed);
396-
break;
397-
case "signal-received":
398-
this.emit("signal-stop", parsed);
399-
break;
400-
case "exited-normally":
401-
this.emit("exited-normally", parsed);
402-
break;
403-
case "exited": // exit with error code != 0
404-
this.log("stderr", "Program exited with code " + parsed.record("exit-code"));
405-
this.emit("exited-normally", parsed);
406-
break;
407-
// case "exited-signalled": // consider handling that explicit possible
408-
// this.log("stderr", "Program exited because of signal " + parsed.record("signal"));
409-
// this.emit("stopped", parsed);
410-
// break;
411-
412-
default:
413-
this.log("console", "Not implemented stop reason (assuming exception): " + reason);
414-
this.emit("stopped", parsed);
415-
break;
395+
this.emit("step-end", parsed);
396+
break;
397+
case "signal-received":
398+
this.emit("signal-stop", parsed);
399+
break;
400+
case "exited-normally":
401+
this.emit("exited-normally", parsed);
402+
break;
403+
case "exited": // exit with error code != 0
404+
this.log("stderr", "Program exited with code " + parsed.record("exit-code"));
405+
this.emit("exited-normally", parsed);
406+
break;
407+
// case "exited-signalled": // consider handling that explicit possible
408+
// this.log("stderr", "Program exited because of signal " + parsed.record("signal"));
409+
// this.emit("stopped", parsed);
410+
// break;
411+
412+
default:
413+
this.log("console", "Not implemented stop reason (assuming exception): " + reason);
414+
this.emit("stopped", parsed);
415+
break;
416416
}
417417
}
418418
} else

src/backend/mi_parse.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ export class MINode implements MIInfo {
114114
if (current.length && typeof current != "string" && i >= 0 && i < current.length) {
115115
current = current[i];
116116
} else if (i == 0) {
117+
// empty
117118
} else return undefined;
118119
} else return undefined;
119120
}

src/gdb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class GDBDebugSession extends MI2DebugSession {
107107
this.initDebugger();
108108
this.quit = false;
109109
this.attached = !args.remote;
110-
this.initialRunCommand = !!args.stopAtConnect ? RunCommand.NONE : RunCommand.CONTINUE;
110+
this.initialRunCommand = args.stopAtConnect ? RunCommand.NONE : RunCommand.CONTINUE;
111111
this.isSSH = false;
112112
this.setValuesFormattingMode(args.valuesFormatting);
113113
this.miDebugger.printCalls = !!args.printCalls;

src/lldb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class LLDBDebugSession extends MI2DebugSession {
9898
this.initDebugger();
9999
this.quit = false;
100100
this.attached = true;
101-
this.initialRunCommand = !!args.stopAtConnect ? RunCommand.NONE : RunCommand.CONTINUE;
101+
this.initialRunCommand = args.stopAtConnect ? RunCommand.NONE : RunCommand.CONTINUE;
102102
this.isSSH = false;
103103
this.setValuesFormattingMode(args.valuesFormatting);
104104
this.miDebugger.printCalls = !!args.printCalls;

src/mago.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class MagoDebugSession extends MI2DebugSession {
7575
this.initDebugger();
7676
this.quit = false;
7777
this.attached = true;
78-
this.initialRunCommand = !!args.stopAtConnect ? RunCommand.NONE : RunCommand.CONTINUE;
78+
this.initialRunCommand = args.stopAtConnect ? RunCommand.NONE : RunCommand.CONTINUE;
7979
this.isSSH = false;
8080
this.setValuesFormattingMode(args.valuesFormatting);
8181
this.miDebugger.printCalls = !!args.printCalls;

src/mibase.ts

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ export class MI2DebugSession extends DebugSession {
159159

160160
if (this.serverPath)
161161
fs.unlink(this.serverPath, (err) => {
162-
// tslint:disable-next-line: no-console
162+
// eslint-disable-next-line no-console
163163
console.error("Failed to unlink debug server");
164164
});
165165
}
@@ -263,17 +263,17 @@ export class MI2DebugSession extends DebugSession {
263263
return;
264264
}
265265
this.miDebugger.getThreads().then(threads => {
266-
response.body = {
267-
threads: []
268-
};
269-
for (const thread of threads) {
270-
const threadName = thread.name || thread.targetId || "<unnamed>";
271-
response.body.threads.push(new Thread(thread.id, thread.id + ":" + threadName));
272-
}
273-
this.sendResponse(response);
274-
}).catch(error => {
275-
this.sendErrorResponse(response, 17, `Could not get threads: ${error}`);
276-
});
266+
response.body = {
267+
threads: []
268+
};
269+
for (const thread of threads) {
270+
const threadName = thread.name || thread.targetId || "<unnamed>";
271+
response.body.threads.push(new Thread(thread.id, thread.id + ":" + threadName));
272+
}
273+
this.sendResponse(response);
274+
}).catch(error => {
275+
this.sendErrorResponse(response, 17, `Could not get threads: ${error}`);
276+
});
277277
}
278278

279279
// Supports 65535 threads.
@@ -366,7 +366,7 @@ export class MI2DebugSession extends DebugSession {
366366
this.handlePause(undefined);
367367
}));
368368
break;
369-
case RunCommand.NONE:
369+
case RunCommand.NONE: {
370370
// Not all debuggers seem to provide an out-of-band status that they are stopped
371371
// when attaching (e.g., lldb), so the client assumes we are running and gets
372372
// confused when we don't actually run or continue. Therefore, we'll force a
@@ -376,6 +376,7 @@ export class MI2DebugSession extends DebugSession {
376376
event.body.allThreadsStopped = true;
377377
this.sendEvent(event);
378378
break;
379+
}
379380
default:
380381
throw new Error('Unhandled run command: ' + RunCommand[this.initialRunCommand]);
381382
}

src/test/runTest.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
/* eslint-disable no-console */
12
import * as path from 'path';
23

34
import { runTests } from 'vscode-test';
4-
// tslint:disable: no-console
55

66
async function main() {
77
try {
8-
// The folder containing the Extension Manifest package.json
8+
// The folder containing the Extension Manifest package.json
99
// Passed to `--extensionDevelopmentPath`
1010
const extensionDevelopmentPath = path.resolve(__dirname, '../../');
1111

0 commit comments

Comments
 (0)