diff --git a/packages/language-service/src/completions.ts b/packages/language-service/src/completions.ts index e58a5d066f..bd0f35c573 100644 --- a/packages/language-service/src/completions.ts +++ b/packages/language-service/src/completions.ts @@ -147,7 +147,7 @@ function getAttributeInfosForElement( if (selectors && selectors.length) { // All the attributes that are selectable should be shown. const applicableSelectors = - selectors.filter(selector => !selector.element || selector.element == elementName); + selectors.filter(selector => !selector.element || selector.element === elementName); const selectorAndAttributeNames = applicableSelectors.map(selector => ({selector, attrs: selector.attrs.filter(a => !!a)})); let attrs = flatten(selectorAndAttributeNames.map(selectorAndAttr => { @@ -353,7 +353,7 @@ class ExpressionVisitor extends NullTemplateVisitor { const selectorInfo = getSelectors(this.info); const selectors = selectorInfo.selectors; const selector = - selectors.filter(s => s.attrs.some((attr, i) => i % 2 == 0 && attr == key))[0]; + selectors.filter(s => s.attrs.some((attr, i) => i % 2 === 0 && attr === key))[0]; const templateBindingResult = this.info.expressionParser.parseTemplateBindings(key, this.attr.value, null, 0); @@ -370,7 +370,7 @@ class ExpressionVisitor extends NullTemplateVisitor { const keyCompletions = () => { let keys: string[] = []; if (selector) { - const attrNames = selector.attrs.filter((_, i) => i % 2 == 0); + const attrNames = selector.attrs.filter((_, i) => i % 2 === 0); keys = attrNames.filter(name => name.startsWith(key) && name != key) .map(name => lowerName(name.substr(key.length))); } @@ -386,7 +386,7 @@ class ExpressionVisitor extends NullTemplateVisitor { }); }; - if (!binding || (binding.key == key && !binding.expression)) { + if (!binding || (binding.key === key && !binding.expression)) { // We are in the root binding. We should return `let` and keys that are left in the // selector. keyCompletions(); @@ -442,8 +442,8 @@ class ExpressionVisitor extends NullTemplateVisitor { private attributeValueCompletions(value: AST, position?: number) { const symbols = getExpressionCompletions( - this.getExpressionScope(), value, position == null ? this.attributeValuePosition : position, - this.info.template.query); + this.getExpressionScope(), value, + position === undefined ? this.attributeValuePosition : position, this.info.template.query); if (symbols) { this.result = this.symbolsToCompletions(symbols); } @@ -503,7 +503,7 @@ function createElementCssSelector(element: Element): CssSelector { if (!attr.name.match(templateAttr)) { const [_, attrNameNoNs] = splitNsName(attr.name); cssSelector.addAttribute(attrNameNoNs, attr.value); - if (attr.name.toLowerCase() == 'class') { + if (attr.name.toLowerCase() === 'class') { const classes = attr.value.split(/s+/g); classes.forEach(className => cssSelector.addClassName(className)); } diff --git a/packages/language-service/src/html_info.ts b/packages/language-service/src/html_info.ts index 7089e26726..b54243ba2f 100644 --- a/packages/language-service/src/html_info.ts +++ b/packages/language-service/src/html_info.ts @@ -399,7 +399,7 @@ export class SchemaInformation { } } properties.forEach((property: string) => { - if (property == '') { + if (property === '') { } else if (property.startsWith('*')) { type[property.substring(1)] = EVENT; } else if (property.startsWith('!')) { diff --git a/packages/language-service/src/utils.ts b/packages/language-service/src/utils.ts index 6b8ca94b27..e2ee41416b 100644 --- a/packages/language-service/src/utils.ts +++ b/packages/language-service/src/utils.ts @@ -60,7 +60,7 @@ export function hasTemplateReference(type: CompileTypeMetadata): boolean { if (type.diDeps) { for (let diDep of type.diDeps) { if (diDep.token && diDep.token.identifier && - identifierName(diDep.token !.identifier !) == 'TemplateRef') + identifierName(diDep.token !.identifier !) === 'TemplateRef') return true; } } @@ -149,7 +149,7 @@ export function findTemplateAstAt( // Ignore the host properties of a directive const result = this.visitChildren(context, visit => { visit(ast.inputs); }); // We never care about the diretive itself, just its inputs. - if (path[path.length - 1] == ast) { + if (path[path.length - 1] === ast) { path.pop(); } return result;