js: Fix @typescript-eslint/restrict-plus-operands.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2021-09-22 14:34:58 -07:00
committed by Anders Kaseorg
parent af1e34b348
commit f7a7cfea62
8 changed files with 12 additions and 12 deletions

View File

@@ -62,7 +62,7 @@ async function navigate_to_subscriptions(page: Page): Promise<void> {
async function test_reload_hash(page: Page): Promise<void> { async function test_reload_hash(page: Page): Promise<void> {
const initial_page_load_time = await page.evaluate(() => zulip_test.page_params.page_load_time); const initial_page_load_time = await page.evaluate(() => zulip_test.page_params.page_load_time);
console.log("initial load time: " + initial_page_load_time); console.log(`initial load time: ${initial_page_load_time}`);
const initial_hash = await page.evaluate(() => window.location.hash); const initial_hash = await page.evaluate(() => window.location.hash);

View File

@@ -29,7 +29,7 @@ async function realm_creation_tests(page: Page): Promise<void> {
// Open the confirmation URL // Open the confirmation URL
const page_content = await page.evaluate(() => document.querySelector("body")!.textContent); const page_content = await page.evaluate(() => document.querySelector("body")!.textContent);
const confirmation_key = await JSON.parse(page_content!).confirmation_key; const confirmation_key = await JSON.parse(page_content!).confirmation_key;
const confirmation_url = "http://" + host + "/accounts/do_confirm/" + confirmation_key; const confirmation_url = `http://${host}/accounts/do_confirm/${confirmation_key}`;
await page.goto(confirmation_url); await page.goto(confirmation_url);
// We wait until the DOMContentLoaded event because we want the code // We wait until the DOMContentLoaded event because we want the code

View File

@@ -167,7 +167,7 @@ export function exception_msg(
if (ex.fileName !== undefined) { if (ex.fileName !== undefined) {
message += " at " + ex.fileName; message += " at " + ex.fileName;
if (ex.lineNumber !== undefined) { if (ex.lineNumber !== undefined) {
message += ":" + ex.lineNumber; message += `:${ex.lineNumber}`;
} }
} }
return message; return message;

View File

@@ -114,7 +114,7 @@ export function get_language_list_columns(default_language: string): LanguageLis
const name = lang.name; const name = lang.name;
let name_with_percent = name; let name_with_percent = name;
if (lang.percent_translated !== undefined) { if (lang.percent_translated !== undefined) {
name_with_percent = name + " (" + lang.percent_translated + "%)"; name_with_percent = `${name} (${lang.percent_translated}%)`;
} }
let selected = false; let selected = false;

View File

@@ -32,7 +32,7 @@ export function password_quality(
// The bar bottoms out at 10% so there's always something // The bar bottoms out at 10% so there's always something
// for the user to see. // for the user to see.
bar.width(90 * bar_progress + 10 + "%") bar.width(`${90 * bar_progress + 10}%`)
.removeClass("bar-success bar-danger") .removeClass("bar-success bar-danger")
.addClass(acceptable ? "bar-success" : "bar-danger"); .addClass(acceptable ? "bar-success" : "bar-danger");
} }

View File

@@ -6,7 +6,7 @@ function collapse_spoiler(spoiler: JQuery): void {
// Set height to rendered height on next frame, then to zero on following // Set height to rendered height on next frame, then to zero on following
// frame to allow CSS transition animation to work // frame to allow CSS transition animation to work
requestAnimationFrame(() => { requestAnimationFrame(() => {
spoiler.height(spoiler_height + "px"); spoiler.height(`${spoiler_height}px`);
spoiler.removeClass("spoiler-content-open"); spoiler.removeClass("spoiler-content-open");
requestAnimationFrame(() => { requestAnimationFrame(() => {
@@ -22,7 +22,7 @@ function expand_spoiler(spoiler: JQuery): void {
// `auto`, so we get the actual height of the content here and temporarily // `auto`, so we get the actual height of the content here and temporarily
// put it explicitly on the element styling to allow the transition to work. // put it explicitly on the element styling to allow the transition to work.
const spoiler_height = spoiler.prop("scrollHeight"); const spoiler_height = spoiler.prop("scrollHeight");
spoiler.height(spoiler_height + "px"); spoiler.height(`${spoiler_height}px`);
// The `spoiler-content-open` class has CSS animations defined on it which // The `spoiler-content-open` class has CSS animations defined on it which
// will trigger on the frame after this class change. // will trigger on the frame after this class change.
spoiler.addClass("spoiler-content-open"); spoiler.addClass("spoiler-content-open");

View File

@@ -203,7 +203,7 @@ function render_date_span(
// of this DOM node as HTML, so effectively a copy of the node. That's // of this DOM node as HTML, so effectively a copy of the node. That's
// okay since to update the time later we look up the node by its id.) // okay since to update the time later we look up the node by its id.)
export function render_date(time: Date, time_above: Date | undefined, today: Date): JQuery { export function render_date(time: Date, time_above: Date | undefined, today: Date): JQuery {
const className = "timerender" + next_timerender_id; const className = `timerender${next_timerender_id}`;
next_timerender_id += 1; next_timerender_id += 1;
const rendered_time = render_now(time, today); const rendered_time = render_now(time, today);
let node = $("<span />").attr("class", className); let node = $("<span />").attr("class", className);

View File

@@ -49,7 +49,7 @@ export function remove(user_group: UserGroup): void {
export function get_user_group_from_id(group_id: number): UserGroup { export function get_user_group_from_id(group_id: number): UserGroup {
const user_group = user_group_by_id_dict.get(group_id); const user_group = user_group_by_id_dict.get(group_id);
if (!user_group) { if (!user_group) {
throw new Error("Unknown group_id in get_user_group_from_id: " + group_id); throw new Error(`Unknown group_id in get_user_group_from_id: ${group_id}`);
} }
return user_group; return user_group;
} }
@@ -80,7 +80,7 @@ export function get_realm_user_groups(): UserGroup[] {
export function is_member_of(user_group_id: number, user_id: number): boolean { export function is_member_of(user_group_id: number, user_id: number): boolean {
const user_group = user_group_by_id_dict.get(user_group_id); const user_group = user_group_by_id_dict.get(user_group_id);
if (user_group === undefined) { if (user_group === undefined) {
blueslip.error("Could not find user group with ID " + user_group_id); blueslip.error(`Could not find user group with ID ${user_group_id}`);
return false; return false;
} }
return user_group.members.has(user_id); return user_group.members.has(user_id);
@@ -89,7 +89,7 @@ export function is_member_of(user_group_id: number, user_id: number): boolean {
export function add_members(user_group_id: number, user_ids: number[]): void { export function add_members(user_group_id: number, user_ids: number[]): void {
const user_group = user_group_by_id_dict.get(user_group_id); const user_group = user_group_by_id_dict.get(user_group_id);
if (user_group === undefined) { if (user_group === undefined) {
blueslip.error("Could not find user group with ID " + user_group_id); blueslip.error(`Could not find user group with ID ${user_group_id}`);
return; return;
} }
@@ -101,7 +101,7 @@ export function add_members(user_group_id: number, user_ids: number[]): void {
export function remove_members(user_group_id: number, user_ids: number[]): void { export function remove_members(user_group_id: number, user_ids: number[]): void {
const user_group = user_group_by_id_dict.get(user_group_id); const user_group = user_group_by_id_dict.get(user_group_id);
if (user_group === undefined) { if (user_group === undefined) {
blueslip.error("Could not find user group with ID " + user_group_id); blueslip.error(`Could not find user group with ID ${user_group_id}`);
return; return;
} }