Skip to content

fix(eslint): resolve multiple eslint errors #637

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/thin-donkeys-drop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"enspire": patch
---

Resolve ESLint issues
2 changes: 1 addition & 1 deletion .github/workflows/on-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Apply all pending migrations to the database
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/on-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Apply all pending migrations to the database
Expand Down
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ dist: jammy
cache:
npm: false
directories:
- "~/.pnpm-store"
- ~/.pnpm-store

before_install:
- corepack enable
- corepack prepare pnpm@latest-9 --activate
- pnpm config set store-dir ~/.pnpm-store

install:
- pnpm install

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@

const { toast } = useToast()

const { data } = await useAsyncData<ClassroomData[]>('classroomStatuses', () => {
return $fetch<ClassroomData[]>(`/api/reservation/classroomId`, {
headers: useRequestHeaders(),
method: 'GET',
})
})
const { data } = await useAsyncData<ClassroomData[]>(
'classroomStatuses',
() => {
return $fetch<ClassroomData[]>(`/api/reservation/classroomId`, {
headers: useRequestHeaders(),
method: 'GET',
})
},
)

if (!data.value) {
toast({
Expand All @@ -29,7 +32,7 @@
})
}
else {
data.value = data.value.sort((a: any, b: any) => a.name < b.name ? -1 : 1)
data.value = data.value.sort((a: any, b: any) => (a.name < b.name ? -1 : 1))
}

const { data: clubs } = await useAsyncData<AllClubs>('clubs', () => {
Expand Down Expand Up @@ -141,7 +144,9 @@
<FormItem>
<FormLabel>预约时间</FormLabel>
<FormControl>
<div class="flex flex-col sm:flex-row space-y-2 sm:space-y-0 sm:space-x-1 justify-start">
<div
class="flex flex-col sm:flex-row space-y-2 sm:space-y-0 sm:space-x-1 justify-start"
>
<!-- This ToggleGroup should be implemented in a better way but anyway it works -->
<ToggleGroup :key="reloadKey" type="multiple" variant="outline">
<div class="text-muted-foreground text-sm text-center w-7">
Expand All @@ -168,8 +173,12 @@
<SelectValue placeholder="选择时段" />
</SelectTrigger>
<SelectContent>
<SelectItem v-for="period in enums.periods.values" :key="period" :value="period">
<SelectItem
v-for="period in enums.periods.values"
:key="period"
:value="period"
>
{{ enums.periods.map[period] }}

Check failure on line 181 in components/custom/CAS/ClassroomReservation/NewClassroomReservation.vue

View workflow job for this annotation

GitHub Actions / Typecheck

Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{ MORNING: string; ONE: string; TWO: string; THREE: string; FOUR: string; NOON: string; FIVE: string; SIX: string; SEVEN: string; EIGHT: string; NINE: string; AFTERCLASS: string; }'.
</SelectItem>
</SelectContent>
</Select>
Expand Down Expand Up @@ -200,7 +209,10 @@
</span>
</span>
<span v-if="classroom.size" class="text-gray-400">
可容纳<span class="inline-block w-5 text-center">{{ classroom.size }}</span>人
可容纳<span class="inline-block w-5 text-center">{{
classroom.size
}}</span>
</span>
</SelectItem>
</SelectGroup>
Expand All @@ -217,28 +229,36 @@
<SelectValue placeholder="选择你的社团" />
</SelectTrigger>
<SelectContent>
<SelectGroup v-if="clubs?.president && clubs?.president.length">
<SelectItem v-for="club in clubs?.president" :key="club.id" :value="club.id">
<SelectGroup
v-if="clubs?.president && clubs?.president.length"
>
<SelectItem
v-for="club in clubs?.president"
:key="club.id"
:value="club.id"

Check failure on line 238 in components/custom/CAS/ClassroomReservation/NewClassroomReservation.vue

View workflow job for this annotation

GitHub Actions / Typecheck

Type 'number' is not assignable to type 'string'.
>
{{ club.name.zh }}
<span class="inline-block text-gray-500">
社长
</span>
<span class="inline-block text-gray-500"> 社长 </span>
</SelectItem>
</SelectGroup>
<SelectGroup v-if="clubs?.vice && clubs?.vice.length">
<SelectItem v-for="club in clubs?.vice" :key="club.id" :value="club.id">
<SelectItem
v-for="club in clubs?.vice"
:key="club.id"
:value="club.id"

Check failure on line 248 in components/custom/CAS/ClassroomReservation/NewClassroomReservation.vue

View workflow job for this annotation

GitHub Actions / Typecheck

Type 'number' is not assignable to type 'string'.
>
{{ club.name.zh }}
<span class="inline-block text-gray-500">
副社
</span>
<span class="inline-block text-gray-500"> 副社 </span>
</SelectItem>
</SelectGroup>
<SelectGroup v-if="clubs?.member && clubs?.member.length">
<SelectItem v-for="club in clubs?.member" :key="club.id" :value="club.id">
<SelectItem
v-for="club in clubs?.member"
:key="club.id"
:value="club.id"

Check failure on line 258 in components/custom/CAS/ClassroomReservation/NewClassroomReservation.vue

View workflow job for this annotation

GitHub Actions / Typecheck

Type 'number' is not assignable to type 'string'.
>
{{ club.name.zh }}
<span class="inline-block text-gray-500">
成员
</span>
<span class="inline-block text-gray-500"> 成员 </span>
</SelectItem>
</SelectGroup>
</SelectContent>
Expand All @@ -250,11 +270,15 @@
<FormItem>
<FormLabel>备注</FormLabel>
<FormControl>
<Textarea v-model="formData.note" type="text" placeholder="备注" class="resize-none" rows="3" />
<Textarea
v-model="formData.note"
type="text"
placeholder="备注"
class="resize-none"
rows="3"
/>
</FormControl>
<FormDescription>
非必填
</FormDescription>
<FormDescription> 非必填 </FormDescription>
<FormMessage />
</FormItem>
</FormField>
Expand Down
107 changes: 73 additions & 34 deletions components/custom/CAS/Record/NewActivityRecord.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
<script setup lang="ts">
import { Button } from '@/components/ui/button'
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from '@/components/ui/card'
import { Multiselect } from '@/components/ui/multiselect'
import {
NumberField,
Expand All @@ -9,7 +15,13 @@
NumberFieldIncrement,
NumberFieldInput,
} from '@/components/ui/number-field'
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from '@/components/ui/select'
import { Textarea } from '@/components/ui/textarea'
import { useToast } from '@/components/ui/toast/use-toast'
import { toTypedSchema } from '@vee-validate/zod'
Expand All @@ -32,18 +44,20 @@

const isLoading = ref(false)

const formSchema = toTypedSchema(z.object({
club: z.string(),
date: z.date(),
text: z.string().min(10).max(300),
members: z.array(z.string().uuid()),
cTime: z.number().min(0).max(5),
aTime: z.number().min(0).max(5),
sTime: z.number().min(0).max(5),
}))
const formSchema = toTypedSchema(
z.object({
club: z.string(),
date: z.date(),
text: z.string().min(10).max(300),
members: z.array(z.string().uuid()),
cTime: z.number().min(0).max(5),
aTime: z.number().min(0).max(5),
sTime: z.number().min(0).max(5),
}),
)

const { data } = await useAsyncData<AllClubs>('allClubs', () => {
return $fetch('/api/user/all_clubs?includeMemberships=true', {

Check failure on line 60 in components/custom/CAS/Record/NewActivityRecord.vue

View workflow job for this annotation

GitHub Actions / Typecheck

Excessive stack depth comparing types 'Exclude<R extends "/api/bind/confirm" ? { key: "/api/bind/confirm"; exact: true; score: []; catchAll: false; } : { key: "/api/bind/confirm"; exact: false; score: `${R}/` extends `${infer RouteSeg}/${infer RouteRest}` ? `${RouteSeg}?` extends `${infer RouteSegWithoutQuery}?${string}` ? RouteSegWithoutQuery extends ""...' and '{ score: MaxTuple<((R extends "/api/bind/confirm" ? { key: "/api/bind/confirm"; exact: true; score: []; catchAll: false; } : { key: "/api/bind/confirm"; exact: false; score: `${R}/` extends `${infer RouteSeg}/${infer RouteRest}` ? `${RouteSeg}?` extends `${infer RouteSegWithoutQuery}?${string}` ? RouteSegWithoutQuer...'.

Check failure on line 60 in components/custom/CAS/Record/NewActivityRecord.vue

View workflow job for this annotation

GitHub Actions / Typecheck

Excessive stack depth comparing types 'Exclude<{ key: "/__nuxt_error"; exact: false; score: `${R}/` extends `${infer RouteSeg}/${infer RouteRest}` ? `${RouteSeg}?` extends `${infer RouteSegWithoutQuery}?${string}` ? RouteSegWithoutQuery extends "" ? `${RouteRest}/` extends `${infer RouteSeg}/${infer RouteRest}` ? `${RouteSeg}?` extends `${infer RouteSegW...' and '{ score: MaxTuple<((R extends "/api/bind/confirm" ? { key: "/api/bind/confirm"; exact: true; score: []; catchAll: false; } : { key: "/api/bind/confirm"; exact: false; score: `${R}/` extends `${infer RouteSeg}/${infer RouteRest}` ? `${RouteSeg}?` extends `${infer RouteSegWithoutQuery}?${string}` ? RouteSegWithoutQuer...'.
headers: useRequestHeaders(),
method: 'GET',
})
Expand Down Expand Up @@ -101,13 +115,20 @@
<FormItem>
<FormLabel>社团</FormLabel>

<Select v-bind="componentField" @update:model-value="selectedClub = $event">
<Select
v-bind="componentField"
@update:model-value="selectedClub = $event"
>
<FormControl>
<SelectTrigger
:class="cn(
'w-full ps-3 text-start font-normal hover:bg-muted',
!value && 'text-muted-foreground',
)" variant="outline" :disabled="isLoading"
:class="
cn(
'w-full ps-3 text-start font-normal hover:bg-muted',
!value && 'text-muted-foreground',
)
"
variant="outline"
:disabled="isLoading"
>
<SelectValue placeholder="选择您需要记录的社团..." />
</SelectTrigger>
Expand All @@ -116,7 +137,8 @@
<SelectGroup v-if="data">
<SelectItem
v-for="club in [...data.vice, ...data.president]"
:key="club.id" :value="String(club.id)"
:key="club.id"
:value="String(club.id)"
>
{{ club.name.zh }}
</SelectItem>
Expand All @@ -134,14 +156,22 @@
<PopoverTrigger as-child>
<FormControl>
<Button
:class="cn(
'w-full ps-3 text-start font-normal',
!value && 'text-muted-foreground',
)" variant="outline"
:class="
cn(
'w-full ps-3 text-start font-normal',
!value && 'text-muted-foreground',
)
"
variant="outline"
:disabled="isLoading"
>
<span>{{ value ? $dayjs(value).format("LL") : "选择日期..." }}</span>
<Icon class="ms-auto opacity-50" name="material-symbols:calendar-today-outline" />
<span>{{
value ? $dayjs(value).format("LL") : "选择日期..."
}}</span>
<Icon
class="ms-auto opacity-50"
name="material-symbols:calendar-today-outline"
/>
</Button>
</FormControl>
</PopoverTrigger>
Expand All @@ -154,9 +184,14 @@
</FormField>

<div class="flex space-x-2 w-full">
<FormField v-for="(slot, index) in ['cTime', 'aTime', 'sTime']" :key="index" v-slot="{ value }" :name="slot">
<FormField
v-for="(slot, index) in ['cTime', 'aTime', 'sTime']"
:key="index"
v-slot="{ value }"
:name="slot"
>
<FormItem>
<FormLabel>{{ ['C', 'A', 'S'][index] }}时间</FormLabel>
<FormLabel>{{ ["C", "A", "S"][index] }}时间</FormLabel>
<NumberField
class="gap-2 w-max"
:min="0"
Expand Down Expand Up @@ -209,14 +244,14 @@
<FormControl>
<Multiselect
v-if="data"
:options="((
[...data.president, ...data.vice].find(
(club) => club.id === Number(selectedClub),
)
)?.memberships)?.map((membership) => ({
label: membership.name,
value: membership.id,
})) ?? []"
:options="
[...data.president, ...data.vice]
.find((club) => club.id === Number(selectedClub))
?.memberships?.map((membership) => ({
label: membership.name,
value: membership.id,
})) ?? []
"
placeholder="Select options"
variant="inverted"
v-bind="componentField"
Expand All @@ -229,7 +264,11 @@
</FormField>

<Button :disabled="isLoading" type="submit">
<Icon v-if="isLoading" class="mr-2" name="svg-spinners:180-ring-with-bg" />
<Icon
v-if="isLoading"
class="mr-2"
name="svg-spinners:180-ring-with-bg"
/>
提交
</Button>
</form>
Expand Down
4 changes: 2 additions & 2 deletions components/custom/club-card.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<script setup lang="ts">
import type { PropType } from 'vue'
import type { Club } from '~/types/clubs'
import Badge from '@/components/ui/badge/Badge.vue'
import { Button } from '@/components/ui/button'
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '@/components/ui/card'
import { cn } from '@/lib/utils'
import Badge from '@/components/ui/badge/Badge.vue'
import sanitizeHtml from 'sanitize-html'
import type { Club } from '~/types/clubs'

const props = defineProps({
club: {
Expand Down
10 changes: 5 additions & 5 deletions data/forms/forms.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
20240930_0001:
title: "社团注册表"
description: "提交社团注册表,如有多个社团可反复在此提交。"
url: "https://wzvkx0jz.nocodb.com/#/nc/form/4b639cfb-a057-414f-b778-016c02309f32?embed"
start_date: "2024-09-30"
end_date: "2024-10-30"
title: 社团注册表
description: 提交社团注册表,如有多个社团可反复在此提交。
url: 'https://wzvkx0jz.nocodb.com/#/nc/form/4b639cfb-a057-414f-b778-016c02309f32?embed'
start_date: 2024-09-30
end_date: 2024-10-30
2 changes: 1 addition & 1 deletion db/migrations/migration_lock.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Please do not edit this file manually
# It should be added in your version-control system (i.e. Git)
provider = "postgresql"
provider = "postgresql"
2 changes: 1 addition & 1 deletion layouts/sign-in-or-out.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { useFavicon, usePreferredDark } from '@vueuse/core'
import IconLogo from '@/assets/logo.svg'

Check failure on line 2 in layouts/sign-in-or-out.vue

View workflow job for this annotation

GitHub Actions / Typecheck

Cannot find module '@/assets/logo.svg' or its corresponding type declarations.
import { useFavicon, usePreferredDark } from '@vueuse/core'

const isDark = usePreferredDark()
const favicon = computed(() => isDark.value ? '/favicon-dark.ico' : '/favicon.ico')
Expand Down
Loading
Loading