8000 Fixed linter warnings. · nycdotnet/TypeScript@72bfd2f · GitHub
[go: up one dir, main page]

Skip to content 10000

Commit 72bfd2f

Browse files
committed
Fixed linter warnings.
1 parent 0d8e152 commit 72bfd2f

File tree

3 files changed

+20
-28
lines changed

3 files changed

+20
-28
lines changed

src/compiler/transformers/module/module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ namespace ts {
338338

339339
function visitExportDeclaration(node: ExportDeclaration): OneOrMany<Statement> {
340340
if (contains(externalImports, node)) {
341-
let generatedName = getGeneratedNameForNode(node);
341+
const generatedName = getGeneratedNameForNode(node);
342342
if (node.exportClause) {
343343
const statements: Statement[] = [];
344344
// export { x, y } from "mod";

src/compiler/transformers/module/system.ts

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ namespace ts {
3737
let contextObjectForFile: Identifier;
3838
let exportedLocalNames: Identifier[];
3939
let exportedFunctionDeclarations: ExpressionStatement[];
40-
let noSubstitution: Map<boolean> = {};
40+
const noSubstitution: Map<boolean> = {};
4141

4242
return transformSourceFile;
4343

@@ -992,7 +992,7 @@ namespace ts {
992992

993993
function hasExportedReferenceInArrayDestructuringElement(node: Expression): boolean {
994994
if (isSpreadElementExpression(node)) {
995-
let expression = node.expression;
995+
const expression = node.expression;
996996
return isIdentifier(expression) && isExportedBinding(expression);
997997
}
998998
else {
@@ -1002,7 +1002,7 @@ namespace ts {
10021002

10031003
function hasExportedReferenceInDestructuringElement(node: Expression): boolean {
10041004
if (isBinaryExpression(node)) {
1005-
let left = node.left;
1005+
const left = node.left;
10061006
return node.operatorToken.kind === SyntaxKind.EqualsToken
10071007
&& isDestructuringPattern(left)
10081008
&& hasExportedReferenceInDestructuringPattern(left);
@@ -1011,7 +1011,7 @@ namespace ts {
10111011
return isExportedBinding(node);
10121012
}
10131013
else if (isSpreadElementExpression(node)) {
1014-
let expression = node.expression;
1014+
const expression = node.expression;
10151015
return isIdentifier(expression) && isExportedBinding(expression);
10161016
}
10171017
else if (isDestructuringPattern(node)) {
@@ -1052,7 +1052,7 @@ namespace ts {
10521052
}
10531053

10541054
function getExternalModuleNameLiteral(importNode: ImportDeclaration | ExportDeclaration | ImportEqualsDeclaration) {
1055-
let moduleName = getExternalModuleName(importNode);
1055+
const moduleName = getExternalModuleName(importNode);
10561056
if (moduleName.kind === SyntaxKind.StringLiteral) {
10571057
return tryRenameExternalModule(<StringLiteral>moduleName)
10581058
|| getSynthesizedNode(<StringLiteral>moduleName);
@@ -1074,12 +1074,12 @@ namespace ts {
10741074
}
10751075

10761076
function getLocalNameTextForExternalImport(node: ImportDeclaration | ExportDeclaration | ImportEqualsDeclaration): string {
1077-
let name = getLocalNameForExternalImport(node);
1077+
const name = getLocalNameForExternalImport(node);
10781078
return name ? name.text : undefined;
10791079
}
10801080

10811081
function getLocalNameForExternalImport(node: ImportDeclaration | ExportDeclaration | ImportEqualsDeclaration): Identifier {
1082-
let namespaceDeclaration = getNamespaceDeclarationNode(node);
1082+
const namespaceDeclaration = getNamespaceDeclarationNode(node);
10831083
if (namespaceDeclaration && !isDefaultImport(node)) {
10841084
return createIdentifier(getSourceTextOfNodeFromSourceFile(currentSourceFile, namespaceDeclaration.name));
10851085
}
@@ -1182,8 +1182,8 @@ namespace ts {
11821182
* @param node The declaration to export.
11831183
*/
11841184
function createDeclarationExport(node: DeclarationStatement) {
1185-
let declarationName = getDeclarationName(node);
1186-
let exportName = node.flags & NodeFlags.Default ? createLiteral("default") : declarationName;
1185+
const declarationName = getDeclarationName(node);
1186+
const exportName = node.flags & NodeFlags.Default ? createLiteral("default") : declarationName;
11871187
return createExportStatement(exportName, declarationName);
11881188
}
11891189

@@ -1209,15 +1209,15 @@ namespace ts {
12091209
}
12101210

12111211
function collectDependencyGroups(externalImports: (ImportDeclaration | ImportEqualsDeclaration | ExportDeclaration)[]) {
1212-
let groupIndices: Map<number> = {};
1213-
let dependencyGroups: DependencyGroup[] = [];
1214-
for (let i = 0; i < externalImports.length; ++i) {
1215-
let externalImport = externalImports[i];
1216-
let externalModuleName = getExternalModuleNameLiteral(externalImport);
1217-
let text = externalModuleName.text;
1212+
const groupIndices: Map<number> = {};
1213+
const dependencyGroups: DependencyGroup[] = [];
1214+
for (let i = 0; i < externalImports.length; i++) {
1215+
const externalImport = externalImports[i];
1216+
const externalModuleName = getExternalModuleNameLiteral(externalImport);
1217+
const text = externalModuleName.text;
12181218
if (hasProperty(groupIndices, text)) {
12191219
// deduplicate/group entries in dependency list by the dependency name
1220-
let groupIndex = groupIndices[text];
1220+
const groupIndex = groupIndices[text];
12211221
dependencyGroups[groupIndex].externalImports.push(externalImport);
12221222
continue;
12231223
}
@@ -1245,14 +1245,6 @@ namespace ts {
12451245
exportedLocalNames.push(name);
12461246
}
12471247

1248-
function hoistExportedVariableDeclaration(name: Identifier) {
1249-
1250-
}
1251-
1252-
function hoistExportedFunctionDeclaration(node: FunctionDeclaration) {
1253-
1254-
}
1255-
12561248
function recordExportedFunctionDeclaration(node: FunctionDeclaration) {
12571249
if (!exportedFunctionDeclarations) {
12581250
exportedFunctionDeclarations = [];
@@ -1262,7 +1254,7 @@ namespace ts {
12621254
}
12631255

12641256
function hoistBindingElement(node: VariableDeclaration | BindingElement, isExported: boolean) {
1265-
let name = node.name;
1257+
const name = node.name;
12661258
if (isIdentifier(name)) {
12671259
hoistVariableDeclaration(getSynthesizedNode(name));
12681260
if (isExported) {

src/compiler/utilities.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2869,7 +2869,7 @@ namespace ts {
28692869
const exportSpecifiers: Map<ExportSpecifier[]> = {};
28702870
let exportEquals: ExportAssignment = undefined;
28712871
let hasExportStars = false;
2872-
for (let node of sourceFile.statements) {
2872+
for (const node of sourceFile.statements) {
28732873
switch (node.kind) {
28742874
case SyntaxKind.ImportDeclaration:
28752875
if (!(<ImportDeclaration>node).importClause ||
@@ -2928,7 +2928,7 @@ namespace ts {
29282928
}
29292929

29302930
export function copyPrologueDirectives(from: Statement[], to: Statement[]): number {
2931-
for (let i = 0; i < from.length; ++i) {
2931+
for (let i = 0; i < from.length; i++) {
29322932
if (isPrologueDirective(from[i])) {
29332933
addNode(to, from[i]);
29342934
}

0 commit comments

Comments
 (0)
0