Skip to content

Commit 4b2aed7

Browse files
committed
let -> const
1 parent 8ecebfb commit 4b2aed7

8 files changed

Lines changed: 101 additions & 101 deletions

File tree

build/lib/bundle.ts

Lines changed: 71 additions & 71 deletions
Large diffs are not rendered by default.

build/lib/compilation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ function monacodtsTask(out: string, isWatch: boolean): NodeJS.ReadWriteStream {
135135
});
136136

137137
const inputFiles: { [file: string]: string; } = {};
138-
for (let filePath in neededFiles) {
138+
for (const filePath in neededFiles) {
139139
if (/\bsrc(\/|\\)vs\b/.test(filePath)) {
140140
// This file is needed from source => simply read it now
141141
inputFiles[filePath] = fs.readFileSync(filePath).toString();

build/lib/extensions.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ function fromLocal(extensionPath: string, sourceMappingURLBase?: string): Stream
3535
}
3636

3737
function fromLocalWebpack(extensionPath: string, sourceMappingURLBase: string | undefined): Stream {
38-
let result = es.through();
38+
const result = es.through();
3939

40-
let packagedDependencies: string[] = [];
41-
let packageJsonConfig = require(path.join(extensionPath, 'package.json'));
42-
let webpackRootConfig = require(path.join(extensionPath, 'extension.webpack.config.js'));
40+
const packagedDependencies: string[] = [];
41+
const packageJsonConfig = require(path.join(extensionPath, 'package.json'));
42+
const webpackRootConfig = require(path.join(extensionPath, 'extension.webpack.config.js'));
4343
for (const key in webpackRootConfig.externals) {
4444
if (key in packageJsonConfig.dependencies) {
4545
packagedDependencies.push(key);
@@ -107,7 +107,7 @@ function fromLocalWebpack(extensionPath: string, sourceMappingURLBase: string |
107107
...require(webpackConfigPath),
108108
...{ mode: 'production' }
109109
};
110-
let relativeOutputPath = path.relative(extensionPath, webpackConfig.output.path);
110+
const relativeOutputPath = path.relative(extensionPath, webpackConfig.output.path);
111111

112112
return webpackGulp(webpackConfig, webpack, webpackDone)
113113
.pipe(es.through(function (data) {

build/lib/nls.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function collect(node: ts.Node, fn: (node: ts.Node) => CollectStepResult): ts.No
2626
const result: ts.Node[] = [];
2727

2828
function loop(node: ts.Node) {
29-
let stepResult = fn(node);
29+
const stepResult = fn(node);
3030

3131
if (stepResult === CollectStepResult.Yes || stepResult === CollectStepResult.YesAndRecurse) {
3232
result.push(node);
@@ -43,7 +43,7 @@ function collect(node: ts.Node, fn: (node: ts.Node) => CollectStepResult): ts.No
4343

4444
function clone<T>(object: T): T {
4545
const result = <T>{};
46-
for (let id in object) {
46+
for (const id in object) {
4747
result[id] = object[id];
4848
}
4949
return result;

build/lib/stats.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Entry {
2525
return `Stats for '${util.colors.grey(this.name)}': ${Math.round(this.totalSize / 1204)}KB`;
2626

2727
} else {
28-
let count = this.totalCount < 100
28+
const count = this.totalCount < 100
2929
? util.colors.green(this.totalCount.toString())
3030
: util.colors.red(this.totalCount.toString());
3131

@@ -43,7 +43,7 @@ export function createStatsStream(group: string, log?: boolean): es.ThroughStrea
4343
_entries.set(entry.name, entry);
4444

4545
return es.through(function (data) {
46-
let file = data as File;
46+
const file = data as File;
4747
if (typeof file.path === 'string') {
4848
entry.totalCount += 1;
4949
if (Buffer.isBuffer(file.contents)) {
@@ -61,7 +61,7 @@ export function createStatsStream(group: string, log?: boolean): es.ThroughStrea
6161
util.log(`Stats for '${util.colors.grey(entry.name)}': ${Math.round(entry.totalSize / 1204)}KB`);
6262

6363
} else {
64-
let count = entry.totalCount < 100
64+
const count = entry.totalCount < 100
6565
? util.colors.green(entry.totalCount.toString())
6666
: util.colors.red(entry.totalCount.toString());
6767

@@ -75,7 +75,7 @@ export function createStatsStream(group: string, log?: boolean): es.ThroughStrea
7575

7676
export function submitAllStats(productJson: any, commit: string): Promise<boolean> {
7777

78-
let sorted: Entry[] = [];
78+
const sorted: Entry[] = [];
7979
// move entries for single files to the front
8080
_entries.forEach(value => {
8181
if (value.totalCount === 1) {

build/lib/test/i18n.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ suite('XLF Parser Tests', () => {
1515
const translatedMessages = { key1: 'Кнопка #1', key2: 'Кнопка #2 &' };
1616

1717
test('Keys & messages to XLF conversion', () => {
18-
let xlf = new i18n.XLF('vscode-workbench');
18+
const xlf = new i18n.XLF('vscode-workbench');
1919
xlf.addFile(originalFilePath, keys, messages);
2020
const xlfString = xlf.toString();
2121

build/lib/tslint/layeringRule.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export class Rule extends Lint.Rules.AbstractRule {
1616
public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
1717

1818
const parts = dirname(sourceFile.fileName).split(/\\|\//);
19-
let ruleArgs = this.getOptions().ruleArguments[0];
19+
const ruleArgs = this.getOptions().ruleArguments[0];
2020

2121
let config: Config | undefined;
2222
for (let i = parts.length - 1; i >= 0; i--) {
@@ -98,7 +98,7 @@ class LayeringRule extends Lint.RuleWalker {
9898
}
9999

100100
static _print(set: Set<string>): string {
101-
let r: string[] = [];
101+
const r: string[] = [];
102102
set.forEach(e => r.push(e));
103103
return r.join(', ');
104104
}

build/lib/tslint/noUnexternalizedStringsRule.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ class NoUnexternalizedStringsRuleWalker extends Lint.RuleWalker {
6363
this.messageIndex = undefined;
6464
this.keyIndex = undefined;
6565
this.usedKeys = Object.create(null);
66-
let options: any[] = this.getOptions();
67-
let first: UnexternalizedStringsOptions = options && options.length > 0 ? options[0] : null;
66+
const options: any[] = this.getOptions();
67+
const first: UnexternalizedStringsOptions = options && options.length > 0 ? options[0] : null;
6868
if (first) {
6969
if (Array.isArray(first.signatures)) {
7070
first.signatures.forEach((signature: string) => this.signatures[signature] = true);
@@ -84,7 +84,7 @@ class NoUnexternalizedStringsRuleWalker extends Lint.RuleWalker {
8484
protected visitSourceFile(node: ts.SourceFile): void {
8585
super.visitSourceFile(node);
8686
Object.keys(this.usedKeys).forEach(key => {
87-
let occurrences = this.usedKeys[key];
87+
const occurrences = this.usedKeys[key];
8888
if (occurrences.length > 1) {
8989
occurrences.forEach(occurrence => {
9090
this.addFailure((this.createFailure(occurrence.key.getStart(), occurrence.key.getWidth(), `Duplicate key ${occurrence.key.getText()} with different message value.`)));
@@ -99,9 +99,9 @@ class NoUnexternalizedStringsRuleWalker extends Lint.RuleWalker {
9999
}
100100

101101
private checkStringLiteral(node: ts.StringLiteral): void {
102-
let text = node.getText();
103-
let doubleQuoted = text.length >= 2 && text[0] === NoUnexternalizedStringsRuleWalker.DOUBLE_QUOTE && text[text.length - 1] === NoUnexternalizedStringsRuleWalker.DOUBLE_QUOTE;
104-
let info = this.findDescribingParent(node);
102+
const text = node.getText();
103+
const doubleQuoted = text.length >= 2 && text[0] === NoUnexternalizedStringsRuleWalker.DOUBLE_QUOTE && text[text.length - 1] === NoUnexternalizedStringsRuleWalker.DOUBLE_QUOTE;
104+
const info = this.findDescribingParent(node);
105105
// Ignore strings in import and export nodes.
106106
if (info && info.isImport && doubleQuoted) {
107107
const fix = [
@@ -115,8 +115,8 @@ class NoUnexternalizedStringsRuleWalker extends Lint.RuleWalker {
115115
);
116116
return;
117117
}
118-
let callInfo = info ? info.callInfo : null;
119-
let functionName = callInfo ? callInfo.callExpression.expression.getText() : null;
118+
const callInfo = info ? info.callInfo : null;
119+
const functionName = callInfo ? callInfo.callExpression.expression.getText() : null;
120120
if (functionName && this.ignores[functionName]) {
121121
return;
122122
}
@@ -134,19 +134,19 @@ class NoUnexternalizedStringsRuleWalker extends Lint.RuleWalker {
134134
return;
135135
}
136136
// We have a string that is a direct argument into the localize call.
137-
let keyArg: ts.Expression | null = callInfo && callInfo.argIndex === this.keyIndex
137+
const keyArg: ts.Expression | null = callInfo && callInfo.argIndex === this.keyIndex
138138
? callInfo.callExpression.arguments[this.keyIndex]
139139
: null;
140140
if (keyArg) {
141141
if (isStringLiteral(keyArg)) {
142142
this.recordKey(keyArg, this.messageIndex && callInfo ? callInfo.callExpression.arguments[this.messageIndex] : undefined);
143143
} else if (isObjectLiteral(keyArg)) {
144144
for (let i = 0; i < keyArg.properties.length; i++) {
145-
let property = keyArg.properties[i];
145+
const property = keyArg.properties[i];
146146
if (isPropertyAssignment(property)) {
147-
let name = property.name.getText();
147+
const name = property.name.getText();
148148
if (name === 'key') {
149-
let initializer = property.initializer;
149+
const initializer = property.initializer;
150150
if (isStringLiteral(initializer)) {
151151
this.recordKey(initializer, this.messageIndex && callInfo ? callInfo.callExpression.arguments[this.messageIndex] : undefined);
152152
}
@@ -168,7 +168,7 @@ class NoUnexternalizedStringsRuleWalker extends Lint.RuleWalker {
168168
}
169169

170170
private recordKey(keyNode: ts.StringLiteral, messageNode: ts.Node | undefined) {
171-
let text = keyNode.getText();
171+
const text = keyNode.getText();
172172
// We have an empty key
173173
if (text.match(/(['"]) *\1/)) {
174174
if (messageNode) {
@@ -194,9 +194,9 @@ class NoUnexternalizedStringsRuleWalker extends Lint.RuleWalker {
194194
private findDescribingParent(node: ts.Node): { callInfo?: { callExpression: ts.CallExpression, argIndex: number }, isImport?: boolean; } | null {
195195
let parent: ts.Node;
196196
while ((parent = node.parent)) {
197-
let kind = parent.kind;
197+
const kind = parent.kind;
198198
if (kind === ts.SyntaxKind.CallExpression) {
199-
let callExpression = parent as ts.CallExpression;
199+
const callExpression = parent as ts.CallExpression;
200200
return { callInfo: { callExpression: callExpression, argIndex: callExpression.arguments.indexOf(<any>node) } };
201201
} else if (kind === ts.SyntaxKind.ImportEqualsDeclaration || kind === ts.SyntaxKind.ImportDeclaration || kind === ts.SyntaxKind.ExportDeclaration) {
202202
return { isImport: true };

0 commit comments

Comments
 (0)