Skip to content

Commit 57afc83

Browse files
authored
Merge pull request #150 from simark/tslint
Enable tslint with basic rules
2 parents 9b97ee8 + b4d5392 commit 57afc83

File tree

15 files changed

+251
-198
lines changed

15 files changed

+251
-198
lines changed

package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -926,10 +926,12 @@
926926
"ssh2": "^0.5.4"
927927
},
928928
"devDependencies": {
929-
"typescript": "^2.1.6",
930-
"vscode": "^1.0.3",
931-
"mocha": "^3.2.0",
929+
"@types/mocha": "^2.2.39",
932930
"@types/node": "^7.0.5",
933-
"@types/mocha": "^2.2.39"
931+
"mocha": "^3.2.0",
932+
"tslint": "^5.11.0",
933+
"tslint-language-service": "^0.9.9",
934+
"typescript": "^2.1.6",
935+
"vscode": "^1.0.3"
934936
}
935937
}

src/backend/backend.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export class VariableObject {
117117
}
118118

119119
public toProtocolVariable(): DebugProtocol.Variable {
120-
let res: DebugProtocol.Variable = {
120+
const res: DebugProtocol.Variable = {
121121
name: this.exp,
122122
evaluateName: this.name,
123123
value: (this.value === void 0) ? "<unknown>" : this.value,

src/backend/gdb_expansion.ts

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ const numberRegex = /^\d+(\.\d+)?/;
1212
const pointerCombineChar = ".";
1313

1414
export function isExpandable(value: string): number {
15-
let primitive: any;
1615
let match;
1716
value = value.trim();
1817
if (value.length == 0) return 0;
@@ -31,13 +30,13 @@ export function isExpandable(value: string): number {
3130
}
3231

3332
export function expandValue(variableCreate: Function, value: string, root: string = "", extra: any = undefined): any {
34-
let parseCString = () => {
33+
const parseCString = () => {
3534
value = value.trim();
3635
if (value[0] != '"' && value[0] != '\'')
3736
return "";
3837
let stringEnd = 1;
3938
let inString = true;
40-
let charStr = value[0];
39+
const charStr = value[0];
4140
let remaining = value.substr(1);
4241
let escaped = false;
4342
while (inString) {
@@ -51,16 +50,16 @@ export function expandValue(variableCreate: Function, value: string, root: strin
5150
remaining = remaining.substr(1);
5251
stringEnd++;
5352
}
54-
let str = value.substr(0, stringEnd).trim();
53+
const str = value.substr(0, stringEnd).trim();
5554
value = value.substr(stringEnd).trim();
5655
return str;
5756
};
5857

59-
let stack = [root];
58+
const stack = [root];
6059
let parseValue, parseCommaResult, parseCommaValue, parseResult, createValue;
6160
let variable = "";
6261

63-
let getNamespace = (variable) => {
62+
const getNamespace = (variable) => {
6463
let namespace = "";
6564
let prefix = "";
6665
stack.push(variable);
@@ -86,11 +85,11 @@ export function expandValue(variableCreate: Function, value: string, root: strin
8685
return prefix + namespace;
8786
};
8887

89-
let parseTupleOrList = () => {
88+
const parseTupleOrList = () => {
9089
value = value.trim();
9190
if (value[0] != '{')
9291
return undefined;
93-
let oldContent = value;
92+
const oldContent = value;
9493
value = value.substr(1).trim();
9594
if (value[0] == '}') {
9695
value = value.substr(1).trim();
@@ -103,19 +102,19 @@ export function expandValue(variableCreate: Function, value: string, root: strin
103102
return <any>"<...>";
104103
}
105104
}
106-
let eqPos = value.indexOf("=");
107-
let newValPos1 = value.indexOf("{");
108-
let newValPos2 = value.indexOf(",");
105+
const eqPos = value.indexOf("=");
106+
const newValPos1 = value.indexOf("{");
107+
const newValPos2 = value.indexOf(",");
109108
let newValPos = newValPos1;
110109
if (newValPos2 != -1 && newValPos2 < newValPos1)
111110
newValPos = newValPos2;
112111
if (newValPos != -1 && eqPos > newValPos || eqPos == -1) { // is value list
113-
let values = [];
112+
const values = [];
114113
stack.push("[0]");
115114
let val = parseValue();
116115
stack.pop();
117116
values.push(createValue("[0]", val));
118-
let remaining = value;
117+
const remaining = value;
119118
let i = 0;
120119
while (true) {
121120
stack.push("[" + (++i) + "]");
@@ -132,7 +131,7 @@ export function expandValue(variableCreate: Function, value: string, root: strin
132131

133132
let result = parseResult(true);
134133
if (result) {
135-
let results = [];
134+
const results = [];
136135
results.push(result);
137136
while (result = parseCommaResult(true))
138137
results.push(result);
@@ -143,7 +142,7 @@ export function expandValue(variableCreate: Function, value: string, root: strin
143142
return undefined;
144143
};
145144

146-
let parsePrimitive = () => {
145+
const parsePrimitive = () => {
147146
let primitive: any;
148147
let match;
149148
value = value.trim();
@@ -208,14 +207,14 @@ export function expandValue(variableCreate: Function, value: string, root: strin
208207

209208
parseResult = (pushToStack: boolean = false) => {
210209
value = value.trim();
211-
let variableMatch = resultRegex.exec(value);
210+
const variableMatch = resultRegex.exec(value);
212211
if (!variableMatch)
213212
return undefined;
214213
value = value.substr(variableMatch[0].length).trim();
215-
let name = variable = variableMatch[1];
214+
const name = variable = variableMatch[1];
216215
if (pushToStack)
217216
stack.push(variable);
218-
let val = parseValue();
217+
const val = parseValue();
219218
if (pushToStack)
220219
stack.pop();
221220
return createValue(name, val);

src/backend/linux/console.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ import * as fs from "fs"
33

44
export function spawnTerminalEmulator(preferedEmulator: string): Thenable<string> {
55
return new Promise((resolve, reject) => {
6-
let ttyFileOutput = "/tmp/vscode-gdb-tty-0" + Math.floor(Math.random() * 100000000).toString(36);
6+
const ttyFileOutput = "/tmp/vscode-gdb-tty-0" + Math.floor(Math.random() * 100000000).toString(36);
77
ChildProcess.spawn(preferedEmulator || "x-terminal-emulator", ["-e", "sh -c \"tty > " + ttyFileOutput + " && sleep 4294967294\""]);
88
let it = 0;
9-
let interval = setInterval(() => {
9+
const interval = setInterval(() => {
1010
if (fs.existsSync(ttyFileOutput)) {
1111
clearInterval(interval);
12-
let tty = fs.readFileSync(ttyFileOutput).toString("utf8");
12+
const tty = fs.readFileSync(ttyFileOutput).toString("utf8");
1313
fs.unlink(ttyFileOutput);
1414
return resolve(tty);
1515
}

0 commit comments

Comments
 (0)