Skip to content

Commit aed48ec

Browse files
author
Arthur Ozga
committed
changed to '==' to '===', '!=' to '!=='
1 parent 718dc5b commit aed48ec

File tree

9 files changed

+33
-28
lines changed

9 files changed

+33
-28
lines changed

src/compiler/checker.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3523,7 +3523,7 @@ namespace ts {
35233523
// -> typeParameter and symbol.declaration originate from the same type parameter list
35243524
// -> illegal for all declarations in symbol
35253525
// forEach === exists
3526-
links.isIllegalTypeReferenceInConstraint = forEach(symbol.declarations, d => d.parent == typeParameter.parent);
3526+
links.isIllegalTypeReferenceInConstraint = forEach(symbol.declarations, d => d.parent === typeParameter.parent);
35273527
}
35283528
}
35293529
if (links.isIllegalTypeReferenceInConstraint) {
@@ -8432,7 +8432,7 @@ namespace ts {
84328432
// contextually typed function and arrow expressions in the initial phase.
84338433
function checkExpression(node: Expression | QualifiedName, contextualMapper?: TypeMapper): Type {
84348434
let type: Type;
8435-
if (node.kind == SyntaxKind.QualifiedName) {
8435+
if (node.kind === SyntaxKind.QualifiedName) {
84368436
type = checkQualifiedName(<QualifiedName>node);
84378437
}
84388438
else {
@@ -9871,7 +9871,7 @@ namespace ts {
98719871
function checkForStatement(node: ForStatement) {
98729872
// Grammar checking
98739873
if (!checkGrammarStatementInAmbientContext(node)) {
9874-
if (node.initializer && node.initializer.kind == SyntaxKind.VariableDeclarationList) {
9874+
if (node.initializer && node.initializer.kind === SyntaxKind.VariableDeclarationList) {
98759875
checkGrammarVariableDeclarationList(<VariableDeclarationList>node.initializer);
98769876
}
98779877
}
@@ -11751,7 +11751,7 @@ namespace ts {
1175111751
}
1175211752

1175311753
function isTypeDeclarationName(name: Node): boolean {
11754-
return name.kind == SyntaxKind.Identifier &&
11754+
return name.kind === SyntaxKind.Identifier &&
1175511755
isTypeDeclaration(name.parent) &&
1175611756
(<Declaration>name.parent).name === name;
1175711757
}

src/harness/projectsRunner.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ class ProjectRunner extends RunnerBase {
110110
else if (url.indexOf(diskProjectPath) === 0) {
111111
// Replace the disk specific path into the project root path
112112
url = url.substr(diskProjectPath.length);
113+
// TODO: should be '!=='?
113114
if (url.charCodeAt(0) != ts.CharacterCodes.slash) {
114115
url = "/" + url;
115116
}

src/harness/sourceMapRecorder.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ module Harness.SourceMapRecoder {
4646
}
4747

4848
function isSourceMappingSegmentEnd() {
49-
if (decodingIndex == sourceMapMappings.length) {
49+
if (decodingIndex === sourceMapMappings.length) {
5050
return true;
5151
}
5252

@@ -95,15 +95,15 @@ module Harness.SourceMapRecoder {
9595
var currentByte = base64FormatDecode();
9696

9797
// If msb is set, we still have more bits to continue
98-
moreDigits = (currentByte & 32) != 0;
98+
moreDigits = (currentByte & 32) !== 0;
9999

100100
// least significant 5 bits are the next msbs in the final value.
101101
value = value | ((currentByte & 31) << shiftCount);
102102
shiftCount += 5;
103103
}
104104

105105
// Least significant bit if 1 represents negative and rest of the msb is actual absolute value
106-
if ((value & 1) == 0) {
106+
if ((value & 1) === 0) {
107107
// + number
108108
value = value >> 1;
109109
}
@@ -182,7 +182,7 @@ module Harness.SourceMapRecoder {
182182
}
183183
}
184184
// Dont support reading mappings that dont have information about original source and its line numbers
185-
if (createErrorIfCondition(!isSourceMappingSegmentEnd(), "Unsupported Error Format: There are more entries after " + (decodeOfEncodedMapping.nameIndex == -1 ? "sourceColumn" : "nameIndex"))) {
185+
if (createErrorIfCondition(!isSourceMappingSegmentEnd(), "Unsupported Error Format: There are more entries after " + (decodeOfEncodedMapping.nameIndex === -1 ? "sourceColumn" : "nameIndex"))) {
186186
return { error: errorDecodeOfEncodedMapping, sourceMapSpan: decodeOfEncodedMapping };
187187
}
188188

@@ -249,7 +249,7 @@ module Harness.SourceMapRecoder {
249249
mapString += " name (" + sourceMapNames[mapEntry.nameIndex] + ")";
250250
}
251251
else {
252-
if (mapEntry.nameIndex != -1 || getAbsentNameIndex) {
252+
if (mapEntry.nameIndex !== -1 || getAbsentNameIndex) {
253253
mapString += " nameIndex (" + mapEntry.nameIndex + ")";
254254
}
255255
}
@@ -262,12 +262,12 @@ module Harness.SourceMapRecoder {
262262
var decodeResult = SourceMapDecoder.decodeNextEncodedSourceMapSpan();
263263
var decodedErrors: string[];
264264
if (decodeResult.error
265-
|| decodeResult.sourceMapSpan.emittedLine != sourceMapSpan.emittedLine
266-
|| decodeResult.sourceMapSpan.emittedColumn != sourceMapSpan.emittedColumn
267-
|| decodeResult.sourceMapSpan.sourceLine != sourceMapSpan.sourceLine
268-
|| decodeResult.sourceMapSpan.sourceColumn != sourceMapSpan.sourceColumn
269-
|| decodeResult.sourceMapSpan.sourceIndex != sourceMapSpan.sourceIndex
270-
|| decodeResult.sourceMapSpan.nameIndex != sourceMapSpan.nameIndex) {
265+
|| decodeResult.sourceMapSpan.emittedLine !== sourceMapSpan.emittedLine
266+
|| decodeResult.sourceMapSpan.emittedColumn !== sourceMapSpan.emittedColumn
267+
|| decodeResult.sourceMapSpan.sourceLine !== sourceMapSpan.sourceLine
268+
|| decodeResult.sourceMapSpan.sourceColumn !== sourceMapSpan.sourceColumn
269+
|| decodeResult.sourceMapSpan.sourceIndex !== sourceMapSpan.sourceIndex
270+
|| decodeResult.sourceMapSpan.nameIndex !== sourceMapSpan.nameIndex) {
271271
if (decodeResult.error) {
272272
decodedErrors = ["!!^^ !!^^ There was decoding error in the sourcemap at this location: " + decodeResult.error];
273273
}
@@ -288,7 +288,7 @@ module Harness.SourceMapRecoder {
288288
}
289289

290290
export function recordNewSourceFileSpan(sourceMapSpan: ts.SourceMapSpan, newSourceFileCode: string) {
291-
assert.isTrue(spansOnSingleLine.length == 0 || spansOnSingleLine[0].sourceMapSpan.emittedLine !== sourceMapSpan.emittedLine, "new file source map span should be on new line. We currently handle only that scenario");
291+
assert.isTrue(spansOnSingleLine.length === 0 || spansOnSingleLine[0].sourceMapSpan.emittedLine !== sourceMapSpan.emittedLine, "new file source map span should be on new line. We currently handle only that scenario");
292292
recordSourceMapSpan(sourceMapSpan);
293293

294294
assert.isTrue(spansOnSingleLine.length === 1);
@@ -395,9 +395,9 @@ module Harness.SourceMapRecoder {
395395

396396
var tsCodeLineMap = ts.computeLineStarts(sourceText);
397397
for (var i = 0; i < tsCodeLineMap.length; i++) {
398-
writeSourceMapIndent(prevEmittedCol, i == 0 ? markerIds[index] : " >");
398+
writeSourceMapIndent(prevEmittedCol, i === 0 ? markerIds[index] : " >");
399399
sourceMapRecoder.Write(getTextOfLine(i, tsCodeLineMap, sourceText));
400-
if (i == tsCodeLineMap.length - 1) {
400+
if (i === tsCodeLineMap.length - 1) {
401401
sourceMapRecoder.WriteLine("");
402402
}
403403
}
@@ -447,7 +447,7 @@ module Harness.SourceMapRecoder {
447447
for (var j = 0; j < sourceMapData.sourceMapDecodedMappings.length; j++) {
448448
var decodedSourceMapping = sourceMapData.sourceMapDecodedMappings[j];
449449
var currentSourceFile = program.getSourceFile(sourceMapData.inputSourceFileNames[decodedSourceMapping.sourceIndex]);
450-
if (currentSourceFile != prevSourceFile) {
450+
if (currentSourceFile !== prevSourceFile) {
451451
SourceMapSpanWriter.recordNewSourceFileSpan(decodedSourceMapping, currentSourceFile.text);
452452
prevSourceFile = currentSourceFile;
453453
}

src/services/formatting/rulesMap.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ namespace ts.formatting {
4141
}
4242

4343
private FillRule(rule: Rule, rulesBucketConstructionStateList: RulesBucketConstructionState[]): void {
44-
let specificRule = rule.Descriptor.LeftTokenRange != Shared.TokenRange.Any &&
45-
rule.Descriptor.RightTokenRange != Shared.TokenRange.Any;
44+
let specificRule = rule.Descriptor.LeftTokenRange !== Shared.TokenRange.Any &&
45+
rule.Descriptor.RightTokenRange !== Shared.TokenRange.Any;
4646

4747
rule.Descriptor.LeftTokenRange.GetTokens().forEach((left) => {
4848
rule.Descriptor.RightTokenRange.GetTokens().forEach((right) => {
4949
let rulesBucketIndex = this.GetRuleBucketIndex(left, right);
5050

5151
let rulesBucket = this.map[rulesBucketIndex];
52-
if (rulesBucket == undefined) {
52+
if (rulesBucket === undefined) {
5353
rulesBucket = this.map[rulesBucketIndex] = new RulesBucket();
5454
}
5555

@@ -124,7 +124,7 @@ namespace ts.formatting {
124124
public IncreaseInsertionIndex(maskPosition: RulesPosition): void {
125125
let value = (this.rulesInsertionIndexBitmap >> maskPosition) & Mask;
126126
value++;
127-
Debug.assert((value & Mask) == value, "Adding more rules into the sub-bucket than allowed. Maximum allowed is 32 rules.");
127+
Debug.assert((value & Mask) === value, "Adding more rules into the sub-bucket than allowed. Maximum allowed is 32 rules.");
128128

129129
let temp = this.rulesInsertionIndexBitmap & ~(Mask << maskPosition);
130130
temp |= value << maskPosition;
@@ -147,7 +147,7 @@ namespace ts.formatting {
147147
public AddRule(rule: Rule, specificTokens: boolean, constructionState: RulesBucketConstructionState[], rulesBucketIndex: number): void {
148148
let position: RulesPosition;
149149

150-
if (rule.Operation.Action == RuleAction.Ignore) {
150+
if (rule.Operation.Action === RuleAction.Ignore) {
151151
position = specificTokens ?
152152
RulesPosition.IgnoreRulesSpecific :
153153
RulesPosition.IgnoreRulesAny;

src/services/formatting/rulesProvider.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ namespace ts.formatting {
2525
}
2626

2727
public ensureUpToDate(options: ts.FormatCodeOptions) {
28+
// TODO: should this be '==='?
2829
if (this.options == null || !ts.compareDataObjects(this.options, options)) {
2930
let activeRules = this.createActiveRules(options);
3031
let rulesMap = RulesMap.create(activeRules);

src/services/formatting/tokenRange.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ namespace ts.formatting {
5454
}
5555

5656
public Contains(tokenValue: SyntaxKind): boolean {
57-
return tokenValue == this.token;
57+
return tokenValue === this.token;
5858
}
5959
}
6060

src/services/patternMatcher.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ namespace ts {
686686

687687
if (charIsPunctuation(identifier.charCodeAt(i - 1)) ||
688688
charIsPunctuation(identifier.charCodeAt(i)) ||
689-
lastIsDigit != currentIsDigit ||
689+
lastIsDigit !== currentIsDigit ||
690690
hasTransitionFromLowerToUpper ||
691691
hasTransitionFromUpperToLower) {
692692

@@ -757,7 +757,7 @@ namespace ts {
757757
// 3) HTMLDocument -> HTML, Document
758758
//
759759
// etc.
760-
if (index != wordStart &&
760+
if (index !== wordStart &&
761761
index + 1 < identifier.length) {
762762
let currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index));
763763
let nextIsLower = isLowerCaseLetter(identifier.charCodeAt(index + 1));

src/services/services.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6043,7 +6043,8 @@ namespace ts {
60436043
*/
60446044
function hasValueSideModule(symbol: Symbol): boolean {
60456045
return forEach(symbol.declarations, declaration => {
6046-
return declaration.kind === SyntaxKind.ModuleDeclaration && getModuleInstanceState(declaration) == ModuleInstanceState.Instantiated;
6046+
return declaration.kind === SyntaxKind.ModuleDeclaration &&
6047+
getModuleInstanceState(declaration) === ModuleInstanceState.Instantiated;
60476048
});
60486049
}
60496050
}

src/services/shims.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ namespace ts {
234234
public getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange {
235235
var oldSnapshotShim = <ScriptSnapshotShimAdapter>oldSnapshot;
236236
var encoded = this.scriptSnapshotShim.getChangeRange(oldSnapshotShim.scriptSnapshotShim);
237+
// TODO: should this be '==='?
237238
if (encoded == null) {
238239
return null;
239240
}
@@ -283,6 +284,7 @@ namespace ts {
283284

284285
public getCompilationSettings(): CompilerOptions {
285286
var settingsJson = this.shimHost.getCompilationSettings();
287+
// TODO: should this be '==='?
286288
if (settingsJson == null || settingsJson == "") {
287289
throw Error("LanguageServiceShimHostAdapter.getCompilationSettings: empty compilationSettings");
288290
return null;

0 commit comments

Comments
 (0)