Fix linting and formatting issues
This commit is contained in:
parent
a8c746e1ea
commit
720d04f1f2
@ -364,6 +364,7 @@ export class Backend {
|
||||
async logout() {
|
||||
try {
|
||||
await this.implementation.logout();
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} catch (e: any) {
|
||||
console.warn('Error during logout', e.message);
|
||||
} finally {
|
||||
|
@ -531,6 +531,7 @@ export default class GitGateway implements BackendClass {
|
||||
async persistEntry(entry: BackendEntry, options: PersistOptions) {
|
||||
const client = await this.getLargeMediaClient();
|
||||
if (client.enabled) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const assets = (await getLargeMediaFilteredMediaFiles(client, entry.assets)) as any;
|
||||
return this.backend!.persistEntry({ ...entry, assets }, options);
|
||||
} else {
|
||||
@ -549,6 +550,7 @@ export default class GitGateway implements BackendClass {
|
||||
client,
|
||||
fileObj as File,
|
||||
path,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
)) as any;
|
||||
return {
|
||||
...(await this.backend!.persistMedia(persistMediaArgument, options)),
|
||||
|
@ -227,6 +227,7 @@ export default class API {
|
||||
responseStatus = response.status;
|
||||
const parsedResponse = await parser(response);
|
||||
return parsedResponse;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} catch (error: any) {
|
||||
return this.handleRequestError(error, responseStatus);
|
||||
}
|
||||
@ -349,6 +350,7 @@ export default class API {
|
||||
size: file.size!,
|
||||
}))
|
||||
);
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} catch (err: any) {
|
||||
if (err && err.status === 404) {
|
||||
console.info('This 404 was expected and handled appropriately.');
|
||||
@ -360,14 +362,18 @@ export default class API {
|
||||
}
|
||||
|
||||
async persistFiles(dataFiles: DataFile[], mediaFiles: AssetProxy[], options: PersistOptions) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const files: (DataFile | AssetProxy)[] = mediaFiles.concat(dataFiles as any);
|
||||
const uploadPromises = files.map(file => this.uploadBlob(file));
|
||||
await Promise.all(uploadPromises);
|
||||
|
||||
return this.getDefaultBranch()
|
||||
.then(branchData => this.updateTree(branchData.commit.sha, files as any))
|
||||
.then(changeTree => this.commit(options.commitMessage, changeTree))
|
||||
.then(response => this.patchBranch(this.branch, response.sha));
|
||||
return (
|
||||
this.getDefaultBranch()
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
.then(branchData => this.updateTree(branchData.commit.sha, files as any))
|
||||
.then(changeTree => this.commit(options.commitMessage, changeTree))
|
||||
.then(response => this.patchBranch(this.branch, response.sha))
|
||||
);
|
||||
}
|
||||
|
||||
async getFileSha(path: string, { repoURL = this.repoURL, branch = this.branch } = {}) {
|
||||
|
@ -1,8 +1,4 @@
|
||||
export abstract class FileFormatter {
|
||||
abstract fromFile(content: string): object;
|
||||
abstract toFile(
|
||||
data: object,
|
||||
sortedKeys?: string[],
|
||||
comments?: Record<string, string>,
|
||||
): string;
|
||||
abstract toFile(data: object, sortedKeys?: string[], comments?: Record<string, string>): string;
|
||||
}
|
||||
|
@ -12,9 +12,7 @@ interface Integrations {
|
||||
algolia?: Algolia;
|
||||
}
|
||||
|
||||
export function resolveIntegrations(
|
||||
config: IntegrationsConfig | undefined,
|
||||
) {
|
||||
export function resolveIntegrations(config: IntegrationsConfig | undefined) {
|
||||
const integrationInstances: Integrations = {};
|
||||
|
||||
if (config?.providers?.algolia) {
|
||||
@ -27,10 +25,7 @@ export function resolveIntegrations(
|
||||
export const getSearchIntegrationProvider = (function () {
|
||||
let integrations: Integrations = {};
|
||||
|
||||
return (
|
||||
config: IntegrationsConfig | undefined,
|
||||
provider: SearchIntegrationProvider,
|
||||
) => {
|
||||
return (config: IntegrationsConfig | undefined, provider: SearchIntegrationProvider) => {
|
||||
if (provider in (config?.providers ?? {}))
|
||||
if (integrations) {
|
||||
return integrations[provider];
|
||||
|
@ -11,7 +11,7 @@ import {
|
||||
addFileTemplateFields,
|
||||
compileStringTemplate,
|
||||
keyToPathArray,
|
||||
parseDateFromEntry
|
||||
parseDateFromEntry,
|
||||
} from './widgets/stringTemplate';
|
||||
|
||||
import type { Collection, Config, Entry, EntryData, Slug } from '../interface';
|
||||
|
@ -70,6 +70,7 @@ export async function parseResponse<T extends keyof typeof responseFormatters =
|
||||
throw new Error(`${format} is not a supported response format.`);
|
||||
}
|
||||
body = await formatter(res);
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} catch (err: any) {
|
||||
throw new APIError(err.message, res.status, apiName);
|
||||
}
|
||||
|
@ -99,8 +99,10 @@ const bg: LocalePhrasesRoot = {
|
||||
onLeavePage: 'Наистина ли искате да напуснете тази страница?',
|
||||
onUpdatingWithUnsavedChangesBody:
|
||||
'Имате незапазени промени, моля, запазете преди актуализиране на състоянието.',
|
||||
onPublishingNotReadyBody: 'Моля, актуализирайте състоянието на „Готово“, преди да публикувате',
|
||||
onPublishingWithUnsavedChangesBody: 'Имате незапазени промени, моля, запазете преди публикуване.',
|
||||
onPublishingNotReadyBody:
|
||||
'Моля, актуализирайте състоянието на „Готово“, преди да публикувате',
|
||||
onPublishingWithUnsavedChangesBody:
|
||||
'Имате незапазени промени, моля, запазете преди публикуване.',
|
||||
onPublishingBody: 'Наистина ли искате да публикувате този запис?',
|
||||
onDeleteWithUnsavedChangesBody:
|
||||
'Наистина ли искате да изтриете този публикуван запис, както и незаписаните промени от текущата сесия?',
|
||||
|
@ -98,9 +98,11 @@ const cs: LocalePhrasesRoot = {
|
||||
},
|
||||
editor: {
|
||||
onLeavePage: 'Chcete opravdu opustit tuto stránku?',
|
||||
onUpdatingWithUnsavedChangesBody: 'Máte neuložené změny. Uložte je prosím před změnou statusu.',
|
||||
onUpdatingWithUnsavedChangesBody:
|
||||
'Máte neuložené změny. Uložte je prosím před změnou statusu.',
|
||||
onPublishingNotReadyBody: 'Změňte stav na „Připraveno“ před publikováním.',
|
||||
onPublishingWithUnsavedChangesBody: 'Máte neuložené změny, prosím uložte je před publikováním.',
|
||||
onPublishingWithUnsavedChangesBody:
|
||||
'Máte neuložené změny, prosím uložte je před publikováním.',
|
||||
onPublishingBody: 'Chcete opravdu publikovat tento záznam?',
|
||||
onDeleteWithUnsavedChangesBody:
|
||||
'Chcete opravdu vymazat tento publikovaný záznam a všechny neuložené změny z této relace?',
|
||||
|
@ -184,7 +184,8 @@ const da: LocalePhrasesRoot = {
|
||||
},
|
||||
mediaLibrary: {
|
||||
onDeleteBody: 'Er du sikker på at du vil slette det valgte medie?',
|
||||
fileTooLargeBody: 'Filen er for stor.\nOpsætningen tillader ikke filer større end %{size} kB.',
|
||||
fileTooLargeBody:
|
||||
'Filen er for stor.\nOpsætningen tillader ikke filer større end %{size} kB.',
|
||||
},
|
||||
mediaLibraryModal: {
|
||||
loading: 'Indlæser...',
|
||||
|
@ -101,7 +101,8 @@ const fr: LocalePhrasesRoot = {
|
||||
onUpdatingWithUnsavedChangesBody:
|
||||
'Veuillez enregistrer vos modifications avant de mettre à jour le statut.',
|
||||
onPublishingNotReadyBody: 'Veuillez mettre à jour le statut à "Prêt" avant de publier.',
|
||||
onPublishingWithUnsavedChangesBody: 'Veuillez enregistrer vos modifications avant de publier.',
|
||||
onPublishingWithUnsavedChangesBody:
|
||||
'Veuillez enregistrer vos modifications avant de publier.',
|
||||
onPublishingBody: 'Voulez-vous vraiment publier cette entrée ?',
|
||||
onUnpublishing: 'Voulez-vous vraiment dépublier cette entrée ?',
|
||||
onDeleteWithUnsavedChangesBody:
|
||||
|
@ -97,7 +97,8 @@ const he: LocalePhrasesRoot = {
|
||||
},
|
||||
editor: {
|
||||
onLeavePage: 'האם ברצונך לעבור לעמוד אחר ללא שמירה?',
|
||||
onUpdatingWithUnsavedChangesBody: 'בוצעו שינויים שלא נשמרו. יש לבצע שמירה לפני עדכון מצב האייטם.',
|
||||
onUpdatingWithUnsavedChangesBody:
|
||||
'בוצעו שינויים שלא נשמרו. יש לבצע שמירה לפני עדכון מצב האייטם.',
|
||||
onPublishingNotReadyBody: 'נא לשנות את מצב האייטם ל״מוכן לפרסום״ לפני הפרסום.',
|
||||
onPublishingWithUnsavedChangesBody: 'בוצעו שינויים שלא נשמרו. יש לבצע שמירה לפני הפרסום.',
|
||||
onPublishingBody: 'האם ברצונך לפרסם את האייטם?',
|
||||
|
@ -77,7 +77,8 @@ const it: LocalePhrasesRoot = {
|
||||
'Sei sicuro di voler cancellare questa voce pubblicata e tutte le modifiche non salvate della tua sessione corrente?',
|
||||
onDeletePublishedEntryBody: 'Sei sicuro di voler cancellare questa voce pubblicata?',
|
||||
loadingEntry: 'Caricando la voce...',
|
||||
confirmLoadBackupBody: 'Un backup locale è stato recuperato per questa voce, vuoi utilizzarlo?',
|
||||
confirmLoadBackupBody:
|
||||
'Un backup locale è stato recuperato per questa voce, vuoi utilizzarlo?',
|
||||
},
|
||||
editorToolbar: {
|
||||
publishing: 'Pubblicando...',
|
||||
|
@ -100,7 +100,8 @@ const pl: LocalePhrasesRoot = {
|
||||
onUpdatingWithUnsavedChangesBody:
|
||||
'Masz niezapisane zmiany, proszę zapisz je przed aktualizacją statusu.',
|
||||
onPublishingNotReadyBody: 'Proszę zaktualizować status do "Gotowe" przed publikacją.',
|
||||
onPublishingWithUnsavedChangesBody: 'Masz niezapisane zmiany, proszę zapisz je przed publikacją.',
|
||||
onPublishingWithUnsavedChangesBody:
|
||||
'Masz niezapisane zmiany, proszę zapisz je przed publikacją.',
|
||||
onPublishingBody: 'Czy na pewno chcesz opublikować tę pozycję?',
|
||||
onUnpublishing: 'Czy na pewno chcesz cofnąć publikację tej pozycji?',
|
||||
onDeleteWithUnsavedChangesBody:
|
||||
|
@ -203,7 +203,8 @@ const ro: LocalePhrasesRoot = {
|
||||
},
|
||||
mediaLibrary: {
|
||||
onDeleteBody: 'Ești sigur/ă că dorești să ștergi fișierul selectat?',
|
||||
fileTooLargeBody: 'Fișier prea mare.\nConfigurarea nu permite fișiere mai mari de %{size} KB.',
|
||||
fileTooLargeBody:
|
||||
'Fișier prea mare.\nConfigurarea nu permite fișiere mai mari de %{size} KB.',
|
||||
},
|
||||
mediaLibraryModal: {
|
||||
loading: 'Se încarcă...',
|
||||
|
@ -112,7 +112,8 @@ const tr: LocalePhrasesRoot = {
|
||||
'Bu oturumda kaydedilmiş değişikliklerin yanı sıra geçerli oturumdaki kaydedilmemiş değişikliklerinizi silmek istediğinize emin misiniz?',
|
||||
onDeletePublishedEntryBody: 'Bu yayınlanmış girdiyi silmek istediğinize emin misiniz?',
|
||||
loadingEntry: 'Girdiler yükleniyor...',
|
||||
confirmLoadBackupBody: 'Bu girdi için yerel bir yedekleme kurtarıldı, kullanmak ister misiniz?',
|
||||
confirmLoadBackupBody:
|
||||
'Bu girdi için yerel bir yedekleme kurtarıldı, kullanmak ister misiniz?',
|
||||
},
|
||||
editorInterface: {
|
||||
toggleI18n: 'i18n değiştir',
|
||||
|
@ -168,7 +168,8 @@ const vi: LocalePhrasesRoot = {
|
||||
},
|
||||
mediaLibrary: {
|
||||
onDeleteBody: 'Bạn có chắc rằng bạn muốn xoá tập tin này?',
|
||||
fileTooLargeBody: 'Tập tin quá lớn.\nCấu hình không cho phép những tập tin lớn hơn %{size} kB.',
|
||||
fileTooLargeBody:
|
||||
'Tập tin quá lớn.\nCấu hình không cho phép những tập tin lớn hơn %{size} kB.',
|
||||
},
|
||||
mediaLibraryModal: {
|
||||
loading: 'Đang tải...',
|
||||
|
@ -255,7 +255,7 @@ function entryDraftReducer(
|
||||
...newState,
|
||||
hasChanged: false,
|
||||
entry,
|
||||
original: entry
|
||||
original: entry,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -3,11 +3,7 @@ import get from 'lodash/get';
|
||||
import { CONFIG_SUCCESS } from '../actions/config';
|
||||
|
||||
import type { ConfigAction } from '../actions/config';
|
||||
import type {
|
||||
AlgoliaConfig,
|
||||
Config,
|
||||
SearchIntegrationProvider,
|
||||
} from '../interface';
|
||||
import type { AlgoliaConfig, Config, SearchIntegrationProvider } from '../interface';
|
||||
|
||||
export interface IntegrationHooks {
|
||||
search?: SearchIntegrationProvider;
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
// Based on wait-service by Mozilla:
|
||||
// https://github.com/mozilla/gecko-dev/blob/main/devtools/client/shared/redux/middleware/wait-service.js
|
||||
|
||||
|
@ -18,7 +18,7 @@ const FileLink = ({ value, getAsset, field }: FileLinkProps) => {
|
||||
return;
|
||||
}
|
||||
|
||||
const getImage = async() => {
|
||||
const getImage = async () => {
|
||||
const asset = (await getAsset(value, field))?.toString() ?? '';
|
||||
setAssetSource(asset);
|
||||
};
|
||||
|
@ -136,11 +136,11 @@ const SortableImage = SortableElement<SortableImageProps>(
|
||||
({ itemValue, getAsset, field, onRemove, onReplace }: SortableImageProps) => {
|
||||
const [assetSource, setAssetSource] = useState('');
|
||||
useEffect(() => {
|
||||
const getImage = async() => {
|
||||
const getImage = async () => {
|
||||
const asset = (await getAsset(itemValue, field))?.toString() ?? '';
|
||||
setAssetSource(asset);
|
||||
};
|
||||
|
||||
|
||||
getImage();
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [itemValue]);
|
||||
@ -393,13 +393,13 @@ export default function withFileControl({ forImage = false }: WithImageOptions =
|
||||
return;
|
||||
}
|
||||
|
||||
const getImage = async() => {
|
||||
const getImage = async () => {
|
||||
const newValue = (await getAsset(internalValue, field))?.toString() ?? '';
|
||||
if (newValue !== internalValue) {
|
||||
setAssetSource(newValue);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
getImage();
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [internalValue]);
|
||||
|
@ -26,7 +26,7 @@ interface ImageAssetProps {
|
||||
function ImageAsset({ getAsset, value, field }: ImageAssetProps) {
|
||||
const [assetSource, setAssetSource] = useState('');
|
||||
useEffect(() => {
|
||||
const getImage = async() => {
|
||||
const getImage = async () => {
|
||||
const asset = (await getAsset(value, field))?.toString() ?? '';
|
||||
setAssetSource(asset);
|
||||
};
|
||||
|
@ -18,7 +18,7 @@ import type {
|
||||
ListField,
|
||||
ObjectValue,
|
||||
ValueOrNestedValue,
|
||||
WidgetControlProps
|
||||
WidgetControlProps,
|
||||
} from '../../interface';
|
||||
|
||||
const StyledListWrapper = styled('div')`
|
||||
|
Loading…
x
Reference in New Issue
Block a user