Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/fix/linting' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
ctot-nondef committed Sep 9, 2024
2 parents a8824fc + d3b2405 commit 929c6a7
Show file tree
Hide file tree
Showing 16 changed files with 19 additions and 26 deletions.
1 change: 1 addition & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const config = [
{
rules: {
"vue/attributes-order": ["warn", { alphabetical: true }],
"no-undef": "off",
},
},
];
Expand Down
2 changes: 1 addition & 1 deletion nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default defineNuxtConfig({
},

pinia: {
// @ts-ignore
// @ts-expect-error somehow there is no types for this
autoImports: ["defineStore", "acceptHMRUpdate"],
},

Expand Down
2 changes: 1 addition & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { defineConfig, devices } from "@playwright/test";

const port = process.env.PORT ?? 3000;
const baseUrl = `http://localhost:${port}`;
const baseUrl = `http://localhost:${String(port)}`;

export default defineConfig({
testDir: "./e2e",
Expand Down
2 changes: 1 addition & 1 deletion src/components/CombinedMapChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function pointFormatter() {
// @ts-expect-error todo find out how to type this function correctly
.map((query) => [query.userInput, this[query.userInput], query.color])
.sort((a, b) => b[1] - a[1]);
// @ts-expect-error
// @ts-expect-error once again highcharts interal funciton, this is okay
return `<b>${this.id}</b><br/>
${queryArray
.map(
Expand Down
10 changes: 5 additions & 5 deletions src/components/DataDisplay/DataDisplayCollocations.vue
Original file line number Diff line number Diff line change
Expand Up @@ -139,23 +139,23 @@ function pointFormatter() {
this.name +
"</b><br/>" +
"Frequency: " +
// @ts-expect-error
// @ts-expect-error this is used inside the table rendering.
this.freq +
"<br/>" +
"Collocational Frequency: " +
// @ts-expect-error
// @ts-expect-error this is used inside the table rendering.
this.coll_freq +
"<br/>" +
"D: " +
// @ts-expect-error
// @ts-expect-error this is used inside the table rendering.
this.d +
"<br/>" +
"M: " +
// @ts-expect-error
// @ts-expect-error this is used inside the table rendering.
this.m +
"<br/>" +
"T: " +
// @ts-expect-error
// @ts-expect-error this is used inside the table rendering.
this.t
);
}
Expand Down
3 changes: 1 addition & 2 deletions src/components/DataDisplay/DataDisplayKeywordInContext.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,9 @@ const q = computed(() =>
date: Tbl_refs![1] ?? "",
source: Tbl_refs![4] ?? "",
region: Tbl_refs![2] ?? "",
// @ts-ignore wrong types in api lib
// @ts-expect-error wrong types in api lib
left: Left!.map(({ str, strc }) => str || strc).join(" "),
word: typeof Kwic![0] !== "undefined" ? Kwic![0].str : "",
// @ts-ignore wrong types in api lib
right: Right!.map(({ str }: { str: string }) => str).join(" "),
docid: Tbl_refs![0] ?? "",
topic: Tbl_refs![3] ?? "",
Expand Down
4 changes: 2 additions & 2 deletions src/components/DataDisplay/DataDisplayMediaSource.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const t = useTranslations("Corpsum");
const queryStore = useQueryStore();
const { queries } = storeToRefs(queryStore);
const mode = ref("relative");
const mode: Ref<"absolute" | "relative"> = ref("relative");
const expand = ref(false);
const api = useApiClient();
Expand Down Expand Up @@ -105,7 +105,7 @@ const isStacked = computed(() => chartMode.value === "stack");

<template v-if="sourceDistributions && queries">
<MediaStackedBarChart
:mode="mode as 'absolute' | 'relative'"
:mode="mode"
:queries="queries"
:source-distributions="sourceDistributions"
:stack="isStacked"
Expand Down
2 changes: 1 addition & 1 deletion src/components/DataDisplay/DataDisplaySourceTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const columns = computed(() => {
return {
accessorKey: key,
header: () => h("div", { class: "text-right" }, key),
// @ts-ignore this comes from tanstack-table
// @ts-expect-error this comes from tanstack-table
cell: ({ row }) => {
const value = row.getValue(key);
return h("div", { class: "text-right font-medium" }, value as string);
Expand Down
1 change: 0 additions & 1 deletion src/components/Media/MediaStackedBarChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ const series = computed(() => {
}`,
data: categories.value
.map((category) => props.sourceDistributions[i]?.find(({ media }) => category === media))
// @ts-ignore
.map((a) => (a ? a[props.mode] : 0)),
};
});
Expand Down
1 change: 0 additions & 1 deletion src/components/Search/CorpusSelection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ const { data: subCorpora, isPending: subCorporaLoading } = useQuery({
queryKey: ["get-corp-info", selectedCorpus] as const,
queryFn: async () => {
const response = await api.search.getCorpInfo({
/** @ts-ignore undefined prevented through subCorpFetchingIsEnabled **/
corpname: selectedCorpus.value?.name,
subcorpora: 1,
});
Expand Down
1 change: 0 additions & 1 deletion src/components/Search/QueryItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ const setFilters = computed(() => {
// @ts-expect-error just counts the set filters. if it is undefined that's falsy.
(key) => props.query.facettingValues[key]?.length || props.query.facettingValues[key]?.value,
);
keys;
return keys;
});
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/highcharts.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ export default defineNuxtPlugin((nuxtApp) => {

// overwrites the excel download to work propperly. this part is copied and adapted from a highcharts fiddle using that library. could be adapted to use a more maintained one, but would only recomend, if issues surface
HighchartsExcelDownload(Highcharts);
// @ts-ignore
// @ts-expect-error this works and is like in the documentation
nuxtApp.vueApp.use(HighchartsVue, { tagName: "HighCharts" });
});
2 changes: 1 addition & 1 deletion src/plugins/jsonViewer.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import "vue-json-viewer/style.css";

// esilint-ignore-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// @ts-expect-error sadly has no types
import JsonViewer from "vue-json-viewer/ssr";

export default defineNuxtPlugin((nuxtApp) => {
Expand Down
6 changes: 2 additions & 4 deletions src/stores/corpora.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,11 @@ export const useCorporaStore = defineStore(

const corporaForSearch = computed(
() =>
`corpname=${selectedCorpus.value?.corpname}${
selectedSubCorpus.value ? `;usesubcorp=${selectedSubCorpus.value.n}` : ""
}`,
`corpname=${selectedCorpus.value?.corpname ?? ""}${selectedSubCorpus.value ? `;usesubcorp=${selectedSubCorpus.value.n}` : ""}`,
);

const corporaForSearchWithoutSubCorpus = computed(
() => `corpname=${selectedCorpus.value?.corpname}`,
() => `corpname=${selectedCorpus.value?.corpname ?? ""}`,
);

const corporaForSearchKeys = computed(() => {
Expand Down
5 changes: 2 additions & 3 deletions src/stores/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const useQueryStore = defineStore(

const concordance_query: Partial<ConcordanceQuery> = {};

// @ts-ignore
// @ts-expect-error this is okay, because we set the correct key
concordance_query[keyToKey[type]] = userInput;
concordance_query.queryselector = type;

Expand Down Expand Up @@ -90,14 +90,13 @@ export const useQueryStore = defineStore(
});

const getQueryWithFacetting = (query: CorpusQuery) => {
const result: Record<string, string> = { ...query.concordance_query };
const result: Record<string, string | Array<string>> = { ...query.concordance_query };
for (const key in query.facettingValues) {
const elem = query.facettingValues[key];
if (!elem) continue;
// console.log({ key, elem })
if (Array.isArray(elem)) {
if (!elem.length) continue;
// @ts-ignore
result[`sca_${key}`] = elem;
} else result[elem.key] = elem.value;
}
Expand Down
1 change: 0 additions & 1 deletion vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { defineVitestConfig } from "@nuxt/test-utils/config";

export default defineVitestConfig({
// @ts-ignore this is exactly as in the documentation
test: {
environment: "nuxt",
environmentOptions: {
Expand Down

0 comments on commit 929c6a7

Please sign in to comment.