eslint: Enable @typescript-eslint/recommended plugin.

This is not automatically enabled by
@typescript-eslint/recommended-requiring-type-checking for some
reason.

https://typescript-eslint.io/linting/configs/#recommended

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2023-03-16 11:19:53 -07:00 committed by Tim Abbott
parent 96e657a954
commit 3109ee8015
7 changed files with 8 additions and 10 deletions

View File

@ -145,6 +145,7 @@
{
"files": ["**/*.ts"],
"extends": [
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:import/typescript"
],
@ -164,7 +165,6 @@
"rules": {
// Disable base rule to avoid conflict
"no-duplicate-imports": "off",
"no-unused-vars": "off",
"no-useless-constructor": "off",
"no-use-before-define": "off",
@ -178,6 +178,7 @@
"@typescript-eslint/member-ordering": "error",
"@typescript-eslint/no-duplicate-imports": "error",
"@typescript-eslint/no-extraneous-class": "error",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-parameter-properties": "error",
"@typescript-eslint/no-unnecessary-qualifier": "error",
"@typescript-eslint/no-unsafe-argument": "off",

View File

@ -22,10 +22,7 @@ async function await_user_hidden(page: Page, name: string): Promise<void> {
async function add_user_to_stream(page: Page, name: string): Promise<void> {
const user_id = await common.get_user_id_from_name(page, name);
await page.evaluate(
(user_id: Number) => zulip_test.add_user_id_to_new_stream(user_id),
user_id,
);
await page.evaluate((user_id) => zulip_test.add_user_id_to_new_stream(user_id), user_id);
await await_user_visible(page, name);
}

2
web/src/global.d.ts vendored
View File

@ -3,7 +3,7 @@
// remove each declaration when the corresponding module is migrated
// to TS.
declare let zulip_test: any;
declare let zulip_test: any; // eslint-disable-line @typescript-eslint/no-explicit-any
interface JQuery {
expectOne(): JQuery;

View File

@ -367,7 +367,7 @@ export function stringify_time(time: number | Date): string {
return get_localized_date_or_time_for_format(time, "time");
}
export function format_time_modern(time: number | Date, today = new Date()): String {
export function format_time_modern(time: number | Date, today = new Date()): string {
const hours = differenceInHours(today, time);
const days_old = differenceInCalendarDays(today, time);

View File

@ -94,7 +94,7 @@ export function show_error($target: JQuery): void {
export function loading(
response_html: string,
$status_box: JQuery,
successfully_loaded: boolean = false,
successfully_loaded = false,
): void {
$status_box.find(".alert-content").html(response_html);
if (!successfully_loaded) {

View File

@ -49,7 +49,7 @@ export function update_unread_count_in_dom($unread_count_elem: JQuery, count: nu
export function update_unread_mention_info_in_dom(
$unread_mention_info_elem: JQuery,
stream_has_any_unread_mention_messages: Boolean,
stream_has_any_unread_mention_messages: boolean,
): void {
const $unread_mention_info_span = $unread_mention_info_elem.find(".unread_mention_info");
if (!stream_has_any_unread_mention_messages) {

View File

@ -347,7 +347,7 @@ export function filter_by_word_prefix_match<T>(
items: T[],
search_term: string,
item_to_text: (item: T) => string,
word_separator_regex: RegExp = /\s/,
word_separator_regex = /\s/,
): T[] {
if (search_term === "") {
return items;