diff --git a/packages/compiler/src/ml_parser/html_tags.ts b/packages/compiler/src/ml_parser/html_tags.ts index ffde2b7679..78c61b2cb1 100644 --- a/packages/compiler/src/ml_parser/html_tags.ts +++ b/packages/compiler/src/ml_parser/html_tags.ts @@ -54,7 +54,7 @@ export class HtmlTagDefinition implements TagDefinition { getContentType(prefix?: string): TagContentType { if (typeof this.contentType === 'object') { - const overrideType = prefix == null ? undefined : this.contentType[prefix]; + const overrideType = prefix === undefined ? undefined : this.contentType[prefix]; return overrideType ?? this.contentType.default; } return this.contentType; diff --git a/packages/compiler/src/ml_parser/icu_ast_expander.ts b/packages/compiler/src/ml_parser/icu_ast_expander.ts index f52affd590..6e1028422a 100644 --- a/packages/compiler/src/ml_parser/icu_ast_expander.ts +++ b/packages/compiler/src/ml_parser/icu_ast_expander.ts @@ -80,8 +80,8 @@ class _Expander implements html.Visitor { visitExpansion(icu: html.Expansion, context: any): any { this.isExpanded = true; - return icu.type == 'plural' ? _expandPluralForm(icu, this.errors) : - _expandDefaultForm(icu, this.errors); + return icu.type === 'plural' ? _expandPluralForm(icu, this.errors) : + _expandDefaultForm(icu, this.errors); } visitExpansionCase(icuCase: html.ExpansionCase, context: any): any { @@ -92,7 +92,7 @@ class _Expander implements html.Visitor { // Plural forms are expanded to `NgPlural` and `NgPluralCase`s function _expandPluralForm(ast: html.Expansion, errors: ParseError[]): html.Element { const children = ast.cases.map(c => { - if (PLURAL_CASES.indexOf(c.value) == -1 && !c.value.match(/^=\d+$/)) { + if (PLURAL_CASES.indexOf(c.value) === -1 && !c.value.match(/^=\d+$/)) { errors.push(new ExpansionError( c.valueSourceSpan, `Plural cases should be "=" or one of ${PLURAL_CASES.join(', ')}`)); diff --git a/packages/compiler/src/ml_parser/lexer.ts b/packages/compiler/src/ml_parser/lexer.ts index 34b16ab423..fb5ce94cf1 100644 --- a/packages/compiler/src/ml_parser/lexer.ts +++ b/packages/compiler/src/ml_parser/lexer.ts @@ -881,11 +881,11 @@ function isPrefixEnd(code: number): boolean { } function isDigitEntityEnd(code: number): boolean { - return code == chars.$SEMICOLON || code == chars.$EOF || !chars.isAsciiHexDigit(code); + return code === chars.$SEMICOLON || code === chars.$EOF || !chars.isAsciiHexDigit(code); } function isNamedEntityEnd(code: number): boolean { - return code == chars.$SEMICOLON || code == chars.$EOF || !chars.isAsciiLetter(code); + return code === chars.$SEMICOLON || code === chars.$EOF || !chars.isAsciiLetter(code); } function isExpansionCaseStart(peek: number): boolean { @@ -893,7 +893,7 @@ function isExpansionCaseStart(peek: number): boolean { } function compareCharCodeCaseInsensitive(code1: number, code2: number): boolean { - return toUpperCaseCharCode(code1) == toUpperCaseCharCode(code2); + return toUpperCaseCharCode(code1) === toUpperCaseCharCode(code2); } function toUpperCaseCharCode(code: number): number { @@ -905,9 +905,9 @@ function mergeTextTokens(srcTokens: Token[]): Token[] { let lastDstToken: Token|undefined = undefined; for (let i = 0; i < srcTokens.length; i++) { const token = srcTokens[i]; - if ((lastDstToken && lastDstToken.type == TokenType.TEXT && token.type == TokenType.TEXT) || - (lastDstToken && lastDstToken.type == TokenType.ATTR_VALUE_TEXT && - token.type == TokenType.ATTR_VALUE_TEXT)) { + if ((lastDstToken && lastDstToken.type === TokenType.TEXT && token.type === TokenType.TEXT) || + (lastDstToken && lastDstToken.type === TokenType.ATTR_VALUE_TEXT && + token.type === TokenType.ATTR_VALUE_TEXT)) { lastDstToken.parts[0]! += token.parts[0]; lastDstToken.sourceSpan.end = token.sourceSpan.end; } else { diff --git a/packages/compiler/src/ml_parser/parser.ts b/packages/compiler/src/ml_parser/parser.ts index ec1157c01d..06b6ea6a69 100644 --- a/packages/compiler/src/ml_parser/parser.ts +++ b/packages/compiler/src/ml_parser/parser.ts @@ -187,7 +187,7 @@ class _TreeBuilder { if (this._peek.type === TokenType.EXPANSION_CASE_EXP_END) { if (lastOnStack(expansionFormStack, TokenType.EXPANSION_CASE_EXP_START)) { expansionFormStack.pop(); - if (expansionFormStack.length == 0) return exp; + if (expansionFormStack.length === 0) return exp; } else { this.errors.push( @@ -220,9 +220,9 @@ class _TreeBuilder { const tokens = [token]; const startSpan = token.sourceSpan; let text = token.parts[0]; - if (text.length > 0 && text[0] == '\n') { + if (text.length > 0 && text[0] === '\n') { const parent = this._getParentElement(); - if (parent != null && parent.children.length == 0 && + if (parent != null && parent.children.length === 0 && this.getTagDefinition(parent.name).ignoreFirstLf) { text = text.substring(1); tokens[0] = {type: token.type, sourceSpan: token.sourceSpan, parts: [text]} as typeof token; @@ -342,7 +342,7 @@ class _TreeBuilder { let unexpectedCloseTagDetected = false; for (let stackIndex = this._elementStack.length - 1; stackIndex >= 0; stackIndex--) { const el = this._elementStack[stackIndex]; - if (el.name == fullName) { + if (el.name === fullName) { // Record the parse span with the element that is being closed. Any elements that are // removed from the element stack at this point are closed implicitly, so they won't get // an end source span (as there is no explicit closing element). diff --git a/packages/compiler/src/ml_parser/tags.ts b/packages/compiler/src/ml_parser/tags.ts index 19b95ec712..af58e73092 100644 --- a/packages/compiler/src/ml_parser/tags.ts +++ b/packages/compiler/src/ml_parser/tags.ts @@ -31,7 +31,7 @@ export function splitNsName(elementName: string): [string|null, string] { const colonIndex = elementName.indexOf(':', 1); - if (colonIndex == -1) { + if (colonIndex === -1) { throw new Error(`Unsupported format "${elementName}" expecting ":namespace:name"`); }