enforce triple-equals

This commit is contained in:
Arthur Ozga
2017-04-04 15:51:13 -07:00
parent 9bfba73418
commit 7e03429a8e
29 changed files with 51 additions and 50 deletions

View File

@@ -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)) {

View File

@@ -14,7 +14,7 @@ namespace ts.codefix {
// ^^^^^^^
const token = getTokenAtPosition(sourceFile, start);
if (token.kind != SyntaxKind.Identifier) {
if (token.kind !== SyntaxKind.Identifier) {
return undefined;
}

View File

@@ -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 = (<CallExpression>superCall.expression).arguments;
for (let i = 0; i < arguments.length; i++) {
if ((<PropertyAccessExpression>arguments[i]).expression === token) {

View File

@@ -125,7 +125,7 @@ namespace ts.codefix {
case SyntaxKind.NamespaceImport:
const namespaceImport = <NamespaceImport>token.parent;
if (namespaceImport.name == token && !(<ImportClause>namespaceImport.parent).name) {
if (namespaceImport.name === token && !(<ImportClause>namespaceImport.parent).name) {
const importDecl = getAncestor(namespaceImport, SyntaxKind.ImportDeclaration);
return deleteNode(importDecl);
}

View File

@@ -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;

View File

@@ -293,7 +293,7 @@ namespace ts {
const oldSnapshotShim = <ScriptSnapshotShimAdapter>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 = <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;
}

View File

@@ -56,7 +56,7 @@ namespace ts.SignatureHelp {
// break;
// case TypeScript.SyntaxKind.CommaToken:
// if (stack == 0) {
// if (stack === 0) {
// argumentIndex++;
// }

View File

@@ -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

View File

@@ -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;