Skip to content

Commit

Permalink
Refactor: [Client] ESLint の自動フォーマットを適用
Browse files Browse the repository at this point in the history
  • Loading branch information
tsukumijima committed Apr 23, 2023
1 parent 70c95a3 commit 2ddd822
Show file tree
Hide file tree
Showing 35 changed files with 87 additions and 88 deletions.
8 changes: 4 additions & 4 deletions client/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}
presets: [
'@vue/cli-plugin-babel/preset'
]
};
2 changes: 1 addition & 1 deletion client/src/components/Navigation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export default Vue.extend({
// アップデートが利用可能か
is_update_available: false as boolean,
}
};
},
async created() {
try {
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Panel/Channel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default Vue.extend({
// タブの状態管理
tab: null,
}
};
},
computed: {
// ChannelsStore に this.channelsStore でアクセスできるようにする
Expand Down
16 changes: 8 additions & 8 deletions client/src/components/Panel/Comment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export default Vue.extend({
// コメントのミュート設定のモーダルを表示するか
comment_mute_settings_modal: false,
}
};
},
computed: {
// UserStore に this.userStore でアクセスできるようにする
Expand Down Expand Up @@ -158,20 +158,20 @@ export default Vue.extend({
const x = event.clientX - this.comment_list_element.getBoundingClientRect().left;
// 座標が clientWidth 以上であれば、スクロールバー上で mousedown されたものとする
if (x > this.comment_list_element.clientWidth) is_user_scrolling = true;
}
};
this.comment_list_element.onmouseup = (event: MouseEvent) => {
// コメントリストの要素の左上を起点としたカーソルのX座標を求める
const x = event.clientX - this.comment_list_element.getBoundingClientRect().left;
// 座標が clientWidth 以上であれば、スクロールバー上で mouseup されたものとする
if (x > this.comment_list_element.clientWidth) is_user_scrolling = false;
}
};
// ユーザーによるスクロールイベントで is_user_scrolling を true にする
// 0.1 秒後に false にする(継続してイベントが発火すれば再び true になる)
const on_user_scrolling = () => {
is_user_scrolling = true;
window.setTimeout(() => is_user_scrolling = false, 100);
}
};
// 現在コメントリストがドラッグされているかどうか
let is_dragging = false;
Expand Down Expand Up @@ -205,7 +205,7 @@ export default Vue.extend({
this.is_manual_scroll = false; // 手動スクロールを無効化
}
}
}
};
},
// 終了前に実行
beforeDestroy() {
Expand All @@ -224,7 +224,7 @@ export default Vue.extend({
displayCommentListDropdown(event: Event, comment: ICommentData) {
const comment_list_wrapper_rect = (this.$refs.comment_list_wrapper as HTMLDivElement).getBoundingClientRect();
const comment_list_dropdown_height = 76; // 76px はドロップダウンメニューの高さ
const comment_button_rect = (event.currentTarget as HTMLElement).getBoundingClientRect()
const comment_button_rect = (event.currentTarget as HTMLElement).getBoundingClientRect();
// メニューの表示位置をクリックされたコメントに合わせる
this.comment_list_dropdown_top = comment_button_rect.top - comment_list_wrapper_rect.top;
// メニューがコメントリストからはみ出るときだけ、表示位置を上側に調整
Expand Down Expand Up @@ -312,7 +312,7 @@ export default Vue.extend({
const gcd = (x: number, y: number) => { // 最大公約数を求める関数
if (y === 0) return x;
return gcd(y, x % y);
}
};
// 幅と高さの最大公約数を求める
const gcd_result = gcd(comment_area_width, comment_area_height);
// 幅と高さをそれぞれ最大公約数で割ってアスペクト比を算出
Expand Down Expand Up @@ -346,7 +346,7 @@ export default Vue.extend({
comment_area_element.style.removeProperty('--comment-area-aspect-ratio');
comment_area_element.style.removeProperty('--comment-area-vertical-margin');
}
}
};
// 要素の監視を開始
this.resize_observer = new ResizeObserver(on_resize);
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Panel/Program.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default Vue.extend({
Utils: Utils,
ChannelUtils: ChannelUtils,
ProgramUtils: ProgramUtils,
}
};
},
computed: {
// ChannelsStore に this.channelsStore でアクセスできるようにする
Expand Down
6 changes: 3 additions & 3 deletions client/src/components/Panel/Twitter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ export default Vue.extend({
// 文字数カウント
tweet_letter_count: 140,
}
};
},
computed: {
// ChannelsStore / SettingsStore / UserStore に this.channelsStore / this.settingsStore / this.userStore でアクセスできるようにする
Expand Down Expand Up @@ -467,9 +467,9 @@ export default Vue.extend({
image_bitmap.close();
// 描画設定
context.font = `bold 22px 'YakuHanJPs', 'Open Sans', 'Hiragino Sans', 'Noto Sans JP', sans-serif`; // フォント
context.font = 'bold 22px "YakuHanJPs", "Open Sans", "Hiragino Sans", "Noto Sans JP", sans-serif'; // フォント
context.fillStyle = 'rgba(255, 255, 255, 70%)'; // 半透明の白
context.shadowColor = 'rgba(0, 0, 0, 100%)' // 影の色
context.shadowColor = 'rgba(0, 0, 0, 100%)'; // 影の色
context.shadowBlur = 4; // 影をぼかすしきい値
context.shadowOffsetX = 0; // 影のX座標
context.shadowOffsetY = 0; // 影のY座標
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Settings/CommentMuteSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export default Vue.extend({
{text: '完全一致', value: 'exact'},
{text: '正規表現', value: 'regex'},
],
}
};
},
computed: {
// SettingsStore に this.settingsStore でアクセスできるようにする
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/VTabs.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

import { VueConstructor, VNode } from 'vue';

import { convertToUnit } from 'vuetify/lib/util/helpers'
import { convertToUnit } from 'vuetify/lib/util/helpers';
import VTabs from 'vuetify/lib/components/VTabs/VTabs';
import VTabsBar from '@/components/VTabsBar';

Expand Down
2 changes: 1 addition & 1 deletion client/src/components/VTabsBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default (VTabsBar as VueConstructor).extend({
return {
// 一応型定義をしておく
items: [] as GroupableInstance[],
}
};
},
methods: {

Expand Down
2 changes: 1 addition & 1 deletion client/src/components/VTabsItems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default (VTabsItems as VueConstructor).extend({
return {
// 一応型定義をしておく
items: [] as GroupableInstance[],
}
};
},
methods: {

Expand Down
10 changes: 5 additions & 5 deletions client/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ Vue.use(VuetifyMessageSnackbar, {
// 2.5秒でタイムアウト
timeout: 2500,
// 要素が非表示になった後に DOM から要素を削除する
autoRemove: true,
autoRemove: true,
// 閉じるボタンのテキスト
closeButtonContent: '閉じる',
// Vuetify のインスタンス
vuetifyInstance: vuetify,
closeButtonContent: '閉じる',
// Vuetify のインスタンス
vuetifyInstance: vuetify,
});

// VTooltip を使う
Expand Down Expand Up @@ -109,7 +109,7 @@ store.$subscribe(async () => {
}

// 設定データを LocalStorage に保存
console.log('Client Settings Changed:', store.settings)
console.log('Client Settings Changed:', store.settings);
setLocalStorageSettings(store.settings);

// 設定データをサーバーに同期する (ログイン時かつ同期が有効な場合のみ)
Expand Down
2 changes: 1 addition & 1 deletion client/src/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ export default {
// @ts-ignore
return window.KonomiTVVueInstance.$message.show(message);
}
}
};
2 changes: 1 addition & 1 deletion client/src/plugins/vuetify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default new Vuetify({
}
},
options: {
customProperties: true,
customProperties: true,
},
},
});
14 changes: 7 additions & 7 deletions client/src/service-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,25 @@ if (process.env.NODE_ENV === 'production') {
console.log(
'App is being served from cache by a service worker.\n' +
'For more details, visit https://goo.gl/AFskqB'
)
);
},
registered() {
console.log('Service worker has been registered.')
console.log('Service worker has been registered.');
},
cached() {
console.log('Content has been cached for offline use.')
console.log('Content has been cached for offline use.');
},
updatefound() {
console.log('New content is downloading.')
console.log('New content is downloading.');
},
updated() {
console.log('New content is available; please refresh.')
console.log('New content is available; please refresh.');
},
offline() {
console.log('No internet connection found. App is running in offline mode.')
console.log('No internet connection found. App is running in offline mode.');
},
error(error) {
console.error('Error during service worker registration:', error)
console.error('Error during service worker registration:', error);
}
});
}
6 changes: 3 additions & 3 deletions client/src/services/APIClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ export type SuccessResponse<T> = {
data: T;
error: null;
is_success: true;
}
};

/** API リクエスト失敗時のレスポンスを表すインターフェイス */
export type ErrorResponse<T extends Error = Error> = {
status: number;
data: null;
error: T;
is_error: true;
}
};


/**
Expand Down Expand Up @@ -60,7 +60,7 @@ class APIClient {
data: null,
error: new Error(result.response.data.detail),
is_error: true,
}
};

// エラーレスポンスがない場合は、AxiosError をそのまま返す
} else {
Expand Down
2 changes: 1 addition & 1 deletion client/src/services/Channels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const IChannelDefault: IChannel = {
viewers: 0,
program_present: IProgramDefault,
program_following: IProgramDefault,
}
};

/** ニコニコ実況のセッション情報を表すインターフェイス */
export interface IJikkyoSession {
Expand Down
2 changes: 1 addition & 1 deletion client/src/services/Programs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ export const IProgramDefault: IProgram = {
secondary_audio_type: null,
secondary_audio_language: null,
secondary_audio_sampling_rate: null,
}
};

// TODO: 番組情報 API が開発されたらここに API 定義を書く
2 changes: 1 addition & 1 deletion client/src/services/Twitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class Niconico {
return {message: response.data.detail, is_error: false};
} else {
// ツイート失敗
return {message: `エラー: ${response.data.detail}`, is_error: true}
return {message: `エラー: ${response.data.detail}`, is_error: true};
}
}
}
Expand Down
18 changes: 9 additions & 9 deletions client/src/services/Users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,22 @@ export interface ITwitterAccount {

/** ユーザーアカウントのアクセストークンを表すインターフェイス */
export interface IUserAccessToken {
access_token: string;
token_type: string;
access_token: string;
token_type: string;
}

export interface IUserCreateRequest {
username: string;
password: string;
username: string;
password: string;
}
export interface IUserUpdateRequest {
username?: string;
password?: string;
username?: string;
password?: string;
}
export interface IUserUpdateRequestForAdmin {
username?: string;
password?: string;
is_admin?: boolean;
username?: string;
password?: string;
is_admin?: boolean;
}


Expand Down
7 changes: 3 additions & 4 deletions client/src/services/player/CaptureHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ class CaptureHandler {
}

return blob;
}
};

// ***** 映像のキャプチャ *****

Expand Down Expand Up @@ -256,7 +256,6 @@ class CaptureHandler {
}

// ***** 通常実行 (Canvas にキャプチャ以外のデータを重ねて描画する必要があるケース) *****

} else {

const promises: Promise<void>[] = [];
Expand Down Expand Up @@ -509,7 +508,7 @@ class CaptureHandler {
// スクロール中のコメントの表示座標を計算
const position = comment.getBoundingClientRect().left - this.player.video.getBoundingClientRect().left;
comments_html = comments_html.replace(/transform: translateX\(.*?\);/, `left: ${position}px;`)
.replaceAll('border: 2px solid #E64F97;', '');
.replaceAll('border: 2px solid #E64F97;', '');
}

// HTML を画像として取得
Expand Down Expand Up @@ -599,7 +598,7 @@ class CaptureHandler {
caption_text: caption_text, // 字幕のテキスト (キャプチャした瞬間に字幕が表示されていなかったときは null)
is_caption_composited: is_caption_composited, // 字幕が合成されているか
is_comment_composited: is_comment_composited, // コメントが合成されているか
}
};

// 保存する EXIF メタデータを構築
// ref: 「カメラアプリで体感するWeb App」4.2
Expand Down
4 changes: 2 additions & 2 deletions client/src/store/ChannelsStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ const useChannelsStore = defineStore('channels', {
channel_id: 'gr999',
title: 'チャンネル情報取得エラー',
description: 'このチャンネル ID のチャンネル情報は存在しません。',
}
};
const IChannelError = {
...IChannelDefault,
channel_id: 'gr999', // チャンネル情報が存在しないことを示す特殊なチャンネル ID
channel_name: 'ERROR',
program_present: IProgramError,
program_following: IProgramError,
}
};
return {
previous: IChannelError,
current: IChannelError,
Expand Down
2 changes: 1 addition & 1 deletion client/src/store/UserStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const useUserStore = defineStore('user', {

// 作成したアカウントでログイン
await this.login(username, password, true);
console.log('Register successful.')
console.log('Register successful.');
Message.success('アカウントを作成しました。');
return true;
},
Expand Down

0 comments on commit 2ddd822

Please sign in to comment.