fix: type errors round 1

This commit is contained in:
Zack Spear
2024-05-15 15:05:49 -07:00
committed by Zack Spear
parent 7759fe1dc3
commit 81a6a52d9f
12 changed files with 50 additions and 32 deletions

View File

@@ -69,41 +69,48 @@ let regExp: number | undefined;
let regDevs = 0;
let regTy = '';
switch (state) {
// @ts-expect-error
// @ts-expect-error - bro idk why…
case 'EEXPIRED':
expireTime = uptime; // 1 hour ago
// @ts-expect-error
break;
// @ts-expect-error - bro idk why…
case 'ENOCONN':
// @ts-expect-error
break;
// @ts-expect-error - bro idk why…
case 'TRIAL':
expireTime = oneHourFromNow; // in 1 hour
regTy = 'Trial';
break;
case 'BASIC':
regDevs = 6;
// @ts-expect-error
regTy = 'Basic';
break;
// @ts-expect-error - bro idk why…
case 'PLUS':
regDevs = 12;
// @ts-expect-error
regTy = 'Plus';
break;
// @ts-expect-error - bro idk why…
case 'PRO':
// @ts-expect-error
regDevs = -1;
regTy = 'Pro';
break;
// @ts-expect-error - bro idk why…
case 'STARTER':
regDevs = 6;
// regExp = oneHourFromNow;
// regExp = oneDayFromNow;
regExp = ninetyDaysAgo;
// regExp = uptime;
// regExp = 1696363920000; // nori.local's expiration
// @ts-expect-error
regTy = 'Starter';
break;
// @ts-expect-error - bro idk why…
case 'UNLEASHED':
// regExp = oneHourFromNow;
// regExp = oneDayFromNow;
// regExp = oneDayAgo;
// regExp = uptime;
// regExp = 1696363920000; // nori.local's expiration
// @ts-expect-error
regDevs = -1;
regExp = ninetyDaysAgo;
regTy = 'Unleashed';
break;
// @ts-expect-error - bro idk why…
case 'LIFETIME':
if (regDevs === 0) { regDevs = -1; }
if (regTy === '') { regTy = state.charAt(0).toUpperCase() + state.substring(1).toLowerCase(); } // title case
regDevs = -1;
regTy = 'Lifetime';
break;
}
@@ -166,6 +173,7 @@ export const serverState: Server = {
regTm: twoDaysAgo,
regTo: 'Zack Spear',
regTy,
regDevs,
regExp,
regGuid,
site: 'http://localhost:4321',

View File

@@ -1,7 +1,7 @@
<script lang="ts" setup>
const nuxtApp = useNuxtApp();
onBeforeMount(() => {
// @ts-expect-error
// @ts-expect-error - becuase customElements is not a type in nuxtApp and is not provided by the nuxt plugin
nuxtApp.$customElements.registerEntry('UnraidComponents');
});
</script>

View File

@@ -1,4 +1,5 @@
<script lang="ts" setup>
// eslint-disable vue/no-v-html
import { storeToRefs } from 'pinia';
import { useI18n } from 'vue-i18n';

View File

@@ -17,6 +17,7 @@ let nonDefaultLocale = false;
* Unfortunately, this was the only way I could get the data from PHP to vue-i18n :(
* I tried using i18n.setLocaleMessage() but it didn't work no matter what I tried.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any - window.LOCALE_DATA is set in webgui PHP
const windowLocaleData = (window as any).LOCALE_DATA || null;
if (windowLocaleData) {
try {

View File

@@ -1,11 +1,12 @@
<script setup lang="ts">
import { TransitionRoot } from '@headlessui/vue';
import { storeToRefs } from 'pinia';
import type { ComposerTranslation } from 'vue-i18n';
import { useDropdownStore } from '~/store/dropdown';
import { useServerStore } from '~/store/server';
defineProps<{ t: any; }>();
defineProps<{ t: ComposerTranslation; }>();
const dropdownStore = useDropdownStore();

View File

@@ -2,5 +2,10 @@
import withNuxt from './.nuxt/eslint.config.mjs'
export default withNuxt(
// Your custom configs here
{
rules: {
'vue/multi-word-component-names': 'off', // turn off to allow web component parents to work and not trigger errors
'vue/no-v-html': 'off',
},
},
)

View File

@@ -3,7 +3,7 @@ import { serverState } from '~/_data/serverState';
const nuxtApp = useNuxtApp();
onBeforeMount(() => {
// @ts-expect-error
// @ts-expect-error - customElements not providing types here
nuxtApp.$customElements.registerEntry('UnraidComponents');
});
</script>

View File

@@ -109,10 +109,10 @@ export const useErrorsStore = defineStore('errors', () => {
}
$panels.forEach(($panel: Element) => {
if ($panel.id === 'troubleshoot_panel') {
// @ts-expect-error
// @ts-expect-error - because the webgui is the wild wild west
$panel.style.display = 'block';
} else {
// @ts-expect-error
// @ts-expect-error - because the webgui is the wild wild west
$panel.style.display = 'none';
}
});

View File

@@ -1,4 +1,4 @@
// @ts-expect-error
// @ts-expect-error - ignore that it can't find any declarations
import { from, ApolloClient, createHttpLink, InMemoryCache, split } from '@apollo/client/core/core.cjs';
import { onError } from '@apollo/client/link/error';
import { RetryLink } from '@apollo/client/link/retry';
@@ -30,7 +30,7 @@ const wsEndpoint = new URL(WEBGUI_GRAPHQL.toString().replace('http', 'ws'));
export const useUnraidApiStore = defineStore('unraidApi', () => {
const errorsStore = useErrorsStore();
const serverStore = useServerStore();
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const unraidApiClient = ref<ApolloClient<any>>();
watch(unraidApiClient, (newVal) => {
if (newVal) {
@@ -82,6 +82,7 @@ export const useUnraidApiStore = defineStore('unraidApi', () => {
}),
);
// @typescript-eslint/no-explicit-any-disable-next-line
const errorLink = onError(({ graphQLErrors, networkError }: any) => {
if (graphQLErrors) {
graphQLErrors.map((error: any) => {

View File

@@ -190,13 +190,13 @@ export const useUpdateOsActionsStore = defineStore('updateOsActions', () => {
* By default this will display current version's release notes
*/
const viewReleaseNotes = (modalTitle:string, webguiFilePath?:string|undefined) => {
// @ts-expect-error
// @ts-expect-error • global set in the webgui
if (typeof openChanges === 'function') {
// @ts-expect-error
// @ts-expect-error • global set in the webgui
openChanges(`showchanges ${webguiFilePath ?? '/var/tmp/unRAIDServer.txt'}`, modalTitle);
// @ts-expect-error
// @ts-expect-error • global set in the webgui
} else if (typeof openBox === 'function') {
// @ts-expect-error
// @ts-expect-error • global set in the webgui
openBox(`/plugins/dynamix.plugin.manager/include/ShowChanges.php?file=${webguiFilePath ?? '/var/tmp/unRAIDServer.txt'}`, modalTitle, 600, 900);
} else {
alert('Unable to open release notes');

View File

@@ -111,7 +111,7 @@ export default <Partial<Config>>{
/**
* @todo modify prose classes to use pixels for webgui…sadge https://tailwindcss.com/docs/typography-plugin#customizing-the-default-theme
*/
// @ts-expect-error
// @ts-expect-error - because spending too much time here to figure this out would cost a lot of money
typography: theme => ({
DEFAULT: {
css: {

View File

@@ -1,6 +1,7 @@
import type { ArrowTopRightOnSquareIcon } from '@heroicons/vue/24/solid';
export interface UserProfileLink {
// void | Promise<void>
click?: any; // @todo be more specific
clickParams?: string[] | number[];
disabled?: boolean;