Skip to content

Commit

Permalink
chore(ui): lint issues on typedefs
Browse files Browse the repository at this point in the history
  • Loading branch information
rstoenescu committed Feb 28, 2024
1 parent 5e24419 commit 5b6a5a2
Show file tree
Hide file tree
Showing 17 changed files with 64 additions and 62 deletions.
2 changes: 1 addition & 1 deletion ui/types/api/dialog.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export type QDialogSelectionPrompt<
// Example: `options?: QDialogSelectionPrompt;` <- notice the missing type params.
// We can't use "radio" as the default either, because that would make it the only value.
TType extends SelectionPromptType = SelectionPromptType,
TModel = TType extends "radio" ? string : readonly any[]
TModel = TType extends "radio" ? string : readonly any[],
> = {
/**
* The value of the selection
Expand Down
2 changes: 1 addition & 1 deletion ui/types/api/qinput.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ type QInputType = NonNullable<QInputProps["type"]>;

type WithKnownType<
TElement extends HTMLInputElement | HTMLTextAreaElement,
TType extends QInputType
TType extends QInputType,
> = Omit<TElement, "type"> & { type: TType };

/**
Expand Down
2 changes: 1 addition & 1 deletion ui/types/api/qtable.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { QTableProps } from "quasar";
export type QTableColumn<
Row extends Record<string, any> = any,
Key = keyof Row extends string ? keyof Row : string,
Field = Key | ((row: Row) => any)
Field = Key | ((row: Row) => any),
> = Omit<NonNullable<QTableProps["columns"]>[number], "field" | "format"> & {
field: Field;
format?: (val: any, row: Row) => string;
Expand Down
2 changes: 1 addition & 1 deletion ui/types/api/qtree.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export type QTreeNode<TExtra = unknown> = Omit<

export interface QTreeLazyLoadParams<
Node extends QTreeNode = QTreeNode,
UpdatedNodes extends QTreeNode = Node
UpdatedNodes extends QTreeNode = Node,
> {
node: Node;
key: string;
Expand Down
2 changes: 1 addition & 1 deletion ui/types/api/quploader.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ export type QUploaderFactoryObject = {
};

export type QUploaderFactoryFn = (
files: readonly File[]
files: readonly File[],
) => QUploaderFactoryObject | Promise<QUploaderFactoryObject>;
2 changes: 1 addition & 1 deletion ui/types/api/validation.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ export type ValidationRule<T = any> =
| EmbeddedValidationRule
| ((
value: T,
rules: Record<EmbeddedValidationRule, EmbeddedValidationRuleFn>
rules: Record<EmbeddedValidationRule, EmbeddedValidationRuleFn>,
) => boolean | string | Promise<boolean | string>);
12 changes: 6 additions & 6 deletions ui/types/api/web-storage.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ type WebStorageGetMethodReturnType =
type WebStorageGetKeyMethodReturnType = string;

export type WebStorageGetItemMethodType = <
T extends WebStorageGetMethodReturnType = WebStorageGetMethodReturnType
T extends WebStorageGetMethodReturnType = WebStorageGetMethodReturnType,
>(
key: string
key: string,
) => T | null;

export type WebStorageGetIndexMethodType = <
T extends WebStorageGetMethodReturnType = WebStorageGetMethodReturnType
T extends WebStorageGetMethodReturnType = WebStorageGetMethodReturnType,
>(
index: number
index: number,
) => T | null;

export type WebStorageGetKeyMethodType = <
T extends WebStorageGetKeyMethodReturnType = WebStorageGetKeyMethodReturnType
T extends WebStorageGetKeyMethodReturnType = WebStorageGetKeyMethodReturnType,
>(
index: number
index: number,
) => T | null;

export type WebStorageGetAllKeysMethodType = () => string[];
2 changes: 1 addition & 1 deletion ui/types/feature-flag.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export interface QuasarFeatureFlags {
export type IsFeatureEnabled<
O extends string,
T,
U = {}
U = {},
> = QuasarFeatureFlags[O] extends true ? T : U;

export type HasSsr<T, U = {}> = IsFeatureEnabled<"ssr", T, U>;
Expand Down
2 changes: 1 addition & 1 deletion ui/types/globals.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export interface GlobalQuasarIconSetSingleton
}

export type GlobalQuasarIconMapFn = (
iconName: string
iconName: string,
) => { icon: string } | { cls: string; content?: string } | void;

// `import { Quasar } from 'quasar'` will contain these types
Expand Down
6 changes: 3 additions & 3 deletions ui/types/lang.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ type QuasarLanguageDayTuple = [
string,
string,
string,
string
string,
];
type QuasarLanguageMonthTuple = [
string,
Expand All @@ -102,7 +102,7 @@ type QuasarLanguageMonthTuple = [
string,
string,
string,
string
string,
];

export interface QuasarLanguage {
Expand All @@ -119,7 +119,7 @@ export interface QuasarLanguage {
format24h: boolean;
headerTitle?: (
date: Date,
model: { year: number; month: number; day: number }
model: { year: number; month: number; day: number },
) => string;
};
table: StringDictionary<QuasarLanguageTableLabel> & {
Expand Down
6 changes: 3 additions & 3 deletions ui/types/ts-helpers.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ export type DeepPartial<T> = {
[P in keyof T]?: T[P] extends Array<infer U>
? Array<DeepPartial<U>>
: T[P] extends ReadonlyArray<infer U>
? ReadonlyArray<DeepPartial<U>>
: DeepPartial<T[P]>;
? ReadonlyArray<DeepPartial<U>>
: DeepPartial<T[P]>;
};

// Create a fake constructor signature for a Vue component, needed to correctly extract/infer Component type in many situation,
Expand All @@ -43,7 +43,7 @@ export type ComponentConstructor<
RawBindings = any,
D = any,
C extends ComputedOptions = ComputedOptions,
M extends MethodOptions = MethodOptions
M extends MethodOptions = MethodOptions,
> = { new (): Component } & ComponentOptions<Props, RawBindings, D, C, M>;

// https://github.com/vuejs/vue-next/blob/d84d5ecdbdf709570122175d6565bb61fae877f2/packages/runtime-core/src/apiDefineComponent.ts#L29-L31
Expand Down
28 changes: 15 additions & 13 deletions ui/types/utils.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,21 @@ export function copyToClipboard(text: string): Promise<void>;
export function debounce<F extends (...args: any[]) => any>(
fn: F,
wait?: number,
immediate?: boolean
immediate?: boolean,
): ((this: ThisParameterType<F>, ...args: Parameters<F>) => void) & {
cancel(): void;
};

export function frameDebounce<F extends (...args: any[]) => any>(
fn: F
fn: F,
): ((this: ThisParameterType<F>, ...args: Parameters<F>) => void) & {
cancel(): void;
};

export function exportFile(
fileName: string,
rawData: string | ArrayBuffer | ArrayBufferView | Blob,
opts?: string | ExportFileOpts
opts?: string | ExportFileOpts,
): true | Error;

export function extend<R>(deep: boolean, target: any, ...sources: any[]): R;
Expand All @@ -59,12 +59,12 @@ export function extend<R>(target: object, ...sources: any[]): R;
export function openURL<F extends (...args: any[]) => any>(
url: string,
reject?: F,
windowFeatures?: Object
windowFeatures?: Object,
): void;

export function throttle<F extends (...args: any[]) => any>(
fn: F,
limit: number
limit: number,
): F;

export function uid(): string;
Expand Down Expand Up @@ -99,13 +99,13 @@ export function morph(options: MorphOptions): (abort?: boolean) => boolean;

export function getCssVar(
varName: LiteralUnion<BrandColor>,
element?: Element
element?: Element,
): string | null;

export function setCssVar(
varName: LiteralUnion<BrandColor>,
value: string,
element?: Element
element?: Element,
): void;

interface Callbacks {
Expand Down Expand Up @@ -136,11 +136,13 @@ interface CreateMetaMixinContext extends ComponentPublicInstance {
}

export function createMetaMixin<
CustomInstanceProperties extends Record<string, any> = {}
CustomInstanceProperties extends Record<string, any> = {},
>(
options:
| MetaOptions
| ((this: CreateMetaMixinContext & CustomInstanceProperties) => MetaOptions)
| ((
this: CreateMetaMixinContext & CustomInstanceProperties,
) => MetaOptions),
): ComponentOptionsMixin;

interface InjectPluginFnHelpers {
Expand All @@ -150,7 +152,7 @@ interface InjectPluginFnHelpers {
updateFileStatus: (
file: File,
status: "failed" | "idle" | "uploaded" | "uploading",
uploadedSize?: number
uploadedSize?: number,
) => void;
isAlive: () => boolean;
}
Expand All @@ -171,7 +173,7 @@ interface InjectPluginFnReturn {

interface CreateUploaderComponentOptions<
Props extends ComponentPropsOptions = {},
Emits extends EmitsOptions = []
Emits extends EmitsOptions = [],
> {
name: string;
props?: Props;
Expand All @@ -181,7 +183,7 @@ interface CreateUploaderComponentOptions<

export function createUploaderComponent<
Props extends ComponentPropsOptions = {},
Emits extends EmitsOptions = []
Emits extends EmitsOptions = [],
>(
options: CreateUploaderComponentOptions<Props, Emits>
options: CreateUploaderComponentOptions<Props, Emits>,
): QUploader & DefineComponent<Props, {}, {}, {}, {}, {}, {}, Emits>;
2 changes: 1 addition & 1 deletion ui/types/utils/colors.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export namespace colors {
function brightness(color: string | colorsRgba): number;
function blend(
foregroundColor: string | colorsRgba,
backgroundColor: string | colorsRgba
backgroundColor: string | colorsRgba,
): string;
function changeAlpha(color: string, offset: number): string;
function getPaletteColor(colorName: NamedColor): string;
Expand Down
20 changes: 10 additions & 10 deletions ui/types/utils/date.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,27 +48,27 @@ export namespace date {
date: Date | number | string,
from: Date | number | string,
to: Date | number | string,
opts?: { inclusiveFrom: boolean; inclusiveTo: boolean; onlyDate: boolean }
opts?: { inclusiveFrom: boolean; inclusiveTo: boolean; onlyDate: boolean },
): boolean;
function addToDate(date: Date | number | string, options: DateOptions): Date;
function subtractFromDate(
date: Date | number | string,
options: DateOptions
options: DateOptions,
): Date;
function adjustDate(
date: Date | number | string,
options: DateOptions,
utc?: boolean
utc?: boolean,
): Date;
function startOfDate(
date: Date | number | string,
option: DateUnitOptions,
utc?: boolean
utc?: boolean,
): Date;
function endOfDate(
date: Date | number | string,
option: DateUnitOptions,
utc?: boolean
utc?: boolean,
): Date;
function getMaxDate(
date: Date | number | string,
Expand All @@ -81,29 +81,29 @@ export namespace date {
function getDateDiff(
date: Date | number | string,
subtract: Date | number | string,
unit?: `${DateUnitOptions}s`
unit?: `${DateUnitOptions}s`,
): number;
function getDayOfYear(date: Date | number | string): number;
function inferDateFormat(
date: Date | number | string
date: Date | number | string,
): "date" | "number" | "string";
function getDateBetween(
date: Date | number | string,
min?: Date | number | string,
max?: Date | number | string
max?: Date | number | string,
): Date;
function isSameDate(
date: Date | number | string,
date2: Date | number | string,
unit?: DateUnitOptions
unit?: DateUnitOptions,
): boolean;
function daysInMonth(date: Date | number | string): number;
function formatDate(
date: Date | number | string | undefined,
format?: string,
locale?: DateLocale,
__forcedYear?: number,
__forcedTimezoneOffset?: number
__forcedTimezoneOffset?: number,
): string;
function clone<D extends Date | number | string>(date: D): D;
}
2 changes: 1 addition & 1 deletion ui/types/utils/dom.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export namespace dom {
function css(el: Element, css: VueStyleObjectProp): void;
function cssBatch(
elements: readonly Element[],
css: VueStyleObjectProp
css: VueStyleObjectProp,
): void;
function ready<F extends (...args: any[]) => any>(fn: F): ReturnType<F>;
}
Loading

0 comments on commit 5b6a5a2

Please sign in to comment.