Skip to content

Commit

Permalink
Fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
evan10s committed Jan 9, 2025
1 parent fc29911 commit 0fbc9bd
Show file tree
Hide file tree
Showing 14 changed files with 49 additions and 23 deletions.
2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"preview": "vite preview",
"lint": "eslint . --ignore-pattern .gitignore",
"lint:fix": "eslint . --fix --ignore-pattern .gitignore",
"lint:ci": "eslint . --max-warnings=0 --output-file eslint_report.json --format json --ignore-path .gitignore"
"lint:ci": "eslint . --max-warnings=0 --output-file eslint_report.json --format json --ignore-pattern .gitignore"
},
"dependencies": {
"@mdi/font": "^7.4.47",
Expand Down
4 changes: 3 additions & 1 deletion client/src/components/alerts/NoPlaylistMappings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
>
<template #text>
<strong>No playlist mappings defined.</strong> Define playlist mappings in
<RouterLink to="/settings">Settings</RouterLink> if you want your videos added to YouTube playlists after being
<RouterLink to="/settings">
Settings
</RouterLink> if you want your videos added to YouTube playlists after being
uploaded and to use the Match Upload Status report.
</template>
</VAlert>
Expand Down
8 changes: 6 additions & 2 deletions client/src/components/autoRename/AutoRenameAssociations.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@
multi-sort
:sort-by="[{ key: 'videoLabel', order: 'asc' }, { key: 'videoTimestamp', order: 'asc' }]"
>
<!-- eslint-disable-next-line vue/valid-v-slot -->
<template #item.status="{ item }">
<VChip :color="statusToColor(item.status)">
{{ statusIncludingRenames(item) }}
</VChip>
</template>

<!-- eslint-disable-next-line vue/valid-v-slot -->
<template #item.actions="{ item }">
<VAlert
v-if="item.renameJobId &&
Expand All @@ -33,6 +35,7 @@
>
File rename failed. Click Review for details.
</VAlert>

<div class="d-flex mt-2 mb-2">
<VBtn
class="mr-2"
Expand Down Expand Up @@ -67,10 +70,12 @@
</div>
</template>

<!-- eslint-disable-next-line vue/valid-v-slot -->
<template #item.videoTimestamp="{ item }">
{{ dayjs(item.videoTimestamp).format("llll z") }}
</template>

<!-- eslint-disable-next-line vue/valid-v-slot -->
<template #item.matchKey="{ item }">
{{ item.matchName ?? "None" }}<br>
<span style="color: gray">{{ item.matchKey ?? "" }}</span>
Expand Down Expand Up @@ -113,11 +118,10 @@ dayjs.extend(localizedFormat);
dayjs.extend(timezone);
dayjs.extend(utc);
const props = defineProps<{
defineProps<{
includedAssociationStatuses: AutoRenameAssociationStatus[];
}>();
const autoRenameStore = useAutoRenameStore();
autoRenameStore.getAssociations();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@
hide-default-header
hide-default-footer
>
<!-- eslint-disable-next-line vue/valid-v-slot -->
<template #item.value="{ item }">
<span v-if="item.key.toLowerCase() === 'match'">
<MatchAutocompleteDropdown
Expand Down
11 changes: 6 additions & 5 deletions client/src/components/form/AutosavingTextInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,17 @@
import {computed, ref} from "vue";
import {SettingType} from "@/types/ISettings";
enum State {
LOADING,
READY,
SUCCESS,
ERROR,
}
interface IProps {
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
onSubmit: Function;
name: string;
label: string;
Expand All @@ -119,12 +120,12 @@ const emit = defineEmits(["savedValueUpdated"]);
const state = ref<State>(State.READY);
// TODO: These no-setup-props-destructure rules are valid but not breaking the component
const inputValue = ref(props.initialValue);
const lastSubmittedValue = ref(props.initialValue);
const error = ref("");
const showPlainText = ref(props.inputType === "text");
async function submit() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const matchListStore = useMatchListStore();
matchListStore.getMatchList();
// eslint-disable-next-line vue/require-prop-types
const model = defineModel();
function matchSelected(value: string) {
Expand Down
23 changes: 15 additions & 8 deletions client/src/components/reports/MatchUploadStatus.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@
</VAlert>
</VCol>
</VRow>
<VRow class="ml-1 mb-2" v-if="playlistsStore.playlistMappingsExist">
<VRow
v-if="playlistsStore.playlistMappingsExist"
class="ml-1 mb-2"
>
<VCol
md="3"
>
Expand Down Expand Up @@ -72,14 +75,18 @@
</VCol>
</VRow>

<VAlert v-if="!playlistsStore.playlistMappingsExist"
color="warning"
variant="tonal"
icon="mdi-alert-circle-outline"
>
To use this report, define at least one playlist mapping in <RouterLink to="/settings">Settings</RouterLink>.
<VAlert
v-if="!playlistsStore.playlistMappingsExist"
color="warning"
variant="tonal"
icon="mdi-alert-circle-outline"
>
To use this report, define at least one playlist mapping in <RouterLink to="/settings">
Settings
</RouterLink>.
</VAlert>
<VDataTable v-else
<VDataTable
v-else
:items="items"
items-per-page="-1"
density="compact"
Expand Down
5 changes: 5 additions & 0 deletions client/src/stores/match.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ export const useMatchStore = defineStore("match", () => {
matchVideos.value.some(video => videoIsUploaded(video));
});

// TODO: Add types for this function
// eslint-disable-next-line @typescript-eslint/no-explicit-any
async function uploadVideo(video: MatchVideoInfo): Promise<any> {
video.isRequestingJob = true;
video.jobCreationError = null;
Expand Down Expand Up @@ -235,6 +237,7 @@ export const useMatchStore = defineStore("match", () => {
return;
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const result: any = await response.json();

if (response.ok) {
Expand All @@ -247,6 +250,7 @@ export const useMatchStore = defineStore("match", () => {
// Catches if the server returns parameter validation errors
if (result.errors) {
console.log("errors", result.errors);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
video.jobCreationError = result.errors.map((error: any) => error.msg).join(", ");
} else {
video.jobCreationError = result.error;
Expand Down Expand Up @@ -345,6 +349,7 @@ export const useMatchStore = defineStore("match", () => {
return !!job.linkedOnTheBlueAlliance && !!job.addedToYouTubePlaylist;
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
watch(isReplay, async (value, oldValue, onCleanup) => {
await getMatchVideos();
await getSuggestedDescription();
Expand Down
6 changes: 5 additions & 1 deletion client/src/stores/playlists.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const usePlaylistsStore = defineStore("playlists", () => {
const loading = ref(false);
const isFirstLoad = ref(true);
const error = ref<string>("");
const playlistMappingsExist = computed(() => !isFirstLoad.value && (playlists.value?.length ?? 0) > 0)
const playlistMappingsExist = computed(() => !isFirstLoad.value && (playlists.value?.length ?? 0) > 0);

const playlistMappings = computed(() => {
if (!playlists.value) {
Expand Down Expand Up @@ -64,6 +64,8 @@ export const usePlaylistsStore = defineStore("playlists", () => {
isFirstLoad.value = false;
}

// TODO: Remove any types from this file

/**
* Save a playlist mapping
*
Expand Down Expand Up @@ -91,6 +93,7 @@ export const usePlaylistsStore = defineStore("playlists", () => {

if (resultJson.errors) {
apiError = true;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
error.value = resultJson.errors.map((error: any) => error.msg).join(", ");
}

Expand Down Expand Up @@ -118,6 +121,7 @@ export const usePlaylistsStore = defineStore("playlists", () => {

if (resultJson.errors) {
apiError = true;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
error.value = resultJson.errors.map((error: any) => error.msg).join(", ");
}

Expand Down
1 change: 0 additions & 1 deletion client/src/stores/uploadedVideos.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { acceptHMRUpdate, defineStore } from "pinia";
import { computed, ref } from "vue";
import { isUploadedVideo, UploadedVideo } from "@/types/UploadedVideo";
import { isEventUploadStatusByMatch, UploadStatusSummary, UploadTotalsSummary } from "@/types/EventUploadStatusByMatch";

export const useUploadedVideosStore = defineStore("uploadedVideos", () => {
Expand Down
1 change: 1 addition & 0 deletions client/src/views/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,7 @@ async function submitEventCode(settingName: string, value: string | boolean, set
return submitResult;
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
async function saveDescriptionTemplate(settingName: string, value: string, settingType: SettingType) {
return await settingsStore.saveDescriptionTemplate(value);
}
Expand Down
2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"build": "npx ts-node build.ts",
"lint": "npx eslint src/ spec/",
"lint:fix": "npx eslint --fix src/ spec/",
"lint:ci": "npx eslint --max-warnings=0 --output-file eslint_report.json --format json --ext .ts src/ spec/",
"lint:ci": "npx eslint --max-warnings=0 --output-file eslint_report.json --format json src/ spec/",
"start": "npx prisma migrate deploy && node -r module-alias/register ./dist --env=production",
"start:worker": "node -r module-alias/register ./dist/worker.js --env=production",
"dev": "nodemon",
Expand Down
3 changes: 2 additions & 1 deletion server/src/services/YouTubeService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ export async function getGoogleOAuth2Client(requestProtocol: string): Promise<OA
const settings = await getSettings();
const secrets = await getSecrets();

// @ts-ignore
// @ts-expect-error This OAuth2 client is correct, but the types don't match for unclear reasons that aren't worth
// investigating right now
return new auth.OAuth2(
settings.googleClientId,
secrets.googleClientSecret,
Expand Down
4 changes: 2 additions & 2 deletions server/src/tasks/uploadVideo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export async function uploadVideo(payload: unknown, { logger, job }: JobHelpers)
});
} catch (e: unknown) {
logger.error(`Unable to save UploadedVideo ${payload.videoPath} with YouTube ID ` +
`${uploadResult.videoId}: ${JSON.stringify(e)}`)
`${uploadResult.videoId}: ${JSON.stringify(e)}`);
}

try {
Expand Down Expand Up @@ -171,7 +171,7 @@ export async function uploadVideo(payload: unknown, { logger, job }: JobHelpers)
});
} catch (e: unknown) {
logger.error(`Unable to update UploadedVideo ${payload.videoPath} with YouTube ID ` +
`${uploadResult.videoId}: ${JSON.stringify(e)}`)
`${uploadResult.videoId}: ${JSON.stringify(e)}`);
}
} else if (isYouTubeVideoUploadError(uploadResult)) {
logger.error(`Failed to upload video ${payload.title}: ${uploadResult.error}`);
Expand Down

0 comments on commit 0fbc9bd

Please sign in to comment.