client: fix various lints

Mostly removing unused imports and adding function return types
This commit is contained in:
Norm 2022-09-04 15:42:07 -04:00
parent f9420642aa
commit db5019d3ec
Signed by untrusted user: norm
GPG key ID: 7123E30E441E80DE
3 changed files with 26 additions and 18 deletions

View file

@ -19,11 +19,10 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, onUnmounted, ref, watch } from 'vue'; import { ref, watch } from 'vue';
import { useWidgetPropsManager, Widget, WidgetComponentEmits, WidgetComponentExpose, WidgetComponentProps } from './widget'; import { useWidgetPropsManager, Widget, WidgetComponentExpose } from './widget';
import MarqueeText from '@/components/marquee.vue'; import MarqueeText from '@/components/marquee.vue';
import { GetFormResultType } from '@/scripts/form'; import { GetFormResultType } from '@/scripts/form';
import * as os from '@/os';
import MkContainer from '@/components/ui/container.vue'; import MkContainer from '@/components/ui/container.vue';
import { useInterval } from '@/scripts/use-interval'; import { useInterval } from '@/scripts/use-interval';
@ -77,7 +76,7 @@ const items = ref([]);
const fetching = ref(true); const fetching = ref(true);
let key = $ref(0); let key = $ref(0);
const tick = () => { const tick = (): void => {
fetch(`/api/fetch-rss?url=${widgetProps.url}`, {}).then(res => { fetch(`/api/fetch-rss?url=${widgetProps.url}`, {}).then(res => {
res.json().then(feed => { res.json().then(feed => {
items.value = feed.items; items.value = feed.items;

View file

@ -14,8 +14,9 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, onUnmounted, ref } from 'vue'; import { onUnmounted } from 'vue';
import { useWidgetPropsManager, Widget, WidgetComponentEmits, WidgetComponentExpose, WidgetComponentProps } from '../widget'; import { ServerInfo } from 'foundkey-js/built/entities';
import { useWidgetPropsManager, Widget, WidgetComponentExpose } from '../widget';
import XCpuMemory from './cpu-mem.vue'; import XCpuMemory from './cpu-mem.vue';
import XNet from './net.vue'; import XNet from './net.vue';
import XCpu from './cpu.vue'; import XCpu from './cpu.vue';
@ -50,8 +51,12 @@ type WidgetProps = GetFormResultType<typeof widgetPropsDef>;
// vueimporttype // vueimporttype
//const props = defineProps<WidgetComponentProps<WidgetProps>>(); //const props = defineProps<WidgetComponentProps<WidgetProps>>();
//const emit = defineEmits<WidgetComponentEmits<WidgetProps>>(); //const emit = defineEmits<WidgetComponentEmits<WidgetProps>>();
const props = defineProps<{ widget?: Widget<WidgetProps>; }>(); const props = defineProps<{
const emit = defineEmits<{ (ev: 'updateProps', props: WidgetProps); }>(); widget?: Widget<WidgetProps>;
}>();
const emit = defineEmits<{
(ev: 'updateProps', widgetProps: WidgetProps);
}>();
const { widgetProps, configure, save } = useWidgetPropsManager(name, const { widgetProps, configure, save } = useWidgetPropsManager(name,
widgetPropsDef, widgetPropsDef,
@ -59,13 +64,13 @@ const { widgetProps, configure, save } = useWidgetPropsManager(name,
emit, emit,
); );
const meta = ref(null); let meta = $ref<ServerInfo | null>(null);
os.api('server-info', {}).then(res => { os.api('server-info', {}).then(res => {
meta.value = res; meta = res;
}); });
const toggleView = () => { const toggleView = (): void => {
if (widgetProps.view === 4) { if (widgetProps.view === 4) {
widgetProps.view = 0; widgetProps.view = 0;
} else { } else {

View file

@ -12,8 +12,8 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { nextTick, onMounted, onUnmounted, reactive, ref } from 'vue'; import { onMounted, ref } from 'vue';
import { useWidgetPropsManager, Widget, WidgetComponentEmits, WidgetComponentExpose, WidgetComponentProps } from './widget'; import { useWidgetPropsManager, Widget, WidgetComponentExpose } from './widget';
import { GetFormResultType } from '@/scripts/form'; import { GetFormResultType } from '@/scripts/form';
import * as os from '@/os'; import * as os from '@/os';
import { useInterval } from '@/scripts/use-interval'; import { useInterval } from '@/scripts/use-interval';
@ -38,8 +38,12 @@ type WidgetProps = GetFormResultType<typeof widgetPropsDef>;
// vueimporttype // vueimporttype
//const props = defineProps<WidgetComponentProps<WidgetProps>>(); //const props = defineProps<WidgetComponentProps<WidgetProps>>();
//const emit = defineEmits<WidgetComponentEmits<WidgetProps>>(); //const emit = defineEmits<WidgetComponentEmits<WidgetProps>>();
const props = defineProps<{ widget?: Widget<WidgetProps>; }>(); const props = defineProps<{
const emit = defineEmits<{ (ev: 'updateProps', props: WidgetProps); }>(); widget?: Widget<WidgetProps>;
}>();
const emit = defineEmits<{
(ev: 'updateProps', widgetProps: WidgetProps): void;
}>();
const { widgetProps, configure, save } = useWidgetPropsManager(name, const { widgetProps, configure, save } = useWidgetPropsManager(name,
widgetPropsDef, widgetPropsDef,
@ -52,7 +56,7 @@ const fetching = ref(true);
const slideA = ref<HTMLElement>(); const slideA = ref<HTMLElement>();
const slideB = ref<HTMLElement>(); const slideB = ref<HTMLElement>();
const change = () => { const change = (): void => {
if (images.value.length === 0) return; if (images.value.length === 0) return;
const index = Math.floor(Math.random() * images.value.length); const index = Math.floor(Math.random() * images.value.length);
@ -71,7 +75,7 @@ const change = () => {
}, 1000); }, 1000);
}; };
const fetch = () => { const fetch = (): void => {
fetching.value = true; fetching.value = true;
os.api('drive/files', { os.api('drive/files', {
@ -87,7 +91,7 @@ const fetch = () => {
}); });
}; };
const choose = () => { const choose = (): void => {
os.selectDriveFolder(false).then(folder => { os.selectDriveFolder(false).then(folder => {
if (folder == null) { if (folder == null) {
return; return;