diff --git a/.eslintrc.cjs b/.eslintrc.cjs
index c5e3860..9a2392f 100644
--- a/.eslintrc.cjs
+++ b/.eslintrc.cjs
@@ -6,7 +6,7 @@ module.exports = {
extends: [
"eslint:recommended",
"plugin:vue/vue3-recommended",
- "prettier",
"@vue/eslint-config-typescript",
+ "prettier",
],
};
diff --git a/index.html b/index.html
index ddd0708..441bea0 100644
--- a/index.html
+++ b/index.html
@@ -1,4 +1,4 @@
-
+
diff --git a/src/api/api.ts b/src/api/api.ts
index f4a7328..b55f879 100644
--- a/src/api/api.ts
+++ b/src/api/api.ts
@@ -32,9 +32,7 @@ class MinkApi {
/** Sets a JWT token which is then used to authenticate API requests. */
setJwt(jwt?: string) {
this.jwt = jwt;
- this.axios.defaults.headers["Authorization"] = jwt
- ? `Bearer ${jwt}`
- : null;
+ this.axios.defaults.headers["Authorization"] = jwt ? `Bearer ${jwt}` : null;
}
/** @see https://ws.spraakbanken.gu.se/ws/mink/api-doc#tag/Documentation/operation/APIinfo */
@@ -45,17 +43,15 @@ class MinkApi {
/** @see https://ws.spraakbanken.gu.se/ws/mink/api-doc#tag/Manage-Corpora/operation/listcorpora */
async listCorpora() {
- const response = await this.axios.get>(
- "list-corpora"
- );
+ const response =
+ await this.axios.get>("list-corpora");
return response.data.corpora;
}
/** @see https://ws.spraakbanken.gu.se/ws/mink/api-doc#tag/Manage-Corpora/operation/createcorpus */
async createCorpus() {
- const response = await this.axios.post>(
- "create-corpus"
- );
+ const response =
+ await this.axios.post>("create-corpus");
return response.data.corpus_id;
}
@@ -75,7 +71,7 @@ class MinkApi {
const response = await this.axios.put(
"upload-config",
formData,
- { params: { corpus_id: corpusId } }
+ { params: { corpus_id: corpusId } },
);
return response.data;
}
@@ -104,7 +100,7 @@ class MinkApi {
const response = await this.axios.put(
"upload-sources",
formData,
- { params: { corpus_id: corpusId } }
+ { params: { corpus_id: corpusId } },
);
return response.data;
}
@@ -127,9 +123,8 @@ class MinkApi {
/** @see https://ws.spraakbanken.gu.se/ws/mink/api-doc#tag/Process-Corpus/operation/resourceinfo */
async resourceInfoAll() {
- const response = await this.axios.get>(
- "resource-info"
- );
+ const response =
+ await this.axios.get>("resource-info");
return response.data;
}
@@ -137,7 +132,7 @@ class MinkApi {
async resourceInfoOne(corpusId: string) {
const response = await this.axios.get>(
"resource-info",
- { params: { corpus_id: corpusId } }
+ { params: { corpus_id: corpusId } },
);
return response.data;
}
@@ -167,7 +162,7 @@ class MinkApi {
async listExports(corpusId: string) {
const response = await this.axios.get>(
"list-exports",
- { params: { corpus_id: corpusId } }
+ { params: { corpus_id: corpusId } },
);
return response.data.contents;
}
@@ -195,7 +190,7 @@ class MinkApi {
const response = await this.axios.put>(
"install-korp",
null,
- { params: { corpus_id: corpusId } }
+ { params: { corpus_id: corpusId } },
);
return response.data;
}
@@ -205,16 +200,17 @@ class MinkApi {
const response = await this.axios.put>(
"install-strix",
null,
- { params: { corpus_id: corpusId } }
+ { params: { corpus_id: corpusId } },
);
return response.data;
}
/** @see https://ws.spraakbanken.gu.se/ws/mink/api-doc#tag/Admin-Mode/operation/adminmodestatus */
async adminModeStatus() {
- const response = await this.axios.get>(
- "admin-mode-status"
- );
+ const response =
+ await this.axios.get>(
+ "admin-mode-status",
+ );
return response.data.admin_mode_status;
}
diff --git a/src/api/backend.composable.ts b/src/api/backend.composable.ts
index c27466a..618cc5b 100644
--- a/src/api/backend.composable.ts
+++ b/src/api/backend.composable.ts
@@ -17,49 +17,49 @@ export default function useMinkBackend() {
spin(
api.removeCorpus(corpusId),
t("corpus.deleting"),
- `corpus/${corpusId}`
+ `corpus/${corpusId}`,
);
const loadConfig = (corpusId: string) =>
spin(
api.downloadConfig(corpusId),
t("config.loading"),
- `corpus/${corpusId}/config`
+ `corpus/${corpusId}/config`,
);
const saveConfig = (corpusId: string, configYaml: string) =>
spin(
api.uploadConfig(corpusId, configYaml),
t("corpus.configuring"),
- `corpus/${corpusId}/config`
+ `corpus/${corpusId}/config`,
);
const downloadSource = (corpusId: string, filename: string, binary = false) =>
spin(
api.downloadSources(corpusId, filename, binary),
t("source.downloading"),
- `corpus/${corpusId}/sources/${filename}`
+ `corpus/${corpusId}/sources/${filename}`,
);
const downloadPlaintext = (corpusId: string, filename: string) =>
spin(
api.downloadSourceText(corpusId, filename),
t("source.downloading_plain"),
- `corpus/${corpusId}/sources/${filename}`
+ `corpus/${corpusId}/sources/${filename}`,
);
const uploadSources = (corpusId: string, files: FileList) =>
spin(
api.uploadSources(corpusId, files),
t("source.uploading", files.length),
- `corpus/${corpusId}/sources`
+ `corpus/${corpusId}/sources`,
);
const deleteSource = (corpusId: string, filename: string) =>
spin(
api.removeSource(corpusId, filename),
t("source.deleting"),
- `corpus/${corpusId}/sources`
+ `corpus/${corpusId}/sources`,
);
const resourceInfoAll = () =>
@@ -69,7 +69,7 @@ export default function useMinkBackend() {
spin(
api.resourceInfoOne(corpusId),
t("resource.loading"),
- `corpus/${corpusId}/job`
+ `corpus/${corpusId}/job`,
);
const runJob = (corpusId: string) =>
@@ -79,14 +79,14 @@ export default function useMinkBackend() {
spin(
api.installKorp(corpusId),
t("job.installing"),
- `corpus/${corpusId}/job`
+ `corpus/${corpusId}/job`,
);
const installStrix = (corpusId: string) =>
spin(
api.installStrix(corpusId),
t("job.installing"),
- `corpus/${corpusId}/job`
+ `corpus/${corpusId}/job`,
);
const abortJob = (corpusId: string) =>
@@ -96,21 +96,21 @@ export default function useMinkBackend() {
spin(
api.listExports(corpusId),
t("exports.loading"),
- `corpus/${corpusId}/exports`
+ `corpus/${corpusId}/exports`,
);
const downloadExports = (corpusId: string) =>
spin(
api.downloadExports(corpusId),
t("exports.downloading"),
- `corpus/${corpusId}/exports`
+ `corpus/${corpusId}/exports`,
);
const downloadExportFiles = (corpusId: string, filename: string) =>
spin(
api.downloadExportFile(corpusId, filename),
t("exports.downloading"),
- `corpus/${corpusId}/exports`
+ `corpus/${corpusId}/exports`,
);
const checkAdminMode = () => spin(api.adminModeStatus(), null, "admin-mode");
diff --git a/src/api/backendInfo.composable.ts b/src/api/backendInfo.composable.ts
index 384a682..e15d348 100644
--- a/src/api/backendInfo.composable.ts
+++ b/src/api/backendInfo.composable.ts
@@ -27,17 +27,17 @@ api.getInfo().then((original: InfoData) => {
const status_codes = objsToDict(
original.status_codes.data,
"name",
- "description"
+ "description",
);
const importer_modules = objsToDict(
original.importer_modules.data,
"file_extension",
- "importer"
+ "importer",
);
const file_size_limits = keyBy(original.file_size_limits.data, "name");
const recommended_file_size = keyBy(
original.recommended_file_size.data,
- "name"
+ "name",
);
info.value = {
status_codes,
diff --git a/src/api/corpusConfig.ts b/src/api/corpusConfig.ts
index 5fe85d8..d077804 100644
--- a/src/api/corpusConfig.ts
+++ b/src/api/corpusConfig.ts
@@ -132,7 +132,7 @@ export async function makeConfig(id: string, options: ConfigOptions) {
":dateformat.datefrom",
":dateformat.dateto",
":dateformat.timefrom",
- ":dateformat.timeto"
+ ":dateformat.timeto",
);
}
@@ -143,7 +143,7 @@ export async function makeConfig(id: string, options: ConfigOptions) {
"swener.ne:swener.name",
"swener.ne:swener.ex",
"swener.ne:swener.type",
- "swener.ne:swener.subtype"
+ "swener.ne:swener.subtype",
);
}
@@ -160,23 +160,27 @@ export function emptyConfig(): ConfigOptions {
/**
* Parse a Sparv config YAML string.
- *
+ *
* May throw all kinds of errors, the sky is the limit.
*/
export async function parseConfig(configYaml: string): Promise {
- const config = (await yaml).load(configYaml) as any
-
- if (!config) throw new TypeError(`Parsing config failed, returned "${config}"`)
+ const config = (await yaml).load(configYaml) as any;
+
+ if (!config)
+ throw new TypeError(`Parsing config failed, returned "${config}"`);
// Throw specific errors if required parts are missing.
const format = (Object.keys(FORMATS) as FileFormat[]).find(
- (ext) => FORMATS[ext as FileFormat] == config.import.importer
- )
- if (!format) throw new TypeError(`Unrecognized importer: "${config.import.importer}"`)
+ (ext) => FORMATS[ext as FileFormat] == config.import.importer,
+ );
+ if (!format)
+ throw new TypeError(`Unrecognized importer: "${config.import.importer}"`);
- const name = config.metadata.name
- if (!name) throw new TypeError(`Name missing in metadata: ${config.metadata}`)
- if (!name.swe || !name.eng) throw new TypeError(`Name must contain swe and eng: ${name}`)
+ const name = config.metadata.name;
+ if (!name)
+ throw new TypeError(`Name missing in metadata: ${config.metadata}`);
+ if (!name.swe || !name.eng)
+ throw new TypeError(`Name must contain swe and eng: ${name}`);
return {
format,
@@ -185,10 +189,10 @@ export async function parseConfig(configYaml: string): Promise {
textAnnotation: config.import?.text_annotation,
sentenceSegmenter: config.segment?.sentence_segmenter,
datetimeFrom: config.custom_annotations?.find(
- (a: any) => a.params.out == ":misc.datefrom"
+ (a: any) => a.params.out == ":misc.datefrom",
)?.params.value,
datetimeTo: config.custom_annotations?.find(
- (a: any) => a.params.out == ":misc.dateto"
+ (a: any) => a.params.out == ":misc.dateto",
)?.params.value,
enableNer: config.export?.annotations?.includes("swener.ne"),
};
diff --git a/src/auth/auth.composable.ts b/src/auth/auth.composable.ts
index 3250deb..aa5ce6a 100644
--- a/src/auth/auth.composable.ts
+++ b/src/auth/auth.composable.ts
@@ -31,10 +31,10 @@ export function useAuth() {
const isAuthenticated = computed(() => !!jwt.value);
const payload = computed(() =>
- jwt.value ? decodeJwt(jwt.value)?.payload : undefined
+ jwt.value ? decodeJwt(jwt.value)?.payload : undefined,
);
const canUserAdmin = computed(
- () => !!payload.value && canAdmin(payload.value, "other", "mink-app")
+ () => !!payload.value && canAdmin(payload.value, "other", "mink-app"),
);
const canUserWrite = computed(() => isAuthenticated.value);
/** Indicates whether a jwt request is currently loading. */
diff --git a/src/auth/auth.ts b/src/auth/auth.ts
index f794fb5..df8ca6f 100644
--- a/src/auth/auth.ts
+++ b/src/auth/auth.ts
@@ -7,7 +7,7 @@ export function getLoginUrl(redirectLocation = "") {
redirectLocation = pathJoin(
window.location.origin,
import.meta.env.BASE_URL,
- redirectLocation
+ redirectLocation,
);
return AUTH_BASE + `login?redirect=${redirectLocation}`;
}
diff --git a/src/auth/jwtSb.ts b/src/auth/jwtSb.ts
index 682aed7..9bdc58f 100644
--- a/src/auth/jwtSb.ts
+++ b/src/auth/jwtSb.ts
@@ -54,7 +54,7 @@ export function assertValidPayload(payload: any): payload is JwtSbPayload {
export function canAdmin(
payload: JwtSbPayload,
resourceType: string,
- resourceName: string
+ resourceName: string,
) {
assertValidPayload(payload);
return payload.scope[resourceType]?.[resourceName] >= payload.levels.ADMIN;
@@ -63,7 +63,7 @@ export function canAdmin(
export function canWrite(
payload: JwtSbPayload,
resourceType: string,
- resourceName: string
+ resourceName: string,
) {
assertValidPayload(payload);
return payload.scope[resourceType]?.[resourceName] >= payload.levels.WRITE;
@@ -72,7 +72,7 @@ export function canWrite(
export function canRead(
payload: JwtSbPayload,
resourceType: string,
- resourceName: string
+ resourceName: string,
) {
assertValidPayload(payload);
return payload.scope[resourceType]?.[resourceName] >= payload.levels.READ;
diff --git a/src/corpora/CreateCorpus.vue b/src/corpora/CreateCorpus.vue
index 62974c6..cf7924b 100644
--- a/src/corpora/CreateCorpus.vue
+++ b/src/corpora/CreateCorpus.vue
@@ -28,8 +28,8 @@ const formatOptions = computed(() =>
...options,
[ext]: `${t(ext)} (.${ext})`,
}),
- {}
- )
+ {},
+ ),
);
requireAuthentication();
@@ -39,7 +39,7 @@ async function submit(fields: Form) {
fields.name,
fields.description,
fields.format,
- fields.textAnnotation
+ fields.textAnnotation,
);
await spin(createPromise, null, "create");
}
diff --git a/src/corpus/CorpusStateMessage.vue b/src/corpus/CorpusStateMessage.vue
index 7114b49..cd5f5e0 100644
--- a/src/corpus/CorpusStateMessage.vue
+++ b/src/corpus/CorpusStateMessage.vue
@@ -22,10 +22,10 @@ const {
isEmpty || isNeedingConfig || isNeedingMeta
? 'text-yellow-500'
: isFailed
- ? 'text-red-500'
- : isReady
- ? 'text-lime-600'
- : 'text-gray-400',
+ ? 'text-red-500'
+ : isReady
+ ? 'text-lime-600'
+ : 'text-gray-400',
]"
>
{{ stateMessage }}
diff --git a/src/corpus/config/CorpusConfiguration.vue b/src/corpus/config/CorpusConfiguration.vue
index 64879df..59164c5 100644
--- a/src/corpus/config/CorpusConfiguration.vue
+++ b/src/corpus/config/CorpusConfiguration.vue
@@ -47,14 +47,14 @@ const formatOptions = computed(() =>
attrs: {
disabled: extensions.value.length > 0 && !extensions.value.includes(ext),
},
- }))
+ })),
);
// Auto-select the file format present among source files, if any.
const selectedFormat = computed(() =>
config.value?.format && extensions.value.includes(config.value?.format)
? config.value?.format
- : undefined
+ : undefined,
);
type SegmenterOptions = Record;
diff --git a/src/corpus/corpusState.composable.ts b/src/corpus/corpusState.composable.ts
index a19528c..c9f41b8 100644
--- a/src/corpus/corpusState.composable.ts
+++ b/src/corpus/corpusState.composable.ts
@@ -54,37 +54,37 @@ export function useCorpusState(corpusId: string) {
});
const isConfigValid = computed(
- () => config.value && !getException(() => validateConfig(config.value!))
+ () => config.value && !getException(() => validateConfig(config.value!)),
);
const hasMetadata = computed(
- () => config.value?.name?.swe || config.value?.name?.eng
+ () => config.value?.name?.swe || config.value?.name?.eng,
);
const isEmpty = computed(() => corpusState.value == CorpusState.EMPTY);
const isNeedingConfig = computed(
- () => corpusState.value == CorpusState.NEEDING_CONFIG
+ () => corpusState.value == CorpusState.NEEDING_CONFIG,
);
const isNeedingMeta = computed(
- () => corpusState.value == CorpusState.NEEDING_META
+ () => corpusState.value == CorpusState.NEEDING_META,
);
const canBeReady = computed(
- () => !isEmpty.value && !isNeedingConfig.value && !isNeedingMeta.value
+ () => !isEmpty.value && !isNeedingConfig.value && !isNeedingMeta.value,
);
const isFailed = computed(
() =>
corpusState.value == CorpusState.FAILED ||
- corpusState.value == CorpusState.FAILED_INSTALL
+ corpusState.value == CorpusState.FAILED_INSTALL,
);
const isReady = computed(() => corpusState.value == CorpusState.READY);
const isRunning = computed(() => corpusState.value == CorpusState.RUNNING);
const isDone = computed(() => corpusState.value == CorpusState.DONE);
const isRunningInstall = computed(
- () => corpusState.value == CorpusState.RUNNING_INSTALL
+ () => corpusState.value == CorpusState.RUNNING_INSTALL,
);
const isDoneInstall = computed(
- () => corpusState.value == CorpusState.DONE_INSTALL
+ () => corpusState.value == CorpusState.DONE_INSTALL,
);
const stateMessage = computed(() => t(`corpus.state.${corpusState.value}`));
@@ -94,7 +94,7 @@ export function useCorpusState(corpusId: string) {
isEmpty.value ||
isNeedingConfig.value ||
isNeedingMeta.value ||
- isFailed.value
+ isFailed.value,
);
return {
diff --git a/src/corpus/createCorpus.composable.ts b/src/corpus/createCorpus.composable.ts
index b769019..82c5c76 100644
--- a/src/corpus/createCorpus.composable.ts
+++ b/src/corpus/createCorpus.composable.ts
@@ -50,7 +50,7 @@ export default function useCreateCorpus() {
]);
const rejectedResults = results.filter(
- (result): result is PromiseRejectedResult => result.status != "fulfilled"
+ (result): result is PromiseRejectedResult => result.status != "fulfilled",
);
if (rejectedResults.length) {
// Display error message(s).
@@ -82,7 +82,7 @@ export default function useCreateCorpus() {
name: string,
description: string,
format: FileFormat,
- textAnnotation?: string
+ textAnnotation?: string,
): Promise {
const config = {
name: { swe: name, eng: name },
diff --git a/src/corpus/exports/ExportsPanel.vue b/src/corpus/exports/ExportsPanel.vue
index 76ddcab..57eacdd 100644
--- a/src/corpus/exports/ExportsPanel.vue
+++ b/src/corpus/exports/ExportsPanel.vue
@@ -25,7 +25,7 @@ const canInstall = computed(
jobState.value?.sparv == "done" &&
!["waiting", "running"].includes(jobState?.value.korp) &&
!["waiting", "running"].includes(jobState?.value.strix) &&
- !isInstallPending.value
+ !isInstallPending.value,
);
loadExports();
diff --git a/src/corpus/exports/ToolPanel.vue b/src/corpus/exports/ToolPanel.vue
index 056c992..97cadd7 100644
--- a/src/corpus/exports/ToolPanel.vue
+++ b/src/corpus/exports/ToolPanel.vue
@@ -30,7 +30,9 @@ defineEmits<{
>
{{
$t(
- !isInstalled ? "exports.tools.install" : "exports.tools.reinstall"
+ !isInstalled
+ ? "exports.tools.install"
+ : "exports.tools.reinstall",
)
}}
diff --git a/src/corpus/job/JobStatus.vue b/src/corpus/job/JobStatus.vue
index f7a14b3..cb8f99a 100644
--- a/src/corpus/job/JobStatus.vue
+++ b/src/corpus/job/JobStatus.vue
@@ -17,7 +17,7 @@ const { canBeReady, isFailed } = useCorpusState(corpusId);
const isPending = ref(false);
const canRun = computed(
- () => canBeReady.value && !isPending.value && !isJobRunning.value
+ () => canBeReady.value && !isPending.value && !isJobRunning.value,
);
async function doRunJob() {
diff --git a/src/corpus/job/ProgressBar.vue b/src/corpus/job/ProgressBar.vue
index 3cbdbde..88fb060 100644
--- a/src/corpus/job/ProgressBar.vue
+++ b/src/corpus/job/ProgressBar.vue
@@ -9,8 +9,8 @@ const props = defineProps<{
const { locale } = useI18n();
const percentStr = computed(() =>
Intl.NumberFormat(locale.value, { style: "percent" }).format(
- props.percent / 100
- )
+ props.percent / 100,
+ ),
);
diff --git a/src/corpus/job/job.composable.ts b/src/corpus/job/job.composable.ts
index b8ae349..a7896ce 100644
--- a/src/corpus/job/job.composable.ts
+++ b/src/corpus/job/job.composable.ts
@@ -57,7 +57,7 @@ export default function useJob(corpusId: string) {
const statuses = jobState.value;
if (!statuses) return false;
return (Object.keys(statuses) as JobType[]).some((process) =>
- ["waiting", "running"].includes(statuses[process])
+ ["waiting", "running"].includes(statuses[process]),
);
});
@@ -65,7 +65,7 @@ export default function useJob(corpusId: string) {
const isJobDone = computed(
() =>
jobState.value?.sparv == "done" &&
- ["none", "aborted", "done"].includes(jobState.value.korp)
+ ["none", "aborted", "done"].includes(jobState.value.korp),
);
// Check status intermittently if active.
diff --git a/src/corpus/sources/SourceUpload.vue b/src/corpus/sources/SourceUpload.vue
index 836e42b..c5cc8c6 100644
--- a/src/corpus/sources/SourceUpload.vue
+++ b/src/corpus/sources/SourceUpload.vue
@@ -19,7 +19,7 @@ const { uploadSources, extensions } = useSources(corpusId);
const { config, uploadConfig } = useConfig(corpusId);
const { alertError, clear } = useMessenger();
const extensionsAccept = computed(() =>
- extensions.value?.map((ext) => `.${ext}`).join()
+ extensions.value?.map((ext) => `.${ext}`).join(),
);
async function defaultFileHandler(files: FileList) {
diff --git a/src/corpus/sources/SourceView.vue b/src/corpus/sources/SourceView.vue
index b82e254..695d168 100644
--- a/src/corpus/sources/SourceView.vue
+++ b/src/corpus/sources/SourceView.vue
@@ -22,7 +22,7 @@ const { filesize } = useLocale();
const sources = computed(() => corpusStore.corpora[props.corpusId].sources);
const metadata = computed(() =>
- sources.value?.find((source) => source.name === props.filename)
+ sources.value?.find((source) => source.name === props.filename),
);
const isBinary = computed(() => metadata.value?.type.indexOf("text/") !== 0);
const isPlaintext = computed(() => metadata.value?.type == "text/plain");
diff --git a/src/corpus/sources/SourcesPanel.vue b/src/corpus/sources/SourcesPanel.vue
index 84295ae..60b6d3a 100644
--- a/src/corpus/sources/SourcesPanel.vue
+++ b/src/corpus/sources/SourcesPanel.vue
@@ -16,7 +16,7 @@ const { info } = useMinkBackendInfo();
const { filesize } = useLocale();
const totalSize = computed(() =>
- sources.value.reduce((sum, source) => sum + Number(source.size), 0)
+ sources.value.reduce((sum, source) => sum + Number(source.size), 0),
);
diff --git a/src/corpus/sources/sources.composable.ts b/src/corpus/sources/sources.composable.ts
index e6fd52b..e84bfb4 100644
--- a/src/corpus/sources/sources.composable.ts
+++ b/src/corpus/sources/sources.composable.ts
@@ -41,9 +41,9 @@ export default function useSources(corpusId: string) {
const extensions = computed(() =>
uniq(
corpusStore.corpora[corpusId]?.sources?.map((source) =>
- getFilenameExtension(source.name)
- )
- )
+ getFilenameExtension(source.name),
+ ),
+ ),
);
return {
diff --git a/src/fontawesome.ts b/src/fontawesome.ts
index e4044fe..9343474 100644
--- a/src/fontawesome.ts
+++ b/src/fontawesome.ts
@@ -35,5 +35,5 @@ library.add(
faTrashCan,
faTriangleExclamation,
faUserPlus,
- faXmark
+ faXmark,
);
diff --git a/src/formkit.ts b/src/formkit.ts
index fcd116d..ee8c5e4 100644
--- a/src/formkit.ts
+++ b/src/formkit.ts
@@ -25,7 +25,7 @@ function addAsteriskPlugin(node: FormKitNode) {
const schemaFn = node.props.definition.schema;
node.props.definition.schema = (sectionsSchema = {}) => {
const isRequired = node.props.parsedRules.some(
- (rule: any) => rule.name === "required"
+ (rule: any) => rule.name === "required",
);
if (isRequired) {
diff --git a/src/message/MessageToasts.vue b/src/message/MessageToasts.vue
index 0f22211..0313445 100644
--- a/src/message/MessageToasts.vue
+++ b/src/message/MessageToasts.vue
@@ -8,7 +8,7 @@ const route = useRoute();
watch(
() => route.path,
- () => clear()
+ () => clear(),
);
diff --git a/src/message/messenger.composable.ts b/src/message/messenger.composable.ts
index 1c06ad6..c305894 100644
--- a/src/message/messenger.composable.ts
+++ b/src/message/messenger.composable.ts
@@ -60,7 +60,7 @@ export default function useMessenger() {
return;
}
console.warn(
- `Translation missing for return code "${data.return_code}"`
+ `Translation missing for return code "${data.return_code}"`,
);
}
diff --git a/src/page/BreadcrumbBar.vue b/src/page/BreadcrumbBar.vue
index b6b8074..dd12822 100644
--- a/src/page/BreadcrumbBar.vue
+++ b/src/page/BreadcrumbBar.vue
@@ -23,7 +23,7 @@ const crumbs = computed(() =>
const route = resolve(path);
return { path, title: getTitle(route), name: route.name };
})
- .filter((crumb) => crumb.name != "notfound" && crumb.title)
+ .filter((crumb) => crumb.name != "notfound" && crumb.title),
);
diff --git a/src/page/MinkLogo.vue b/src/page/MinkLogo.vue
index 52f6aca..4d09d2c 100644
--- a/src/page/MinkLogo.vue
+++ b/src/page/MinkLogo.vue
@@ -15,14 +15,14 @@ const props = defineProps<{
const { locale } = useI18n();
const src = computed(() =>
- props.large ? (locale.value == "en" ? logoSloganEn : logoSlogan) : logo
+ props.large ? (locale.value == "en" ? logoSloganEn : logoSlogan) : logo,
);
const srcLight = computed(() =>
props.large
? locale.value == "en"
? logoLightSloganEn
: logoLightSlogan
- : logoLight
+ : logoLight,
);
diff --git a/src/page/title.composable.ts b/src/page/title.composable.ts
index a525809..36f3270 100644
--- a/src/page/title.composable.ts
+++ b/src/page/title.composable.ts
@@ -13,7 +13,7 @@ export default function usePageTitle() {
const corpusName = computed(
() =>
th(corpusStore.corpora[route.params.corpusId as string]?.name) ||
- (route.params.corpusId as string)
+ (route.params.corpusId as string),
);
function getTitle(route: RouteLocation) {
diff --git a/src/spin/spin.composable.ts b/src/spin/spin.composable.ts
index 7b2a243..bdf6e5e 100644
--- a/src/spin/spin.composable.ts
+++ b/src/spin/spin.composable.ts
@@ -22,7 +22,7 @@ export default function useSpin() {
promise: Promise,
// TODO Remove message
message: string | null,
- token: string
+ token: string,
): Promise {
// Add to watchlist.
unsettled.value.push({
@@ -33,7 +33,7 @@ export default function useSpin() {
return promise.finally(() => {
// Whenever done, remove from watchlist.
const index = unsettled.value.findIndex(
- (item) => item.promise === promise
+ (item) => item.promise === promise,
);
unsettled.value.splice(index, 1);
});
@@ -43,7 +43,7 @@ export default function useSpin() {
* Reactive list of messages, ordered by time added.
*/
const messages = computed(() =>
- unsettled.value.filter((item) => item.message).map((item) => item.message!)
+ unsettled.value.filter((item) => item.message).map((item) => item.message!),
);
/**
@@ -51,8 +51,8 @@ export default function useSpin() {
*/
const pending = computed(() =>
uniq(
- unsettled.value.filter((item) => item.token).map((item) => item.token!)
- )
+ unsettled.value.filter((item) => item.token).map((item) => item.token!),
+ ),
);
return {
diff --git a/src/util.ts b/src/util.ts
index fb9bba9..7bb99e3 100644
--- a/src/util.ts
+++ b/src/util.ts
@@ -57,7 +57,7 @@ export function pathJoin(...parts: string[]) {
export function setKeys(
obj: Record,
keys: string[],
- defaultValue: T
+ defaultValue: T,
) {
// Remove non-matching items.
for (const key in obj) {
@@ -98,26 +98,26 @@ export const unarray = (x: T[] | T): T => (Array.isArray(x) ? x[0] : x);
export const objsToDict = <
T extends Record,
K1 extends keyof T,
- K2 extends keyof T
+ K2 extends keyof T,
>(
objs: T[],
keyName: K1,
- valueName: K2
+ valueName: K2,
): Record =>
objs.reduce(
(dict: Partial>, item) => ({
...dict,
[item[keyName]]: item[valueName],
}),
- {}
+ {},
) as Record;
/** Like lodash/keyBy but slightly more restrictive in range and typing. */
export const keyBy = , K extends keyof T>(
objs: T[],
- prop: K
+ prop: K,
): Record =>
objs.reduce(
(obj, item) => ({ ...obj, [String(item[prop])]: item }),
- {} as Record
+ {} as Record,
);
diff --git a/tsconfig.json b/tsconfig.json
index 36e7753..3e9f868 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -5,9 +5,9 @@
"compilerOptions": {
"baseUrl": ".",
"paths": {
- "@/*": ["./src/*"]
+ "@/*": ["./src/*"],
},
"types": ["@modyfi/vite-plugin-yaml/modules"],
- "allowJs": true
- }
+ "allowJs": true,
+ },
}