mirror of https://github.com/zulip/zulip.git
eslint: Fix @typescript-eslint/no-confusing-void-expression.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
3fde4f977d
commit
6368cf17cb
|
@ -60,16 +60,17 @@ export default class DebugRequirePlugin implements WebpackPluginInstance {
|
|||
"DebugRequirePlugin",
|
||||
async ({normalModuleFactory}) => {
|
||||
const resolver = normalModuleFactory.getResolver("normal");
|
||||
debugRequirePath = await new Promise((resolve) =>
|
||||
debugRequirePath = await new Promise((resolve) => {
|
||||
resolver.resolve(
|
||||
{},
|
||||
__dirname,
|
||||
"./debug-require",
|
||||
{},
|
||||
(err?: Error | null, result?: string | false) =>
|
||||
resolve(err ? false : result!),
|
||||
),
|
||||
);
|
||||
(err?: Error | null, result?: string | false) => {
|
||||
resolve(err ? false : result!);
|
||||
},
|
||||
);
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
|
|
|
@ -112,10 +112,9 @@ async function test_narrow_to_private_messages_with_cordelia(page: Page): Promis
|
|||
const you_and_cordelia_selector =
|
||||
'*[data-tippy-content="Go to direct messages with Cordelia, Lear\'s daughter"]';
|
||||
// For some unknown reason page.click() isn't working here.
|
||||
await page.evaluate(
|
||||
(selector: string) => document.querySelector<HTMLElement>(selector)!.click(),
|
||||
you_and_cordelia_selector,
|
||||
);
|
||||
await page.evaluate((selector: string) => {
|
||||
document.querySelector<HTMLElement>(selector)!.click();
|
||||
}, you_and_cordelia_selector);
|
||||
const cordelia_user_id = await common.get_user_id_from_name(page, "Cordelia, Lear's daughter");
|
||||
const pm_list_selector = `li[data-user-ids-string="${cordelia_user_id}"].dm-list-item.active-sub-filter`;
|
||||
await page.waitForSelector(pm_list_selector, {visible: true});
|
||||
|
|
|
@ -269,7 +269,9 @@ export async function log_in(
|
|||
password: credentials.password,
|
||||
};
|
||||
await fill_form(page, "form#login_form", params);
|
||||
await page.$eval("form#login_form", (form) => form.submit());
|
||||
await page.$eval("form#login_form", (form) => {
|
||||
form.submit();
|
||||
});
|
||||
|
||||
await page.waitForSelector("#inbox-main", {visible: true});
|
||||
}
|
||||
|
|
|
@ -15,11 +15,15 @@ async function realm_creation_tests(page: Page): Promise<void> {
|
|||
await page.waitForSelector("#email");
|
||||
await page.type("#email", email);
|
||||
await page.type("#id_team_name", organization_name);
|
||||
await page.$eval("input#realm_in_root_domain", (el) => el.click());
|
||||
await page.$eval("input#realm_in_root_domain", (el) => {
|
||||
el.click();
|
||||
});
|
||||
|
||||
await Promise.all([
|
||||
page.waitForNavigation(),
|
||||
page.$eval("form#create_realm", (form) => form.submit()),
|
||||
page.$eval("form#create_realm", (form) => {
|
||||
form.submit();
|
||||
}),
|
||||
]);
|
||||
|
||||
// Make sure confirmation email is sent.
|
||||
|
@ -59,7 +63,9 @@ async function realm_creation_tests(page: Page): Promise<void> {
|
|||
// For some reason, page.click() does not work this for particular checkbox
|
||||
// so use page.$eval here to call the .click method in the browser.
|
||||
await common.fill_form(page, "#registration", params);
|
||||
await page.$eval("form#registration", (form) => form.submit());
|
||||
await page.$eval("form#registration", (form) => {
|
||||
form.submit();
|
||||
});
|
||||
|
||||
// Check if realm is created and user is logged in by checking if
|
||||
// element of id `lightbox_overlay` exists.
|
||||
|
|
|
@ -20,7 +20,9 @@ async function _add_playground_and_return_status(page: Page, payload: Playground
|
|||
await common.fill_form(page, "form.admin-playground-form", payload);
|
||||
// Not sure why, but page.click() doesn't seem to always click the submit button.
|
||||
// So we resort to using eval with the button ID instead.
|
||||
await page.$eval("button#submit_playground_button", (el) => el.click());
|
||||
await page.$eval("button#submit_playground_button", (el) => {
|
||||
el.click();
|
||||
});
|
||||
|
||||
// We return the success/failure status message back to the caller.
|
||||
await page.waitForSelector(admin_playground_status_selector, {visible: true});
|
||||
|
|
|
@ -17,9 +17,9 @@ async function open_set_user_status_modal(page: Page): Promise<void> {
|
|||
});
|
||||
await page.waitForSelector(".user_popover_email", {visible: true});
|
||||
// We are using evaluate to click because it is very hard to detect if the user info popover has opened.
|
||||
await page.evaluate(() =>
|
||||
document.querySelector<HTMLAnchorElement>(".update_status_text")!.click(),
|
||||
);
|
||||
await page.evaluate(() => {
|
||||
document.querySelector<HTMLAnchorElement>(".update_status_text")!.click();
|
||||
});
|
||||
|
||||
// Wait for the modal to completely open.
|
||||
await common.wait_for_micromodal_to_open(page);
|
||||
|
|
|
@ -99,8 +99,9 @@ function delete_attachments(attachment: string, file_name: string): void {
|
|||
html_submit_button: $t_html({defaultMessage: "Delete"}),
|
||||
id: "confirm_delete_file_modal",
|
||||
focus_submit_on_open: true,
|
||||
on_click: () =>
|
||||
dialog_widget.submit_api_request(channel.del, "/json/attachments/" + attachment),
|
||||
on_click() {
|
||||
dialog_widget.submit_api_request(channel.del, "/json/attachments/" + attachment);
|
||||
},
|
||||
loading_spinner: true,
|
||||
});
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ export function build_user_avatar_widget(upload_function: UploadFunction): void
|
|||
}
|
||||
|
||||
if (!settings_data.user_can_change_avatar) {
|
||||
return undefined;
|
||||
return;
|
||||
}
|
||||
|
||||
$("#user-avatar-upload-widget .image-delete-button").on("click", (e) => {
|
||||
|
@ -116,7 +116,7 @@ export function build_user_avatar_widget(upload_function: UploadFunction): void
|
|||
});
|
||||
});
|
||||
|
||||
return upload_widget.build_direct_upload_widget(
|
||||
upload_widget.build_direct_upload_widget(
|
||||
get_file_input,
|
||||
$("#user-avatar-upload-widget .image_file_input_error").expectOne(),
|
||||
$("#user-avatar-upload-widget .image_upload_button").expectOne(),
|
||||
|
|
|
@ -184,11 +184,12 @@ export function initialize(): void {
|
|||
"planchange",
|
||||
[],
|
||||
"PATCH",
|
||||
() =>
|
||||
() => {
|
||||
window.location.replace(
|
||||
`${billing_base_url}/upgrade/?success_message=` +
|
||||
encodeURIComponent("Your plan is no longer scheduled for an upgrade."),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
e.preventDefault();
|
||||
});
|
||||
|
@ -216,11 +217,12 @@ export function initialize(): void {
|
|||
"planchange",
|
||||
[],
|
||||
"PATCH",
|
||||
() =>
|
||||
() => {
|
||||
window.location.replace(
|
||||
`${billing_base_url}/billing/?success_message=` +
|
||||
encodeURIComponent("Your plan has been canceled and will not renew."),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
e.preventDefault();
|
||||
});
|
||||
|
@ -231,13 +233,14 @@ export function initialize(): void {
|
|||
"planchange",
|
||||
[],
|
||||
"PATCH",
|
||||
() =>
|
||||
() => {
|
||||
window.location.replace(
|
||||
`${billing_base_url}/billing/?success_message=` +
|
||||
encodeURIComponent(
|
||||
"Your plan has been reactivated and will renew automatically.",
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
e.preventDefault();
|
||||
});
|
||||
|
@ -248,13 +251,14 @@ export function initialize(): void {
|
|||
"planchange",
|
||||
[],
|
||||
"PATCH",
|
||||
() =>
|
||||
() => {
|
||||
window.location.replace(
|
||||
`${billing_base_url}/billing/?success_message=` +
|
||||
encodeURIComponent(
|
||||
"Your plan will be canceled at the end of the trial. Your card will not be charged.",
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
e.preventDefault();
|
||||
});
|
||||
|
|
|
@ -31,7 +31,7 @@ function make_logger_func(name: "debug" | "log" | "info" | "warn" | "error") {
|
|||
}
|
||||
|
||||
if (console[name] !== undefined) {
|
||||
return console[name](...args);
|
||||
console[name](...args);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -56,7 +56,9 @@ const animate = {
|
|||
return;
|
||||
}
|
||||
|
||||
setTimeout(() => animate.maybe_close(), 100);
|
||||
setTimeout(() => {
|
||||
animate.maybe_close();
|
||||
}, 100);
|
||||
},
|
||||
fadeOut() {
|
||||
if (!meta.opened) {
|
||||
|
@ -86,7 +88,9 @@ const animate = {
|
|||
if (meta.$container) {
|
||||
meta.$container.addClass("show-feedback-container");
|
||||
meta.opened = true;
|
||||
setTimeout(() => animate.maybe_close(), 100);
|
||||
setTimeout(() => {
|
||||
animate.maybe_close();
|
||||
}, 100);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -290,7 +290,8 @@ export function create<T>(opts: InputPillCreateOptions<T>): InputPillContainer<T
|
|||
|
||||
createPillonPaste() {
|
||||
if (store.createPillonPaste !== undefined) {
|
||||
return store.createPillonPaste();
|
||||
store.createPillonPaste();
|
||||
return undefined;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
|
|
@ -11,7 +11,7 @@ export function build_realm_icon_widget(upload_function: UploadFunction): void {
|
|||
};
|
||||
|
||||
if (!page_params.is_admin) {
|
||||
return undefined;
|
||||
return;
|
||||
}
|
||||
if (page_params.realm_icon_source === "G") {
|
||||
$("#realm-icon-upload-widget .image-delete-button").hide();
|
||||
|
@ -26,7 +26,7 @@ export function build_realm_icon_widget(upload_function: UploadFunction): void {
|
|||
});
|
||||
});
|
||||
|
||||
return upload_widget.build_direct_upload_widget(
|
||||
upload_widget.build_direct_upload_widget(
|
||||
get_file_input,
|
||||
$("#realm-icon-upload-widget .image_file_input_error").expectOne(),
|
||||
$("#realm-icon-upload-widget .image_upload_button").expectOne(),
|
||||
|
|
|
@ -26,7 +26,7 @@ export function build_realm_logo_widget(upload_function: UploadFunction, is_nigh
|
|||
};
|
||||
|
||||
if (!page_params.is_admin) {
|
||||
return undefined;
|
||||
return;
|
||||
}
|
||||
|
||||
if (logo_source === "D") {
|
||||
|
@ -45,7 +45,7 @@ export function build_realm_logo_widget(upload_function: UploadFunction, is_nigh
|
|||
});
|
||||
});
|
||||
|
||||
return upload_widget.build_direct_upload_widget(
|
||||
upload_widget.build_direct_upload_widget(
|
||||
get_file_input,
|
||||
$file_input_error_elem.expectOne(),
|
||||
$upload_button_elem.expectOne(),
|
||||
|
|
|
@ -288,7 +288,9 @@ function show_modal(): void {
|
|||
confirm_dialog.launch({
|
||||
html_heading: $t_html({defaultMessage: "Override default emoji?"}),
|
||||
html_body,
|
||||
on_click: () => submit_custom_emoji_request(formData),
|
||||
on_click() {
|
||||
submit_custom_emoji_request(formData);
|
||||
},
|
||||
});
|
||||
});
|
||||
} else {
|
||||
|
@ -335,7 +337,9 @@ export function set_up(): void {
|
|||
html_heading: $t_html({defaultMessage: "Deactivate custom emoji?"}),
|
||||
html_body,
|
||||
id: "confirm_deactivate_custom_emoji_modal",
|
||||
on_click: () => dialog_widget.submit_api_request(channel.del, url, {}, opts),
|
||||
on_click() {
|
||||
dialog_widget.submit_api_request(channel.del, url, {}, opts);
|
||||
},
|
||||
loading_spinner: true,
|
||||
});
|
||||
});
|
||||
|
|
|
@ -155,7 +155,9 @@ export function set_up(): void {
|
|||
confirm_dialog.launch({
|
||||
html_heading: $t_html({defaultMessage: "Delete data export?"}),
|
||||
html_body,
|
||||
on_click: () => dialog_widget.submit_api_request(channel.del, url),
|
||||
on_click() {
|
||||
dialog_widget.submit_api_request(channel.del, url);
|
||||
},
|
||||
loading_spinner: true,
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue