Skip to content

Commit e4b81d0

Browse files
authored
Merge pull request #13006 from SaschaNaz/lintfix
Fix latest tslint errors
2 parents 0b125a3 + 67e1fd8 commit e4b81d0

29 files changed

+81
-292
lines changed

Jakefile.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1179,7 +1179,6 @@ task("update-sublime", ["local", serverFile], function () {
11791179
var tslintRuleDir = "scripts/tslint";
11801180
var tslintRules = [
11811181
"nextLineRule",
1182-
"preferConstRule",
11831182
"booleanTriviaRule",
11841183
"typeOperatorSpacingRule",
11851184
"noInOperatorRule",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
"through2": "latest",
7676
"travis-fold": "latest",
7777
"ts-node": "latest",
78-
"tslint": "4.0.0-dev.3",
78+
"tslint": "next",
7979
"typescript": "next"
8080
},
8181
"scripts": {

scripts/tslint/preferConstRule.ts

Lines changed: 0 additions & 204 deletions
This file was deleted.

src/compiler/binder.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,8 @@ namespace ts {
283283
// Parameters with names are handled at the top of this function. Parameters
284284
// without names can only come from JSDocFunctionTypes.
285285
Debug.assert(node.parent.kind === SyntaxKind.JSDocFunctionType);
286-
let functionType = <JSDocFunctionType>node.parent;
287-
let index = indexOf(functionType.parameters, node);
286+
const functionType = <JSDocFunctionType>node.parent;
287+
const index = indexOf(functionType.parameters, node);
288288
return "arg" + index;
289289
case SyntaxKind.JSDocTypedefTag:
290290
const parentNode = node.parent && node.parent.parent;

src/compiler/checker.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5042,7 +5042,7 @@ namespace ts {
50425042
// If this is a JSDoc construct signature, then skip the first parameter in the
50435043
// parameter list. The first parameter represents the return type of the construct
50445044
// signature.
5045-
for (let i = isJSConstructSignature ? 1 : 0, n = declaration.parameters.length; i < n; i++) {
5045+
for (let i = isJSConstructSignature ? 1 : 0; i < declaration.parameters.length; i++) {
50465046
const param = declaration.parameters[i];
50475047

50485048
let paramSymbol = param.symbol;
@@ -5141,7 +5141,7 @@ namespace ts {
51415141
function getSignaturesOfSymbol(symbol: Symbol): Signature[] {
51425142
if (!symbol) return emptyArray;
51435143
const result: Signature[] = [];
5144-
for (let i = 0, len = symbol.declarations.length; i < len; i++) {
5144+
for (let i = 0; i < symbol.declarations.length; i++) {
51455145
const node = symbol.declarations[i];
51465146
switch (node.kind) {
51475147
case SyntaxKind.FunctionType:
@@ -5791,8 +5791,8 @@ namespace ts {
57915791
}
57925792

57935793
function isSubtypeOfAny(candidate: Type, types: Type[]): boolean {
5794-
for (let i = 0, len = types.length; i < len; i++) {
5795-
if (candidate !== types[i] && isTypeSubtypeOf(candidate, types[i])) {
5794+
for (const type of types) {
5795+
if (candidate !== type && isTypeSubtypeOf(candidate, type)) {
57965796
return true;
57975797
}
57985798
}
@@ -7945,7 +7945,7 @@ namespace ts {
79457945
return Ternary.False;
79467946
}
79477947
let result = Ternary.True;
7948-
for (let i = 0, len = sourceSignatures.length; i < len; i++) {
7948+
for (let i = 0; i < sourceSignatures.length; i++) {
79497949
const related = compareSignaturesIdentical(sourceSignatures[i], targetSignatures[i], /*partialMatch*/ false, /*ignoreThisTypes*/ false, /*ignoreReturnTypes*/ false, isRelatedTo);
79507950
if (!related) {
79517951
return Ternary.False;
@@ -18093,7 +18093,7 @@ namespace ts {
1809318093
/** Check each type parameter and check that type parameters have no duplicate type parameter declarations */
1809418094
function checkTypeParameters(typeParameterDeclarations: TypeParameterDeclaration[]) {
1809518095
if (typeParameterDeclarations) {
18096-
for (let i = 0, n = typeParameterDeclarations.length; i < n; i++) {
18096+
for (let i = 0; i < typeParameterDeclarations.length; i++) {
1809718097
const node = typeParameterDeclarations[i];
1809818098
checkTypeParameter(node);
1809918099

@@ -18373,7 +18373,7 @@ namespace ts {
1837318373
// TypeScript 1.0 spec (April 2014):
1837418374
// When a generic interface has multiple declarations, all declarations must have identical type parameter
1837518375
// lists, i.e. identical type parameter names with identical constraints in identical order.
18376-
for (let i = 0, len = list1.length; i < len; i++) {
18376+
for (let i = 0; i < list1.length; i++) {
1837718377
const tp1 = list1[i];
1837818378
const tp2 = list2[i];
1837918379
if (tp1.name.text !== tp2.name.text) {
@@ -20817,7 +20817,7 @@ namespace ts {
2081720817
case SyntaxKind.PublicKeyword:
2081820818
case SyntaxKind.ProtectedKeyword:
2081920819
case SyntaxKind.PrivateKeyword:
20820-
let text = visibilityToString(modifierToFlag(modifier.kind));
20820+
const text = visibilityToString(modifierToFlag(modifier.kind));
2082120821

2082220822
if (modifier.kind === SyntaxKind.ProtectedKeyword) {
2082320823
lastProtected = modifier;

src/compiler/commandLineParser.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ namespace ts {
620620
break;
621621
case "boolean":
622622
// boolean flag has optional value true, false, others
623-
let optValue = args[i];
623+
const optValue = args[i];
624624
options[opt.name] = optValue !== "false";
625625
// consume next argument as boolean flag value
626626
if (optValue === "false" || optValue === "true") {
@@ -778,7 +778,7 @@ namespace ts {
778778
break;
779779
default:
780780
const value = options[name];
781-
let optionDefinition = optionsNameMap[name.toLowerCase()];
781+
const optionDefinition = optionsNameMap[name.toLowerCase()];
782782
if (optionDefinition) {
783783
const customTypeMap = getCustomTypeMapOfCommandLineOption(optionDefinition);
784784
if (!customTypeMap) {

src/compiler/core.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ namespace ts {
119119
*/
120120
export function forEach<T, U>(array: T[] | undefined, callback: (element: T, index: number) => U | undefined): U | undefined {
121121
if (array) {
122-
for (let i = 0, len = array.length; i < len; i++) {
122+
for (let i = 0; i < array.length; i++) {
123123
const result = callback(array[i], i);
124124
if (result) {
125125
return result;
@@ -143,7 +143,7 @@ namespace ts {
143143
*/
144144
export function every<T>(array: T[], callback: (element: T, index: number) => boolean): boolean {
145145
if (array) {
146-
for (let i = 0, len = array.length; i < len; i++) {
146+
for (let i = 0; i < array.length; i++) {
147147
if (!callback(array[i], i)) {
148148
return false;
149149
}
@@ -155,7 +155,7 @@ namespace ts {
155155

156156
/** Works like Array.prototype.find, returning `undefined` if no element satisfying the predicate is found. */
157157
export function find<T>(array: T[], predicate: (element: T, index: number) => boolean): T | undefined {
158-
for (let i = 0, len = array.length; i < len; i++) {
158+
for (let i = 0; i < array.length; i++) {
159159
const value = array[i];
160160
if (predicate(value, i)) {
161161
return value;
@@ -169,7 +169,7 @@ namespace ts {
169169
* This is like `forEach`, but never returns undefined.
170170
*/
171171
export function findMap<T, U>(array: T[], callback: (element: T, index: number) => U | undefined): U {
172-
for (let i = 0, len = array.length; i < len; i++) {
172+
for (let i = 0; i < array.length; i++) {
173173
const result = callback(array[i], i);
174174
if (result) {
175175
return result;
@@ -191,7 +191,7 @@ namespace ts {
191191

192192
export function indexOf<T>(array: T[], value: T): number {
193193
if (array) {
194-
for (let i = 0, len = array.length; i < len; i++) {
194+
for (let i = 0; i < array.length; i++) {
195195
if (array[i] === value) {
196196
return i;
197197
}
@@ -201,7 +201,7 @@ namespace ts {
201201
}
202202

203203
export function indexOfAnyCharCode(text: string, charCodes: number[], start?: number): number {
204-
for (let i = start || 0, len = text.length; i < len; i++) {
204+
for (let i = start || 0; i < text.length; i++) {
205205
if (contains(charCodes, text.charCodeAt(i))) {
206206
return i;
207207
}

src/compiler/parser.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1679,8 +1679,8 @@ namespace ts {
16791679
// Method declarations are not necessarily reusable. An object-literal
16801680
// may have a method calls "constructor(...)" and we must reparse that
16811681
// into an actual .ConstructorDeclaration.
1682-
let methodDeclaration = <MethodDeclaration>node;
1683-
let nameIsConstructor = methodDeclaration.name.kind === SyntaxKind.Identifier &&
1682+
const methodDeclaration = <MethodDeclaration>node;
1683+
const nameIsConstructor = methodDeclaration.name.kind === SyntaxKind.Identifier &&
16841684
(<Identifier>methodDeclaration.name).originalKeywordKind === SyntaxKind.ConstructorKeyword;
16851685

16861686
return !nameIsConstructor;
@@ -7406,7 +7406,7 @@ namespace ts {
74067406
if (position >= array.pos && position < array.end) {
74077407
// position was in this array. Search through this array to see if we find a
74087408
// viable element.
7409-
for (let i = 0, n = array.length; i < n; i++) {
7409+
for (let i = 0; i < array.length; i++) {
74107410
const child = array[i];
74117411
if (child) {
74127412
if (child.pos === position) {

0 commit comments

Comments
 (0)