eslint: Fix @typescript-eslint/consistent-type-definitions.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2023-04-19 14:40:04 -07:00 committed by Tim Abbott
parent ccbba1acb0
commit 084771ce74
5 changed files with 10 additions and 8 deletions

View File

@ -171,6 +171,7 @@
"@typescript-eslint/array-type": "error", "@typescript-eslint/array-type": "error",
"@typescript-eslint/consistent-type-assertions": "error", "@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
"@typescript-eslint/consistent-type-imports": "error", "@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/explicit-function-return-type": [ "@typescript-eslint/explicit-function-return-type": [
"error", "error",

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

@ -5,6 +5,7 @@
declare let zulip_test: any; // eslint-disable-line @typescript-eslint/no-explicit-any declare let zulip_test: any; // eslint-disable-line @typescript-eslint/no-explicit-any
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
interface JQuery { interface JQuery {
expectOne(): JQuery; expectOne(): JQuery;
tab(action?: string): this; // From web/third/bootstrap tab(action?: string): this; // From web/third/bootstrap

View File

@ -3,9 +3,9 @@ import $ from "jquery";
// TODO: Move this to message_store when it is // TODO: Move this to message_store when it is
// converted to TypeScript. // converted to TypeScript.
interface Message { type Message = {
content: string; content: string;
} };
// We need to check if the message content contains the specified HTML // We need to check if the message content contains the specified HTML
// elements. We wrap the message.content in a <div>; this is // elements. We wrap the message.content in a <div>; this is

View File

@ -108,7 +108,7 @@ export const twenty_four_hour_time_values = {
}, },
}; };
export interface DisplaySettings { export type DisplaySettings = {
settings: { settings: {
user_display_settings: string[]; user_display_settings: string[];
}; };
@ -116,7 +116,7 @@ export interface DisplaySettings {
high_contrast_mode: boolean; high_contrast_mode: boolean;
dense_mode: boolean; dense_mode: boolean;
}; };
} };
/* istanbul ignore next */ /* istanbul ignore next */
export const get_all_display_settings = (): DisplaySettings => ({ export const get_all_display_settings = (): DisplaySettings => ({
@ -761,7 +761,7 @@ export function get_notifications_table_row_data(
}); });
} }
export interface AllNotifications { export type AllNotifications = {
general_settings: {label: string; notification_settings: NotificationSettingCheckbox[]}[]; general_settings: {label: string; notification_settings: NotificationSettingCheckbox[]}[];
settings: { settings: {
desktop_notification_settings: string[]; desktop_notification_settings: string[];
@ -773,7 +773,7 @@ export interface AllNotifications {
push_notifications: boolean; push_notifications: boolean;
enable_online_push_notifications: boolean; enable_online_push_notifications: boolean;
}; };
} };
export const all_notifications = (settings_object: Settings): AllNotifications => ({ export const all_notifications = (settings_object: Settings): AllNotifications => ({
general_settings: [ general_settings: [

View File

@ -6,14 +6,14 @@
declare module "url-template" { declare module "url-template" {
export type PrimitiveValue = string | number | boolean | null; export type PrimitiveValue = string | number | boolean | null;
export interface Template { export type Template = {
expand( expand(
context: Record< context: Record<
string, string,
PrimitiveValue | PrimitiveValue[] | Record<string, PrimitiveValue> PrimitiveValue | PrimitiveValue[] | Record<string, PrimitiveValue>
>, >,
): string; ): string;
} };
export function parse(template: string): Template; export function parse(template: string): Template;
} }