From 7e03429a8e110efe5bb074ebe0e795b40f032b61 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Tue, 4 Apr 2017 15:51:13 -0700 Subject: [PATCH] enforce triple-equals --- src/compiler/checker.ts | 4 ++-- src/compiler/moduleNameResolver.ts | 2 +- src/compiler/program.ts | 4 ++-- src/compiler/tsc.ts | 6 +++--- src/compiler/utilities.ts | 2 +- src/harness/fourslash.ts | 8 ++++---- src/harness/harness.ts | 2 +- src/harness/projectsRunner.ts | 2 +- src/harness/sourceMapRecorder.ts | 8 ++++---- src/harness/unittests/tsserverProjectSystem.ts | 2 +- src/harness/unittests/versionCache.ts | 2 +- src/server/editorServices.ts | 6 +++--- src/server/project.ts | 2 +- src/server/scriptVersionCache.ts | 4 ++-- src/server/server.ts | 2 +- src/server/session.ts | 12 ++++++------ src/server/typingsCache.ts | 2 +- src/server/typingsInstaller/nodeTypingsInstaller.ts | 2 +- src/server/utilities.ts | 2 +- src/services/breakpoints.ts | 2 +- src/services/codefixes/fixAddMissingMember.ts | 2 +- .../codefixes/fixClassSuperMustPrecedeThisAccess.ts | 2 +- src/services/codefixes/unusedIdentifierFixes.ts | 2 +- src/services/completions.ts | 2 +- src/services/shims.ts | 6 +++--- src/services/signatureHelp.ts | 2 +- src/services/textChanges.ts | 2 +- src/services/utilities.ts | 4 ++-- tslint.json | 3 ++- 29 files changed, 51 insertions(+), 50 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 7bdde91f286..c1d10f41f79 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -338,7 +338,7 @@ namespace ts { TypeofNEHostObject = 1 << 13, // typeof x !== "xxx" EQUndefined = 1 << 14, // x === undefined EQNull = 1 << 15, // x === null - EQUndefinedOrNull = 1 << 16, // x == undefined / x == null + EQUndefinedOrNull = 1 << 16, // x === undefined / x === null NEUndefined = 1 << 17, // x !== undefined NENull = 1 << 18, // x !== null NEUndefinedOrNull = 1 << 19, // x != undefined / x != null @@ -17506,7 +17506,7 @@ namespace ts { function checkObjectTypeForDuplicateDeclarations(node: TypeLiteralNode | InterfaceDeclaration) { const names = createMap(); for (const member of node.members) { - if (member.kind == SyntaxKind.PropertySignature) { + if (member.kind === SyntaxKind.PropertySignature) { let memberName: string; switch (member.name.kind) { case SyntaxKind.StringLiteral: diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts index 699919e0566..99d7a914880 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -378,7 +378,7 @@ namespace ts { directoryPathMap.set(parent, result); current = parent; - if (current == commonPrefix) { + if (current === commonPrefix) { break; } } diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 31fc665649a..ea3110e5a6a 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -557,7 +557,7 @@ namespace ts { // combine results of resolutions and predicted results let j = 0; for (let i = 0; i < result.length; i++) { - if (result[i] == predictedToResolveToAmbientModuleMarker) { + if (result[i] === predictedToResolveToAmbientModuleMarker) { result[i] = undefined; } else { @@ -1364,7 +1364,7 @@ namespace ts { // If the file was previously found via a node_modules search, but is now being processed as a root file, // then everything it sucks in may also be marked incorrectly, and needs to be checked again. - if (file && sourceFilesFoundSearchingNodeModules.get(file.path) && currentNodeModulesDepth == 0) { + if (file && sourceFilesFoundSearchingNodeModules.get(file.path) && currentNodeModulesDepth === 0) { sourceFilesFoundSearchingNodeModules.set(file.path, false); if (!options.noResolve) { processReferencedFiles(file, isDefaultLib); diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index 4fd3ecb02bb..eb84b4ccb41 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -30,7 +30,7 @@ namespace ts { } function reportEmittedFiles(files: string[]): void { - if (!files || files.length == 0) { + if (!files || files.length === 0) { return; } @@ -282,7 +282,7 @@ namespace ts { // When the configFileName is just "tsconfig.json", the watched directory should be // the current directory; if there is a given "project" parameter, then the configFileName // is an absolute file name. - directory == "" ? "." : directory, + directory === "" ? "." : directory, watchedDirectoryChanged, /*recursive*/ true); } } @@ -334,7 +334,7 @@ namespace ts { // When the configFileName is just "tsconfig.json", the watched directory should be // the current directory; if there is a given "project" parameter, then the configFileName // is an absolute file name. - directory == "" ? "." : directory, + directory === "" ? "." : directory, watchedDirectoryChanged, /*recursive*/ true); }; } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 5c6e519519b..b5eea24782a 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -4658,7 +4658,7 @@ namespace ts { */ export function getParseTreeNode(node: Node, nodeTest?: (node: Node) => node is T): T; export function getParseTreeNode(node: Node, nodeTest?: (node: Node) => boolean): Node { - if (node == undefined || isParseTreeNode(node)) { + if (node === undefined || isParseTreeNode(node)) { return node; } diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 499c854b091..482b18274ec 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -2275,13 +2275,13 @@ namespace FourSlash { public verifyImportFixAtPosition(expectedTextArray: string[], errorCode?: number) { const ranges = this.getRanges(); - if (ranges.length == 0) { + if (ranges.length === 0) { this.raiseError("At least one range should be specified in the testfile."); } const codeFixes = this.getCodeFixActions(this.activeFile.fileName, errorCode); - if (!codeFixes || codeFixes.length == 0) { + if (!codeFixes || codeFixes.length === 0) { this.raiseError("No codefixes returned."); } @@ -2646,7 +2646,7 @@ namespace FourSlash { private assertItemInCompletionList(items: ts.CompletionEntry[], name: string, text?: string, documentation?: string, kind?: string, spanIndex?: number) { for (const item of items) { if (item.name === name) { - if (documentation != undefined || text !== undefined) { + if (documentation !== undefined || text !== undefined) { const details = this.getCompletionEntryDetails(item.name); if (documentation !== undefined) { @@ -2899,7 +2899,7 @@ ${code} } // TODO: should be '==='? } - else if (line == "" || lineLength === 0) { + else if (line === "" || lineLength === 0) { // Previously blank lines between fourslash content caused it to be considered as 2 files, // Remove this behavior since it just causes errors now } diff --git a/src/harness/harness.ts b/src/harness/harness.ts index 2c4eef1739d..c0ef2672b27 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -1933,7 +1933,7 @@ namespace Harness { } const parentDirectory = IO.directoryName(dirName); - if (parentDirectory != "") { + if (parentDirectory !== "") { createDirectoryStructure(parentDirectory); } IO.createDirectory(dirName); diff --git a/src/harness/projectsRunner.ts b/src/harness/projectsRunner.ts index f1cc992c4a7..0b032832194 100644 --- a/src/harness/projectsRunner.ts +++ b/src/harness/projectsRunner.ts @@ -112,7 +112,7 @@ class ProjectRunner extends RunnerBase { // Replace the disk specific path into the project root path url = url.substr(diskProjectPath.length); // TODO: should be '!=='? - if (url.charCodeAt(0) != ts.CharacterCodes.slash) { + if (url.charCodeAt(0) !== ts.CharacterCodes.slash) { url = "/" + url; } } diff --git a/src/harness/sourceMapRecorder.ts b/src/harness/sourceMapRecorder.ts index 0ef9f7eb49f..e2fce98da9e 100644 --- a/src/harness/sourceMapRecorder.ts +++ b/src/harness/sourceMapRecorder.ts @@ -50,11 +50,11 @@ namespace Harness.SourceMapRecorder { return true; } - if (sourceMapMappings.charAt(decodingIndex) == ",") { + if (sourceMapMappings.charAt(decodingIndex) === ",") { return true; } - if (sourceMapMappings.charAt(decodingIndex) == ";") { + if (sourceMapMappings.charAt(decodingIndex) === ";") { return true; } @@ -117,7 +117,7 @@ namespace Harness.SourceMapRecorder { } while (decodingIndex < sourceMapMappings.length) { - if (sourceMapMappings.charAt(decodingIndex) == ";") { + if (sourceMapMappings.charAt(decodingIndex) === ";") { // New line decodeOfEncodedMapping.emittedLine++; decodeOfEncodedMapping.emittedColumn = 1; @@ -125,7 +125,7 @@ namespace Harness.SourceMapRecorder { continue; } - if (sourceMapMappings.charAt(decodingIndex) == ",") { + if (sourceMapMappings.charAt(decodingIndex) === ",") { // Next entry is on same line - no action needed decodingIndex++; continue; diff --git a/src/harness/unittests/tsserverProjectSystem.ts b/src/harness/unittests/tsserverProjectSystem.ts index b78fa094571..839097f7e61 100644 --- a/src/harness/unittests/tsserverProjectSystem.ts +++ b/src/harness/unittests/tsserverProjectSystem.ts @@ -3144,7 +3144,7 @@ namespace ts.projectSystem { checkNumberOfInferredProjects(projectService, 1); const configuredProject = projectService.configuredProjects[0]; - assert.isTrue(configuredProject.getFileNames().length == 0); + assert.isTrue(configuredProject.getFileNames().length === 0); const inferredProject = projectService.inferredProjects[0]; assert.isTrue(inferredProject.containsFile(file1.path)); diff --git a/src/harness/unittests/versionCache.ts b/src/harness/unittests/versionCache.ts index 17a70f59d59..ca64ea1118f 100644 --- a/src/harness/unittests/versionCache.ts +++ b/src/harness/unittests/versionCache.ts @@ -278,7 +278,7 @@ and grew 1cm per day`; const insertString = testContent.substring(rsa[i], rsa[i] + las[i]); svc.edit(ersa[i], elas[i], insertString); checkText = editFlat(ersa[i], elas[i], insertString, checkText); - if (0 == (i % 4)) { + if (0 === (i % 4)) { const snap = svc.getSnapshot(); const snapText = snap.getText(0, checkText.length); assert.equal(checkText, snapText); diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 30c7a87dc74..12eae74d602 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -204,7 +204,7 @@ namespace ts.server { startWatchingContainingDirectoriesForFile(fileName: string, project: InferredProject, callback: (fileName: string) => void) { let currentPath = getDirectoryPath(fileName); let parentPath = getDirectoryPath(currentPath); - while (currentPath != parentPath) { + while (currentPath !== parentPath) { if (!this.directoryWatchersForTsconfig.has(currentPath)) { this.projectService.logger.info(`Add watcher for: ${currentPath}`); this.directoryWatchersForTsconfig.set(currentPath, this.projectService.host.watchDirectory(currentPath, callback)); @@ -540,7 +540,7 @@ namespace ts.server { */ private onConfigFileAddedForInferredProject(fileName: string) { // TODO: check directory separators - if (getBaseFileName(fileName) != "tsconfig.json") { + if (getBaseFileName(fileName) !== "tsconfig.json") { this.logger.info(`${fileName} is not tsconfig.json`); return; } @@ -950,7 +950,7 @@ namespace ts.server { const scriptKind = propertyReader.getScriptKind(f); const hasMixedContent = propertyReader.hasMixedContent(f, this.hostConfiguration.extraFileExtensions); if (this.host.fileExists(rootFilename)) { - const info = this.getOrCreateScriptInfoForNormalizedPath(toNormalizedPath(rootFilename), /*openedByClient*/ clientFileName == rootFilename, /*fileContent*/ undefined, scriptKind, hasMixedContent); + const info = this.getOrCreateScriptInfoForNormalizedPath(toNormalizedPath(rootFilename), /*openedByClient*/ clientFileName === rootFilename, /*fileContent*/ undefined, scriptKind, hasMixedContent); project.addRoot(info); } else { diff --git a/src/server/project.ts b/src/server/project.ts index e57e605d65b..9e3e6e6a892 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -643,7 +643,7 @@ namespace ts.server { // check if requested version is the same that we have reported last time if (this.lastReportedFileNames && lastKnownVersion === this.lastReportedVersion) { // if current structure version is the same - return info without any changes - if (this.projectStructureVersion == this.lastReportedVersion && !updatedFileNames) { + if (this.projectStructureVersion === this.lastReportedVersion && !updatedFileNames) { return { info, projectErrors: this.projectErrors }; } // compute and return the difference diff --git a/src/server/scriptVersionCache.ts b/src/server/scriptVersionCache.ts index 7f09bcd549b..35266591098 100644 --- a/src/server/scriptVersionCache.ts +++ b/src/server/scriptVersionCache.ts @@ -79,7 +79,7 @@ namespace ts.server { const lm = LineIndex.linesFromText(insertedText); const lines = lm.lines; if (lines.length > 1) { - if (lines[lines.length - 1] == "") { + if (lines[lines.length - 1] === "") { lines.length--; } } @@ -570,7 +570,7 @@ namespace ts.server { } if (this.checkEdits) { const updatedText = this.getText(0, this.root.charCount()); - Debug.assert(checkText == updatedText, "buffer edit mismatch"); + Debug.assert(checkText === updatedText, "buffer edit mismatch"); } return walker.lineIndex; } diff --git a/src/server/server.ts b/src/server/server.ts index e38f82f35f6..f5244c3b367 100644 --- a/src/server/server.ts +++ b/src/server/server.ts @@ -367,7 +367,7 @@ namespace ts.server { } this.projectService.updateTypingsForProject(response); - if (response.kind == ActionSet && this.socket) { + if (response.kind === ActionSet && this.socket) { this.sendEvent(0, "setTypings", response); } } diff --git a/src/server/session.ts b/src/server/session.ts index 4cdddc831a1..fa44405ef36 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -49,7 +49,7 @@ namespace ts.server { if (a.file < b.file) { return -1; } - else if (a.file == b.file) { + else if (a.file === b.file) { const n = compareNumber(a.start.line, b.start.line); if (n === 0) { return compareNumber(a.start.offset, b.start.offset); @@ -1084,7 +1084,7 @@ namespace ts.server { // getFormattingEditsAfterKeystroke either empty or pertaining // only to the previous line. If all this is true, then // add edits necessary to properly indent the current line. - if ((args.key == "\n") && ((!edits) || (edits.length === 0) || allEditsBeforePos(edits, position))) { + if ((args.key === "\n") && ((!edits) || (edits.length === 0) || allEditsBeforePos(edits, position))) { const lineInfo = scriptInfo.getLineInfo(args.line); if (lineInfo && (lineInfo.leaf) && (lineInfo.leaf.text)) { const lineText = lineInfo.leaf.text; @@ -1093,10 +1093,10 @@ namespace ts.server { let hasIndent = 0; let i: number, len: number; for (i = 0, len = lineText.length; i < len; i++) { - if (lineText.charAt(i) == " ") { + if (lineText.charAt(i) === " ") { hasIndent++; } - else if (lineText.charAt(i) == "\t") { + else if (lineText.charAt(i) === "\t") { hasIndent += formatOptions.tabSize; } else { @@ -1499,7 +1499,7 @@ namespace ts.server { const normalizedFileName = toNormalizedPath(fileName); const project = this.projectService.getDefaultProjectForFile(normalizedFileName, /*refreshInferredProjects*/ true); for (const fileNameInProject of fileNamesInProject) { - if (this.getCanonicalFileName(fileNameInProject) == this.getCanonicalFileName(fileName)) + if (this.getCanonicalFileName(fileNameInProject) === this.getCanonicalFileName(fileName)) highPriorityFiles.push(fileNameInProject); else { const info = this.projectService.getScriptInfo(fileNameInProject); @@ -1520,7 +1520,7 @@ namespace ts.server { const checkList = fileNamesInProject.map(fileName => ({ fileName, project })); // Project level error analysis runs on background files too, therefore // doesn't require the file to be opened - this.updateErrorCheck(next, checkList, this.changeSeq, (n) => n == this.changeSeq, delay, 200, /*requireOpen*/ false); + this.updateErrorCheck(next, checkList, this.changeSeq, (n) => n === this.changeSeq, delay, 200, /*requireOpen*/ false); } } diff --git a/src/server/typingsCache.ts b/src/server/typingsCache.ts index 9379ae82d0e..a97b12ff7a8 100644 --- a/src/server/typingsCache.ts +++ b/src/server/typingsCache.ts @@ -61,7 +61,7 @@ namespace ts.server { function compilerOptionsChanged(opt1: CompilerOptions, opt2: CompilerOptions): boolean { // TODO: add more relevant properties - return opt1.allowJs != opt2.allowJs; + return opt1.allowJs !== opt2.allowJs; } function unresolvedImportsChanged(imports1: SortedReadonlyArray, imports2: SortedReadonlyArray): boolean { diff --git a/src/server/typingsInstaller/nodeTypingsInstaller.ts b/src/server/typingsInstaller/nodeTypingsInstaller.ts index 1018b37d90d..895a4e17cc7 100644 --- a/src/server/typingsInstaller/nodeTypingsInstaller.ts +++ b/src/server/typingsInstaller/nodeTypingsInstaller.ts @@ -31,7 +31,7 @@ namespace ts.server.typingsInstaller { } function getNPMLocation(processName: string) { - if (path.basename(processName).indexOf("node") == 0) { + if (path.basename(processName).indexOf("node") === 0) { return `"${path.join(path.dirname(process.argv[0]), "npm")}"`; } else { diff --git a/src/server/utilities.ts b/src/server/utilities.ts index af1f8e9826f..0f0c2e236c8 100644 --- a/src/server/utilities.ts +++ b/src/server/utilities.ts @@ -219,7 +219,7 @@ namespace ts.server { } public scheduleCollect() { - if (!this.host.gc || this.timerId != undefined) { + if (!this.host.gc || this.timerId !== undefined) { // no global.gc or collection was already scheduled - skip this request return; } diff --git a/src/services/breakpoints.ts b/src/services/breakpoints.ts index 1f6bec41109..1f0b3add897 100644 --- a/src/services/breakpoints.ts +++ b/src/services/breakpoints.ts @@ -264,7 +264,7 @@ namespace ts.BreakpointResolver { // a or ...c or d: x from // [a, b, ...c] or { a, b } or { d: x } from destructuring pattern if ((node.kind === SyntaxKind.Identifier || - node.kind == SyntaxKind.SpreadElement || + node.kind === SyntaxKind.SpreadElement || node.kind === SyntaxKind.PropertyAssignment || node.kind === SyntaxKind.ShorthandPropertyAssignment) && isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { diff --git a/src/services/codefixes/fixAddMissingMember.ts b/src/services/codefixes/fixAddMissingMember.ts index ec772e1e29e..7beae849d5e 100644 --- a/src/services/codefixes/fixAddMissingMember.ts +++ b/src/services/codefixes/fixAddMissingMember.ts @@ -14,7 +14,7 @@ namespace ts.codefix { // ^^^^^^^ const token = getTokenAtPosition(sourceFile, start); - if (token.kind != SyntaxKind.Identifier) { + if (token.kind !== SyntaxKind.Identifier) { return undefined; } diff --git a/src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts b/src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts index fc2be3cd0c2..2217dda8b0c 100644 --- a/src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts +++ b/src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts @@ -18,7 +18,7 @@ namespace ts.codefix { // figure out if the `this` access is actually inside the supercall // i.e. super(this.a), since in that case we won't suggest a fix - if (superCall.expression && superCall.expression.kind == SyntaxKind.CallExpression) { + if (superCall.expression && superCall.expression.kind === SyntaxKind.CallExpression) { const arguments = (superCall.expression).arguments; for (let i = 0; i < arguments.length; i++) { if ((arguments[i]).expression === token) { diff --git a/src/services/codefixes/unusedIdentifierFixes.ts b/src/services/codefixes/unusedIdentifierFixes.ts index f77f9723d0f..70d61f2be2a 100644 --- a/src/services/codefixes/unusedIdentifierFixes.ts +++ b/src/services/codefixes/unusedIdentifierFixes.ts @@ -125,7 +125,7 @@ namespace ts.codefix { case SyntaxKind.NamespaceImport: const namespaceImport = token.parent; - if (namespaceImport.name == token && !(namespaceImport.parent).name) { + if (namespaceImport.name === token && !(namespaceImport.parent).name) { const importDecl = getAncestor(namespaceImport, SyntaxKind.ImportDeclaration); return deleteNode(importDecl); } diff --git a/src/services/completions.ts b/src/services/completions.ts index 67890a9b000..c06a4f9504a 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -1311,7 +1311,7 @@ namespace ts.Completions { } function isEqualityOperatorKind(kind: SyntaxKind) { - return kind == SyntaxKind.EqualsEqualsToken || + return kind === SyntaxKind.EqualsEqualsToken || kind === SyntaxKind.ExclamationEqualsToken || kind === SyntaxKind.EqualsEqualsEqualsToken || kind === SyntaxKind.ExclamationEqualsEqualsToken; diff --git a/src/services/shims.ts b/src/services/shims.ts index de2fd39b8a8..b2222628735 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -293,7 +293,7 @@ namespace ts { const oldSnapshotShim = oldSnapshot; const encoded = this.scriptSnapshotShim.getChangeRange(oldSnapshotShim.scriptSnapshotShim); // TODO: should this be '==='? - if (encoded == null) { + if (encoded === null) { return null; } @@ -382,7 +382,7 @@ namespace ts { public getCompilationSettings(): CompilerOptions { const settingsJson = this.shimHost.getCompilationSettings(); // TODO: should this be '==='? - if (settingsJson == null || settingsJson == "") { + if (settingsJson === null || settingsJson === "") { throw Error("LanguageServiceShimHostAdapter.getCompilationSettings: empty compilationSettings"); } const compilerOptions = JSON.parse(settingsJson); @@ -416,7 +416,7 @@ namespace ts { public getLocalizedDiagnosticMessages(): any { const diagnosticMessagesJson = this.shimHost.getLocalizedDiagnosticMessages(); - if (diagnosticMessagesJson == null || diagnosticMessagesJson == "") { + if (diagnosticMessagesJson === null || diagnosticMessagesJson === "") { return null; } diff --git a/src/services/signatureHelp.ts b/src/services/signatureHelp.ts index 7b2abc6123c..1487bb410a5 100644 --- a/src/services/signatureHelp.ts +++ b/src/services/signatureHelp.ts @@ -56,7 +56,7 @@ namespace ts.SignatureHelp { // break; // case TypeScript.SyntaxKind.CommaToken: - // if (stack == 0) { + // if (stack === 0) { // argumentIndex++; // } diff --git a/src/services/textChanges.ts b/src/services/textChanges.ts index afc98927495..f19fa548964 100644 --- a/src/services/textChanges.ts +++ b/src/services/textChanges.ts @@ -465,7 +465,7 @@ namespace ts.textChanges { change.options.indentation !== undefined ? change.options.indentation : change.useIndentationFromFile - ? formatting.SmartIndenter.getIndentation(change.range.pos, sourceFile, formatOptions, posStartsLine || (change.options.prefix == this.newLineCharacter)) + ? formatting.SmartIndenter.getIndentation(change.range.pos, sourceFile, formatOptions, posStartsLine || (change.options.prefix === this.newLineCharacter)) : 0; const delta = change.options.delta !== undefined diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 2c48cd79b9b..53dd1d479cd 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -911,10 +911,10 @@ namespace ts { // Internally, we represent the end of the comment at the newline and closing '/', respectively. return predicate ? forEach(commentRanges, c => c.pos < position && - (c.kind == SyntaxKind.SingleLineCommentTrivia ? position <= c.end : position < c.end) && + (c.kind === SyntaxKind.SingleLineCommentTrivia ? position <= c.end : position < c.end) && predicate(c)) : forEach(commentRanges, c => c.pos < position && - (c.kind == SyntaxKind.SingleLineCommentTrivia ? position <= c.end : position < c.end)); + (c.kind === SyntaxKind.SingleLineCommentTrivia ? position <= c.end : position < c.end)); } return false; diff --git a/tslint.json b/tslint.json index be722309a24..b3a5664c1ad 100644 --- a/tslint.json +++ b/tslint.json @@ -59,6 +59,7 @@ "no-increment-decrement": true, "object-literal-surrounding-space": true, "no-type-assertion-whitespace": true, - "no-in-operator": true + "no-in-operator": true, + "triple-equals": true } }