chore: upgrade i18next 26, prettier 3, fontsource-variable, domhandler 6, lint-staged 17
CI / Build & Quality Checks (push) Successful in 10m13s
CI / Build & Quality Checks (push) Successful in 10m13s
- i18next 23->26 + react-i18next 15->17 - prettier 2->3, reformat all files - replace @fontsource/inter with @fontsource-variable/inter 5, update import path - domhandler 5->6 (aligns with transitive deps) - lint-staged 16->17
This commit is contained in:
@@ -19,7 +19,7 @@ export type UseAsyncSearchOptions = AsyncSearchOption & {
|
||||
|
||||
export type SearchItemStrGetter<TSearchItem extends object | string | number> = (
|
||||
searchItem: TSearchItem,
|
||||
query: string
|
||||
query: string,
|
||||
) => string | string[];
|
||||
|
||||
export type UseAsyncSearchResult<TSearchItem extends object | string | number> = {
|
||||
@@ -32,11 +32,11 @@ export type SearchResetHandler = () => void;
|
||||
const performMatch = (
|
||||
target: string | string[],
|
||||
query: string,
|
||||
options?: UseAsyncSearchOptions
|
||||
options?: UseAsyncSearchOptions,
|
||||
): string | undefined => {
|
||||
if (Array.isArray(target)) {
|
||||
const matchTarget = target.find((i) =>
|
||||
matchQuery(normalize(i, options?.normalizeOptions), query, options?.matchOptions)
|
||||
matchQuery(normalize(i, options?.normalizeOptions), query, options?.matchOptions),
|
||||
);
|
||||
return matchTarget ? normalize(matchTarget, options?.normalizeOptions) : undefined;
|
||||
}
|
||||
@@ -50,7 +50,7 @@ export const orderSearchItems = <TSearchItem extends object | string | number>(
|
||||
query: string,
|
||||
items: TSearchItem[],
|
||||
getItemStr: SearchItemStrGetter<TSearchItem>,
|
||||
options?: UseAsyncSearchOptions
|
||||
options?: UseAsyncSearchOptions,
|
||||
): TSearchItem[] => {
|
||||
const orderedItems: TSearchItem[] = Array.from(items);
|
||||
|
||||
@@ -107,7 +107,7 @@ export const orderSearchItems = <TSearchItem extends object | string | number>(
|
||||
export const useAsyncSearch = <TSearchItem extends object | string | number>(
|
||||
list: TSearchItem[],
|
||||
getItemStr: SearchItemStrGetter<TSearchItem>,
|
||||
options?: UseAsyncSearchOptions
|
||||
options?: UseAsyncSearchOptions,
|
||||
): [UseAsyncSearchResult<TSearchItem> | undefined, AsyncSearchHandler, SearchResetHandler] => {
|
||||
const [result, setResult] = useState<UseAsyncSearchResult<TSearchItem>>();
|
||||
|
||||
@@ -135,7 +135,7 @@ export const useAsyncSearch = <TSearchItem extends object | string | number>(
|
||||
const normalizedQuery = normalize(query, options?.normalizeOptions);
|
||||
searchCallback(normalizedQuery);
|
||||
},
|
||||
[searchCallback, options?.normalizeOptions]
|
||||
[searchCallback, options?.normalizeOptions],
|
||||
);
|
||||
|
||||
const resetHandler: SearchResetHandler = useCallback(() => {
|
||||
@@ -148,7 +148,7 @@ export const useAsyncSearch = <TSearchItem extends object | string | number>(
|
||||
// terminate any ongoing search request on unmount.
|
||||
terminateSearch();
|
||||
},
|
||||
[terminateSearch]
|
||||
[terminateSearch],
|
||||
);
|
||||
|
||||
return [result, searchHandler, resetHandler];
|
||||
|
||||
Reference in New Issue
Block a user