Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
42 changes: 42 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: CI

on:
pull_request:
push:
branches:
- main

permissions:
contents: read

jobs:
quality:
name: Code quality

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

他のワークフローの記述を参考にしつつ、ジョブ名を

  • 動詞から始まる
  • 具体的な処理内容を書く

ものに変えてみるとより分かりやすくなると思います。私がパッと思いつくところだと Lint and Format とか

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

より具体的な方が分かりやすいのでそうします!

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Setup pnpm
uses: pnpm/action-setup@8912a9102ac27614460f54aedde9e1e7f9aec20d # v6.0.5
- name: Setup Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version-file: .node-version
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- name: Restore quality caches
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
.eslintcache
.prettier-cache
key: quality-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml', 'package.json', 'eslint.config.js', '.prettierrc.json', '.prettierignore') }}-${{ github.sha }}
restore-keys: |
quality-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml', 'package.json', 'eslint.config.js', '.prettierrc.json', '.prettierignore') }}-
- name: Install dependencies
run: pnpm ci
- name: Run ESLint
run: pnpm lint:check
- name: Check Prettier formatting
run: pnpm format:check
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ coverage

*.tsbuildinfo

.eslintcache
.prettier-cache

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

一応確認しておくと、ワークフローにてPrettierのキャッシュは保存しないことにしたけど将来的にやっぱり保存する可能性もあるので記述のみ .gitignore に残した、という理解でよいですか?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

すみません!!実行時間が十分早かったのでキャッシュなくしたのですが、gitignoreから消し忘れてました!!


.env.local
.env.*.local

Expand Down
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.md
pnpm-lock.yaml
public/mockServiceWorker.js
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
"build-only": "vite build",
"type-check": "vue-tsc --build",
"lint": "eslint . --fix",
"lint:check": "eslint . --cache --cache-location .eslintcache --max-warnings=0",
"format": "prettier --write src/",
"format:check": "prettier --cache --cache-location .prettier-cache --check .",
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
"generate:api": "npx openapi-typescript https://raw.githubusercontent.com/traPtitech/rucQ/main/openapi.yaml -o src/api/schema.d.ts && pnpm format"
},
"packageManager": "pnpm@11.5.0",
Expand Down
2 changes: 1 addition & 1 deletion src/components/information/QuestionGroupPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ const allChecked = computed(() => {
let result = true
for (const question of props.questionGroup.questions) {
const answer = answersMap[question.id]
if (!answer || answer.value === undefined || answer.value === null) {
if (answer?.value === undefined) {
result = false // multiple の [], free_text の '' は falsy だが回答済みとみなす
break
}
Expand Down
8 changes: 1 addition & 7 deletions src/components/layout/HeaderButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,7 @@ const campIconUrl = computed(() => {
<template>
<v-app-bar v-if="xs" elevation="2" color="white" density="comfortable" :class="$style.appBar">
<template #prepend>
<img
:src="campIconUrl"
alt="rucQ Icon"
width="44"
height="44"
:class="$style.icon"
/>
<img :src="campIconUrl" alt="rucQ Icon" width="44" height="44" :class="$style.icon" />
</template>
<v-app-bar-title :class="isArchived ? $style.archivedTitle : 'text-primary'">
<span :class="$style.routeTitle">{{ route.name }} </span>
Expand Down
2 changes: 1 addition & 1 deletion src/components/markdown/MarkdownPreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ watch(
headingElements.forEach((heading) => {
const level = parseInt(heading.tagName.charAt(1))
const id = `heading-${idCounter++}`
const text = heading.textContent ?? ''
const text = heading.textContent
Comment thread
coderabbitai[bot] marked this conversation as resolved.

heading.setAttribute('id', id)
headingInfos.push({ id, level, text })
Comment on lines 71 to 77
Expand Down
6 changes: 3 additions & 3 deletions src/components/rollcall/rollCallStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export function useRollCallStream(rollcall: Ref<RollCall | undefined>, userId: s
const idx = reactions.value.findIndex((r) => r.userId === ev.userId)
const entry = { id: ev.id, userId: ev.userId, content: ev.content }
if (idx >= 0) reactions.value[idx] = entry
else reactions.value.push(entry as RollCallReaction)
else reactions.value.push(entry)
break
}
case 'updated': {
Expand All @@ -74,7 +74,7 @@ export function useRollCallStream(rollcall: Ref<RollCall | undefined>, userId: s
id: ev.id,
userId: ev.userId,
content: ev.content,
} as RollCallReaction
}
break
}
case 'deleted': {
Expand Down Expand Up @@ -105,7 +105,7 @@ export function useRollCallStream(rollcall: Ref<RollCall | undefined>, userId: s
const chooseOption = async (content: string) => {
if (!rollcall.value) return
if (!rollcall.value.subjects.includes(userId)) return
if (myReaction.value && myReaction.value.content === content) return
if (myReaction.value?.content === content) return
if (inFlight.value) return // いずれかの操作中は他の操作を禁止

try {
Expand Down
2 changes: 1 addition & 1 deletion src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export const useCampStore = defineStore('camp', () => {

const isOperable = (camp: Camp) => {
// 最新の合宿かつ登録済みで、かつ終了していない場合のみ操作可能
if (!latestCamp.value || latestCamp.value.id !== camp.id) return false
if (latestCamp.value?.id !== camp.id) return false
return hasRegisteredLatest.value && !timeStore.isCampEnded(camp)
}

Expand Down
104 changes: 52 additions & 52 deletions src/views/ActivityView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,58 +81,58 @@ const dailyActivities = computed(() => {
<!-- Content -->
<div v-else class="pa-4" :class="$style.container">
<template v-for="day in dailyActivities" :key="day.date.toISOString()">
<h3 class="mb-2 mt-4" :class="$style.dayHeader">
{{ getDayStringNoPad(day.date) }}
</h3>
<div class="d-flex flex-column ga-3">
<template v-for="activity in day.activities" :key="`${activity.id}-${activity.time}`">
<activity-layout
v-if="activity.type === 'room_created'"
:type="activity.type"
:date="new Date(activity.time)"
>
<template #default="{ color }">
<span :class="`text-${color}`"> 部屋情報が公開されました </span>
</template>
</activity-layout>
<activity-layout
v-if="activity.type === 'payment_created'"
:type="activity.type"
:date="new Date(activity.time)"
>
<template #default="{ color }">
<span :class="`text-${color}`">
{{ activity.amount.toLocaleString() }} 円の支払いが作成されました
</span>
</template>
</activity-layout>
<activity-layout
v-if="activity.type === 'payment_amount_changed'"
:type="activity.type"
:date="new Date(activity.time)"
>
<template #default="{ color }">
<span :class="`text-${color}`">
支払い金額が {{ activity.amount.toLocaleString() }} 円に変更されました
</span>
</template>
</activity-layout>
<activity-layout
v-if="activity.type === 'payment_paid_changed'"
:type="activity.type"
:date="new Date(activity.time)"
>
<template #default="{ color }">
<span :class="`text-${color}`">
合宿係が {{ activity.amount.toLocaleString() }} 円の振込を確認しました
</span>
</template>
</activity-layout>
<roll-call-activity v-if="activity.type === 'roll_call_created'" :activity="activity" />
<question-activity v-if="activity.type === 'question_created'" :activity="activity" />
</template>
</div>
</template>
<h3 class="mb-2 mt-4" :class="$style.dayHeader">
{{ getDayStringNoPad(day.date) }}
</h3>
<div class="d-flex flex-column ga-3">
<template v-for="activity in day.activities" :key="`${activity.id}-${activity.time}`">
<activity-layout
v-if="activity.type === 'room_created'"
:type="activity.type"
:date="new Date(activity.time)"
>
<template #default="{ color }">
<span :class="`text-${color}`"> 部屋情報が公開されました </span>
</template>
</activity-layout>
<activity-layout
v-if="activity.type === 'payment_created'"
:type="activity.type"
:date="new Date(activity.time)"
>
<template #default="{ color }">
<span :class="`text-${color}`">
{{ activity.amount.toLocaleString() }} 円の支払いが作成されました
</span>
</template>
</activity-layout>
<activity-layout
v-if="activity.type === 'payment_amount_changed'"
:type="activity.type"
:date="new Date(activity.time)"
>
<template #default="{ color }">
<span :class="`text-${color}`">
支払い金額が {{ activity.amount.toLocaleString() }} 円に変更されました
</span>
</template>
</activity-layout>
<activity-layout
v-if="activity.type === 'payment_paid_changed'"
:type="activity.type"
:date="new Date(activity.time)"
>
<template #default="{ color }">
<span :class="`text-${color}`">
合宿係が {{ activity.amount.toLocaleString() }} 円の振込を確認しました
</span>
</template>
</activity-layout>
<roll-call-activity v-if="activity.type === 'roll_call_created'" :activity="activity" />
<question-activity v-if="activity.type === 'question_created'" :activity="activity" />
</template>
</div>
</template>
</div>
</div>
</template>
Expand Down
Loading