forked from FoundKeyGang/FoundKey
client: fix various lints
Mostly removing unused imports and adding function return types
This commit is contained in:
parent
f9420642aa
commit
db5019d3ec
3 changed files with 26 additions and 18 deletions
|
@ -19,11 +19,10 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, onUnmounted, ref, watch } from 'vue';
|
||||
import { useWidgetPropsManager, Widget, WidgetComponentEmits, WidgetComponentExpose, WidgetComponentProps } from './widget';
|
||||
import { ref, watch } from 'vue';
|
||||
import { useWidgetPropsManager, Widget, WidgetComponentExpose } from './widget';
|
||||
import MarqueeText from '@/components/marquee.vue';
|
||||
import { GetFormResultType } from '@/scripts/form';
|
||||
import * as os from '@/os';
|
||||
import MkContainer from '@/components/ui/container.vue';
|
||||
import { useInterval } from '@/scripts/use-interval';
|
||||
|
||||
|
@ -77,7 +76,7 @@ const items = ref([]);
|
|||
const fetching = ref(true);
|
||||
let key = $ref(0);
|
||||
|
||||
const tick = () => {
|
||||
const tick = (): void => {
|
||||
fetch(`/api/fetch-rss?url=${widgetProps.url}`, {}).then(res => {
|
||||
res.json().then(feed => {
|
||||
items.value = feed.items;
|
||||
|
|
|
@ -14,8 +14,9 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, onUnmounted, ref } from 'vue';
|
||||
import { useWidgetPropsManager, Widget, WidgetComponentEmits, WidgetComponentExpose, WidgetComponentProps } from '../widget';
|
||||
import { onUnmounted } from 'vue';
|
||||
import { ServerInfo } from 'foundkey-js/built/entities';
|
||||
import { useWidgetPropsManager, Widget, WidgetComponentExpose } from '../widget';
|
||||
import XCpuMemory from './cpu-mem.vue';
|
||||
import XNet from './net.vue';
|
||||
import XCpu from './cpu.vue';
|
||||
|
@ -50,8 +51,12 @@ type WidgetProps = GetFormResultType<typeof widgetPropsDef>;
|
|||
// 現時点ではvueの制限によりimportしたtypeをジェネリックに渡せない
|
||||
//const props = defineProps<WidgetComponentProps<WidgetProps>>();
|
||||
//const emit = defineEmits<WidgetComponentEmits<WidgetProps>>();
|
||||
const props = defineProps<{ widget?: Widget<WidgetProps>; }>();
|
||||
const emit = defineEmits<{ (ev: 'updateProps', props: WidgetProps); }>();
|
||||
const props = defineProps<{
|
||||
widget?: Widget<WidgetProps>;
|
||||
}>();
|
||||
const emit = defineEmits<{
|
||||
(ev: 'updateProps', widgetProps: WidgetProps);
|
||||
}>();
|
||||
|
||||
const { widgetProps, configure, save } = useWidgetPropsManager(name,
|
||||
widgetPropsDef,
|
||||
|
@ -59,13 +64,13 @@ const { widgetProps, configure, save } = useWidgetPropsManager(name,
|
|||
emit,
|
||||
);
|
||||
|
||||
const meta = ref(null);
|
||||
let meta = $ref<ServerInfo | null>(null);
|
||||
|
||||
os.api('server-info', {}).then(res => {
|
||||
meta.value = res;
|
||||
meta = res;
|
||||
});
|
||||
|
||||
const toggleView = () => {
|
||||
const toggleView = (): void => {
|
||||
if (widgetProps.view === 4) {
|
||||
widgetProps.view = 0;
|
||||
} else {
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { nextTick, onMounted, onUnmounted, reactive, ref } from 'vue';
|
||||
import { useWidgetPropsManager, Widget, WidgetComponentEmits, WidgetComponentExpose, WidgetComponentProps } from './widget';
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { useWidgetPropsManager, Widget, WidgetComponentExpose } from './widget';
|
||||
import { GetFormResultType } from '@/scripts/form';
|
||||
import * as os from '@/os';
|
||||
import { useInterval } from '@/scripts/use-interval';
|
||||
|
@ -38,8 +38,12 @@ type WidgetProps = GetFormResultType<typeof widgetPropsDef>;
|
|||
// 現時点ではvueの制限によりimportしたtypeをジェネリックに渡せない
|
||||
//const props = defineProps<WidgetComponentProps<WidgetProps>>();
|
||||
//const emit = defineEmits<WidgetComponentEmits<WidgetProps>>();
|
||||
const props = defineProps<{ widget?: Widget<WidgetProps>; }>();
|
||||
const emit = defineEmits<{ (ev: 'updateProps', props: WidgetProps); }>();
|
||||
const props = defineProps<{
|
||||
widget?: Widget<WidgetProps>;
|
||||
}>();
|
||||
const emit = defineEmits<{
|
||||
(ev: 'updateProps', widgetProps: WidgetProps): void;
|
||||
}>();
|
||||
|
||||
const { widgetProps, configure, save } = useWidgetPropsManager(name,
|
||||
widgetPropsDef,
|
||||
|
@ -52,7 +56,7 @@ const fetching = ref(true);
|
|||
const slideA = ref<HTMLElement>();
|
||||
const slideB = ref<HTMLElement>();
|
||||
|
||||
const change = () => {
|
||||
const change = (): void => {
|
||||
if (images.value.length === 0) return;
|
||||
|
||||
const index = Math.floor(Math.random() * images.value.length);
|
||||
|
@ -71,7 +75,7 @@ const change = () => {
|
|||
}, 1000);
|
||||
};
|
||||
|
||||
const fetch = () => {
|
||||
const fetch = (): void => {
|
||||
fetching.value = true;
|
||||
|
||||
os.api('drive/files', {
|
||||
|
@ -87,7 +91,7 @@ const fetch = () => {
|
|||
});
|
||||
};
|
||||
|
||||
const choose = () => {
|
||||
const choose = (): void => {
|
||||
os.selectDriveFolder(false).then(folder => {
|
||||
if (folder == null) {
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue