Skip to content

Commit 5dfa610

Browse files
committed
Turn off a few rules and more cleanup post merge
1 parent be1371d commit 5dfa610

File tree

13 files changed

+241
-246
lines changed

13 files changed

+241
-246
lines changed

scripts/errorCheck.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ fs.readFile('src/compiler/diagnosticInformationMap.generated.ts', 'utf-8', (err,
7474
console.log('Consumed ' + allSrc.length + ' characters of source');
7575

7676
let count = 0;
77-
console.log('== List of errors not used in source ==')
77+
console.log('== List of errors not used in source ==');
7878
for (let errName of errorNames) {
7979
if (allSrc.indexOf(errName) < 0) {
8080
console.log(errName);
@@ -84,4 +84,3 @@ fs.readFile('src/compiler/diagnosticInformationMap.generated.ts', 'utf-8', (err,
8484
console.log(count + ' of ' + errorNames.length + ' errors are not used in source');
8585
});
8686
});
87-

src/compiler/binder.ts

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace ts {
1111
}
1212

1313
export function getModuleInstanceState(node: Node): ModuleInstanceState {
14-
// A module is uninstantiated if it contains only
14+
// A module is uninstantiated if it contains only
1515
// 1. interface declarations, type alias declarations
1616
if (node.kind === SyntaxKind.InterfaceDeclaration || node.kind === SyntaxKind.TypeAliasDeclaration) {
1717
return ModuleInstanceState.NonInstantiated;
@@ -53,7 +53,7 @@ namespace ts {
5353
}
5454

5555
const enum ContainerFlags {
56-
// The current node is not a container, and no container manipulation should happen before
56+
// The current node is not a container, and no container manipulation should happen before
5757
// recursing into it.
5858
None = 0,
5959

@@ -90,7 +90,7 @@ namespace ts {
9090
let lastContainer: Node;
9191

9292
// If this file is an external module, then it is automatically in strict-mode according to
93-
// ES6. If it is not an external module, then we'll determine if it is in strict mode or
93+
// ES6. If it is not an external module, then we'll determine if it is in strict mode or
9494
// not depending on if we see "use strict" in certain places (or if we hit a class/namespace).
9595
let inStrictMode = !!file.externalModuleIndicator;
9696

@@ -179,7 +179,7 @@ namespace ts {
179179
* @param parent - node's parent declaration.
180180
* @param node - The declaration to be added to the symbol table
181181
* @param includes - The SymbolFlags that node has in addition to its declaration type (eg: export, ambient, etc.)
182-
* @param excludes - The flags which node cannot be declared alongside in a symbol table. Used to report forbidden declarations.
182+
* @param excludes - The flags which node cannot be declared alongside in a symbol table. Used to report forbidden declarations.
183183
*/
184184
function declareSymbol(symbolTable: SymbolTable, parent: Symbol, node: Declaration, includes: SymbolFlags, excludes: SymbolFlags): Symbol {
185185
Debug.assert(!hasDynamicName(node));
@@ -192,13 +192,13 @@ namespace ts {
192192

193193
// Check and see if the symbol table already has a symbol with this name. If not,
194194
// create a new symbol with this name and add it to the table. Note that we don't
195-
// give the new symbol any flags *yet*. This ensures that it will not conflict
195+
// give the new symbol any flags *yet*. This ensures that it will not conflict
196196
// with the 'excludes' flags we pass in.
197197
//
198198
// If we do get an existing symbol, see if it conflicts with the new symbol we're
199199
// creating. For example, a 'var' symbol and a 'class' symbol will conflict within
200-
// the same symbol table. If we have a conflict, report the issue on each
201-
// declaration we have for this symbol, and then create a new symbol for this
200+
// the same symbol table. If we have a conflict, report the issue on each
201+
// declaration we have for this symbol, and then create a new symbol for this
202202
// declaration.
203203
//
204204
// If we created a new symbol, either because we didn't have a symbol with this name
@@ -259,7 +259,7 @@ namespace ts {
259259
// ExportType, or ExportContainer flag, and an associated export symbol with all the correct flags set
260260
// on it. There are 2 main reasons:
261261
//
262-
// 1. We treat locals and exports of the same name as mutually exclusive within a container.
262+
// 1. We treat locals and exports of the same name as mutually exclusive within a container.
263263
// That means the binder will issue a Duplicate Identifier error if you mix locals and exports
264264
// with the same name in the same container.
265265
// TODO: Make this a more specific error and decouple it from the exclusion logic.
@@ -282,11 +282,11 @@ namespace ts {
282282
}
283283
}
284284

285-
// All container nodes are kept on a linked list in declaration order. This list is used by
286-
// the getLocalNameOfContainer function in the type checker to validate that the local name
285+
// All container nodes are kept on a linked list in declaration order. This list is used by
286+
// the getLocalNameOfContainer function in the type checker to validate that the local name
287287
// used for a container is unique.
288288
function bindChildren(node: Node) {
289-
// Before we recurse into a node's chilren, we first save the existing parent, container
289+
// Before we recurse into a node's chilren, we first save the existing parent, container
290290
// and block-container. Then after we pop out of processing the children, we restore
291291
// these saved values.
292292
let saveParent = parent;
@@ -302,9 +302,9 @@ namespace ts {
302302
// may contain locals, we proactively initialize the .locals field. We do this because
303303
// it's highly likely that the .locals will be needed to place some child in (for example,
304304
// a parameter, or variable declaration).
305-
//
305+
//
306306
// However, we do not proactively create the .locals for block-containers because it's
307-
// totally normal and common for block-containers to never actually have a block-scoped
307+
// totally normal and common for block-containers to never actually have a block-scoped
308308
// variable in them. We don't want to end up allocating an object for every 'block' we
309309
// run into when most of them won't be necessary.
310310
//
@@ -373,7 +373,7 @@ namespace ts {
373373

374374
case SyntaxKind.Block:
375375
// do not treat blocks directly inside a function as a block-scoped-container.
376-
// Locals that reside in this block should go to the function locals. Othewise 'x'
376+
// Locals that reside in this block should go to the function locals. Othewise 'x'
377377
// would not appear to be a redeclaration of a block scoped local in the following
378378
// example:
379379
//
@@ -386,7 +386,7 @@ namespace ts {
386386
// the block, then there would be no collision.
387387
//
388388
// By not creating a new block-scoped-container here, we ensure that both 'var x'
389-
// and 'let x' go into the Function-container's locals, and we do get a collision
389+
// and 'let x' go into the Function-container's locals, and we do get a collision
390390
// conflict.
391391
return isFunctionLike(node.parent) ? ContainerFlags.None : ContainerFlags.IsBlockScopedContainer;
392392
}
@@ -490,7 +490,7 @@ namespace ts {
490490
if (stat.kind === SyntaxKind.ExportDeclaration || stat.kind === SyntaxKind.ExportAssignment) {
491491
return true;
492492
}
493-
}
493+
};
494494
}
495495
return false;
496496
}
@@ -536,8 +536,8 @@ namespace ts {
536536
// For a given function symbol "<...>(...) => T" we want to generate a symbol identical
537537
// to the one we would get for: { <...>(...): T }
538538
//
539-
// We do that by making an anonymous type literal symbol, and then setting the function
540-
// symbol as its sole member. To the rest of the system, this symbol will be indistinguishable
539+
// We do that by making an anonymous type literal symbol, and then setting the function
540+
// symbol as its sole member. To the rest of the system, this symbol will be indistinguishable
541541
// from an actual type literal symbol you would have gotten had you used the long form.
542542
let symbol = createSymbol(SymbolFlags.Signature, getDeclarationName(node));
543543
addDeclarationToSymbol(symbol, node, SymbolFlags.Signature);
@@ -638,7 +638,7 @@ namespace ts {
638638
}
639639

640640
function getStrictModeIdentifierMessage(node: Node) {
641-
// Provide specialized messages to help the user understand why we think they're in
641+
// Provide specialized messages to help the user understand why we think they're in
642642
// strict mode.
643643
if (getContainingClass(node)) {
644644
return Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode;
@@ -696,7 +696,7 @@ namespace ts {
696696
}
697697

698698
function getStrictModeEvalOrArgumentsMessage(node: Node) {
699-
// Provide specialized messages to help the user understand why we think they're in
699+
// Provide specialized messages to help the user understand why we think they're in
700700
// strict mode.
701701
if (getContainingClass(node)) {
702702
return Diagnostics.Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode;
@@ -766,18 +766,18 @@ namespace ts {
766766
}
767767

768768
// First we bind declaration nodes to a symbol if possible. We'll both create a symbol
769-
// and then potentially add the symbol to an appropriate symbol table. Possible
769+
// and then potentially add the symbol to an appropriate symbol table. Possible
770770
// destination symbol tables are:
771-
//
771+
//
772772
// 1) The 'exports' table of the current container's symbol.
773773
// 2) The 'members' table of the current container's symbol.
774774
// 3) The 'locals' table of the current container.
775775
//
776-
// However, not all symbols will end up in any of these tables. 'Anonymous' symbols
776+
// However, not all symbols will end up in any of these tables. 'Anonymous' symbols
777777
// (like TypeLiterals for example) will not be put in any table.
778778
bindWorker(node);
779779

780-
// Then we recurse into the children of the node to bind them as well. For certain
780+
// Then we recurse into the children of the node to bind them as well. For certain
781781
// symbols we do specialized work when we recurse. For example, we'll keep track of
782782
// the current 'container' node when it changes. This helps us know which symbol table
783783
// a local should go into for example.
@@ -972,9 +972,9 @@ namespace ts {
972972
let symbol = node.symbol;
973973

974974
// TypeScript 1.0 spec (April 2014): 8.4
975-
// Every class automatically contains a static property member named 'prototype', the
975+
// Every class automatically contains a static property member named 'prototype', the
976976
// type of which is an instantiation of the class type with type Any supplied as a type
977-
// argument for each type parameter. It is an error to explicitly declare a static
977+
// argument for each type parameter. It is an error to explicitly declare a static
978978
// property member with the name 'prototype'.
979979
//
980980
// Note: we check for this here because this class may be merging into a module. The
@@ -1039,7 +1039,7 @@ namespace ts {
10391039
declareSymbolAndAddToSymbolTable(node, SymbolFlags.FunctionScopedVariable, SymbolFlags.ParameterExcludes);
10401040
}
10411041

1042-
// If this is a property-parameter, then also declare the property symbol into the
1042+
// If this is a property-parameter, then also declare the property symbol into the
10431043
// containing class.
10441044
if (node.flags & NodeFlags.AccessibilityModifier &&
10451045
node.parent.kind === SyntaxKind.Constructor &&

src/compiler/checker.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3874,8 +3874,8 @@ namespace ts {
38743874
* getExportedTypeFromNamespace('JSX', 'Element') returns the JSX.Element type
38753875
*/
38763876
function getExportedTypeFromNamespace(namespace: string, name: string): Type {
3877-
var namespaceSymbol = getGlobalSymbol(namespace, SymbolFlags.Namespace, /*diagnosticMessage*/ undefined);
3878-
var typeSymbol = namespaceSymbol && getSymbol(namespaceSymbol.exports, name, SymbolFlags.Type);
3877+
let namespaceSymbol = getGlobalSymbol(namespace, SymbolFlags.Namespace, /*diagnosticMessage*/ undefined);
3878+
let typeSymbol = namespaceSymbol && getSymbol(namespaceSymbol.exports, name, SymbolFlags.Type);
38793879
return typeSymbol && getDeclaredTypeOfSymbol(typeSymbol);
38803880
}
38813881

@@ -4697,7 +4697,6 @@ namespace ts {
46974697
}
46984698
let id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id;
46994699
let related = relation[id];
4700-
//let related: RelationComparisonResult = undefined; // relation[id];
47014700
if (related !== undefined) {
47024701
// If we computed this relation already and it was failed and reported, or if we're not being asked to elaborate
47034702
// errors, we can use the cached value. Otherwise, recompute the relation
@@ -7214,7 +7213,7 @@ namespace ts {
72147213
return links.resolvedJsxType = anyType;
72157214
}
72167215

7217-
var propsName = getJsxElementPropertiesName();
7216+
let propsName = getJsxElementPropertiesName();
72187217
if (propsName === undefined) {
72197218
// There is no type ElementAttributesProperty, return 'any'
72207219
return links.resolvedJsxType = anyType;
@@ -7224,7 +7223,7 @@ namespace ts {
72247223
return links.resolvedJsxType = elemInstanceType;
72257224
}
72267225
else {
7227-
var attributesType = getTypeOfPropertyOfType(elemInstanceType, propsName);
7226+
let attributesType = getTypeOfPropertyOfType(elemInstanceType, propsName);
72287227

72297228
if (!attributesType) {
72307229
// There is no property named 'props' on this instance type
@@ -7381,7 +7380,7 @@ namespace ts {
73817380
*/
73827381
function checkClassPropertyAccess(node: PropertyAccessExpression | QualifiedName, left: Expression | QualifiedName, type: Type, prop: Symbol): boolean {
73837382
let flags = getDeclarationFlagsFromSymbol(prop);
7384-
let declaringClass = <InterfaceType>getDeclaredTypeOfSymbol(prop.parent);;
7383+
let declaringClass = <InterfaceType>getDeclaredTypeOfSymbol(prop.parent);
73857384

73867385
if (left.kind === SyntaxKind.SuperKeyword) {
73877386
let errorNode = node.kind === SyntaxKind.PropertyAccessExpression ?
@@ -10121,7 +10120,7 @@ namespace ts {
1012110120

1012210121
// Abstract methods cannot have an implementation.
1012310122
// Extra checks are to avoid reporting multiple errors relating to the "abstractness" of the node.
10124-
if(node.flags & NodeFlags.Abstract && node.body) {
10123+
if (node.flags & NodeFlags.Abstract && node.body) {
1012510124
error(node, Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, declarationNameToString(node.name));
1012610125
}
1012710126
}
@@ -10895,7 +10894,7 @@ namespace ts {
1089510894
let promiseConstructor = getMergedSymbol(promiseType.symbol);
1089610895
if (!promiseConstructor || !symbolIsValue(promiseConstructor)) {
1089710896
error(node, Diagnostics.Type_0_is_not_a_valid_async_function_return_type, typeToString(promiseType));
10898-
return unknownType
10897+
return unknownType;
1089910898
}
1090010899

1090110900
// Validate the promise constructor type.
@@ -12177,7 +12176,7 @@ namespace ts {
1217712176

1217812177
// Interfaces cannot be merged with non-ambient classes.
1217912178
if (getSymbolOfNode(node).flags & SymbolFlags.Interface && !isInAmbientContext(node)) {
12180-
error(node, Diagnostics.Only_an_ambient_class_can_be_merged_with_an_interface)
12179+
error(node, Diagnostics.Only_an_ambient_class_can_be_merged_with_an_interface);
1218112180
}
1218212181

1218312182
forEach(node.members, checkSourceElement);

src/compiler/commandLineParser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ namespace ts {
436436
}
437437
else if (fileExtensionIs(name, ".ts")) {
438438
if (!contains(sysFiles, name + "x")) {
439-
fileNames.push(name)
439+
fileNames.push(name);
440440
}
441441
}
442442
else {

src/compiler/core.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -600,20 +600,20 @@ namespace ts {
600600

601601
function getNormalizedPathComponentsOfUrl(url: string) {
602602
// Get root length of http://www.website.com/folder1/foler2/
603-
// In this example the root is: http://www.website.com/
603+
// In this example the root is: http://www.website.com/
604604
// normalized path components should be ["http://www.website.com/", "folder1", "folder2"]
605605

606606
let urlLength = url.length;
607607
// Initial root length is http:// part
608608
let rootLength = url.indexOf("://") + "://".length;
609609
while (rootLength < urlLength) {
610-
// Consume all immediate slashes in the protocol
610+
// Consume all immediate slashes in the protocol
611611
// eg.initial rootlength is just file:// but it needs to consume another "/" in file:///
612612
if (url.charCodeAt(rootLength) === CharacterCodes.slash) {
613613
rootLength++;
614614
}
615615
else {
616-
// non slash character means we continue proceeding to next component of root search
616+
// non slash character means we continue proceeding to next component of root search
617617
break;
618618
}
619619
}
@@ -626,15 +626,15 @@ namespace ts {
626626
// Find the index of "/" after website.com so the root can be http://www.website.com/ (from existing http://)
627627
let indexOfNextSlash = url.indexOf(directorySeparator, rootLength);
628628
if (indexOfNextSlash !== -1) {
629-
// Found the "/" after the website.com so the root is length of http://www.website.com/
629+
// Found the "/" after the website.com so the root is length of http://www.website.com/
630630
// and get components afetr the root normally like any other folder components
631631
rootLength = indexOfNextSlash + 1;
632632
return normalizedPathComponents(url, rootLength);
633633
}
634634
else {
635-
// Can't find the host assume the rest of the string as component
635+
// Can't find the host assume the rest of the string as component
636636
// but make sure we append "/" to it as root is not joined using "/"
637-
// eg. if url passed in was http://website.com we want to use root as [http://website.com/]
637+
// eg. if url passed in was http://website.com we want to use root as [http://website.com/]
638638
// so that other path manipulations will be correct and it can be merged with relative paths correctly
639639
return [url + directorySeparator];
640640
}

0 commit comments

Comments
 (0)