Commit 5a181118 authored by Demetrios Papadopoulos's avatar Demetrios Papadopoulos Committed by Commit Bot

WebUI: Enforce ESLint eqeqeq rule in c/b/r/new_tab_page/

The rule disallows == in favor of ===, and != in favor of !==, which
matches the Google JS styleguide (which Chromium's JS styleguide
inherits from).

Bug: 720034
Change-Id: Id257bce33e681ad227ff5bd4212b1f8d3c28b867
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1980214Reviewed-by: default avatarMoe Ahmadi <mahmadi@chromium.org>
Commit-Queue: Demetrios Papadopoulos <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#727299}
parent c7657c87
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module.exports = {
'env': {
'browser': true,
'es6': true,
},
'rules': {'eqeqeq': ['error', 'always', {'null': 'ignore'}]},
};
......@@ -100,7 +100,7 @@ class CustomizeDialogElement extends PolymerElement {
this.setThemeListenerId_ =
this.callbackRouter_.setTheme.addListener(theme => {
this.theme_ = theme;
if (theme.type != newTabPage.mojom.ThemeType.AUTOGENERATED) {
if (theme.type !== newTabPage.mojom.ThemeType.AUTOGENERATED) {
return;
}
const rgbFrameColor =
......@@ -171,13 +171,13 @@ class CustomizeDialogElement extends PolymerElement {
if (!this.theme_) {
return false;
}
if (id == 'autogenerated') {
return this.theme_.type == newTabPage.mojom.ThemeType.AUTOGENERATED;
} else if (id == 'default') {
return this.theme_.type == newTabPage.mojom.ThemeType.DEFAULT;
if (id === 'autogenerated') {
return this.theme_.type === newTabPage.mojom.ThemeType.AUTOGENERATED;
} else if (id === 'default') {
return this.theme_.type === newTabPage.mojom.ThemeType.DEFAULT;
} else {
return this.theme_.type == newTabPage.mojom.ThemeType.CHROME &&
id == this.theme_.info.chromeThemeId;
return this.theme_.type === newTabPage.mojom.ThemeType.CHROME &&
id === this.theme_.info.chromeThemeId;
}
}
}
......
......@@ -363,9 +363,9 @@ class MostVisitedElement extends PolymerElement {
const dropIndex = getHitIndex(this.tileRects_, x, y);
this.tileElements_.forEach((element, i) => {
let positionIndex;
if (i == dragIndex) {
if (i === dragIndex) {
return;
} else if (dropIndex == -1) {
} else if (dropIndex === -1) {
positionIndex = i;
} else if (dragIndex < dropIndex && dragIndex <= i && i <= dropIndex) {
positionIndex = i - 1;
......@@ -486,7 +486,7 @@ class MostVisitedElement extends PolymerElement {
return;
}
const backKey = this.isRtl_ ? 'ArrowRight' : 'ArrowLeft';
if (e.key === backKey || e.key == 'ArrowUp') {
if (e.key === backKey || e.key === 'ArrowUp') {
this.tileFocus_(this.tiles_.length - 1);
}
}
......@@ -515,7 +515,7 @@ class MostVisitedElement extends PolymerElement {
}
const modifier = isMac ? e.metaKey && !e.ctrlKey : e.ctrlKey && !e.metaKey;
if (modifier && e.key == 'z') {
if (modifier && e.key === 'z') {
e.preventDefault();
this.pageHandler_.undoMostVisitedTileAction();
}
......@@ -642,19 +642,19 @@ class MostVisitedElement extends PolymerElement {
return;
}
if (e.key != 'ArrowLeft' && e.key != 'ArrowRight' && e.key != 'ArrowUp' &&
e.key != 'ArrowDown' && e.key != 'Delete') {
if (e.key !== 'ArrowLeft' && e.key !== 'ArrowRight' &&
e.key !== 'ArrowUp' && e.key !== 'ArrowDown' && e.key !== 'Delete') {
return;
}
const {index} = this.$.tiles.modelForElement(e.target);
if (e.key == 'Delete') {
if (e.key === 'Delete') {
this.tileRemove_(index);
return;
}
const advanceKey = this.isRtl_ ? 'ArrowLeft' : 'ArrowRight';
const delta = (e.key == advanceKey || e.key == 'ArrowDown') ? 1 : -1;
const delta = (e.key === advanceKey || e.key === 'ArrowDown') ? 1 : -1;
this.tileFocus_(Math.max(0, index + delta));
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment