From 75d603577144109213dc0ae6da702f484e853305 Mon Sep 17 00:00:00 2001 From: voluntas Date: Tue, 28 Nov 2023 10:30:56 +0900 Subject: [PATCH] biome 1.4.0 --- biome.json | 2 +- package.json | 30 ++++++++++++------------ pnpm-lock.yaml | 44 +++++++++++++++++------------------ src/types.ts | 62 +++++++++++++++++++++++++------------------------- src/utils.ts | 21 +++++++++-------- 5 files changed, 80 insertions(+), 79 deletions(-) diff --git a/biome.json b/biome.json index 0c0e56cd..46a45834 100644 --- a/biome.json +++ b/biome.json @@ -1,5 +1,5 @@ { - "$schema": "https://biomejs.dev/schemas/1.3.3/schema.json", + "$schema": "https://biomejs.dev/schemas/1.4.0/schema.json", "organizeImports": { "enabled": true }, diff --git a/package.json b/package.json index 4565e884..91b4437e 100644 --- a/package.json +++ b/package.json @@ -25,21 +25,6 @@ "knip": "knip", "prepare": "husky install" }, - "devDependencies": { - "@biomejs/biome": "1.3.3", - "@types/node": "20.10.0", - "@types/react": "18.2.38", - "@types/react-redux": "7.1.31", - "@types/redux-logger": "3.0.12", - "@vitejs/plugin-react": "4.2.0", - "husky": "8.0.3", - "jsdom": "23.0.0", - "knip": "2.43.0", - "next": "14.0.3", - "rimraf": "5.0.5", - "typescript": "5.3.2", - "vitest": "0.34.6" - }, "dependencies": { "@reduxjs/toolkit": "1.9.7", "@shiguredo/light-adjustment": "2023.2.0", @@ -57,6 +42,21 @@ "redux-thunk": "2.4.2", "sora-js-sdk": "2023.2.0-canary.7" }, + "devDependencies": { + "@biomejs/biome": "1.4.0", + "@types/node": "20.10.0", + "@types/react": "18.2.38", + "@types/react-redux": "7.1.31", + "@types/redux-logger": "3.0.12", + "@vitejs/plugin-react": "4.2.0", + "husky": "8.0.3", + "jsdom": "23.0.0", + "knip": "2.43.0", + "next": "14.0.3", + "rimraf": "5.0.5", + "typescript": "5.3.2", + "vitest": "0.34.6" + }, "packageManager": "pnpm@8.11.0", "engines": { "node": ">=18.17.1" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 42f9a82d..c9e93f62 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -53,8 +53,8 @@ dependencies: devDependencies: '@biomejs/biome': - specifier: 1.3.3 - version: 1.3.3 + specifier: 1.4.0 + version: 1.4.0 '@types/node': specifier: 20.10.0 version: 20.10.0 @@ -324,22 +324,22 @@ packages: to-fast-properties: 2.0.0 dev: true - /@biomejs/biome@1.3.3: - resolution: {integrity: sha512-vTJn7RBzLWIabUuUIoEopO860YyBrbPEu4Pztfd28jRU5QD074hKZ9IQs24pFO6A2R296gaeYmN62f4u7pUruQ==} + /@biomejs/biome@1.4.0: + resolution: {integrity: sha512-/rDlao6ra38nhxo4IYCqWCzfTJcpMk4YHjSVBI9yN/ifdhnzSwirL25xDVH7G9hZdNhpF9g78FaPJhFa9DX0Cw==} engines: {node: '>=14.*'} hasBin: true requiresBuild: true optionalDependencies: - '@biomejs/cli-darwin-arm64': 1.3.3 - '@biomejs/cli-darwin-x64': 1.3.3 - '@biomejs/cli-linux-arm64': 1.3.3 - '@biomejs/cli-linux-x64': 1.3.3 - '@biomejs/cli-win32-arm64': 1.3.3 - '@biomejs/cli-win32-x64': 1.3.3 + '@biomejs/cli-darwin-arm64': 1.4.0 + '@biomejs/cli-darwin-x64': 1.4.0 + '@biomejs/cli-linux-arm64': 1.4.0 + '@biomejs/cli-linux-x64': 1.4.0 + '@biomejs/cli-win32-arm64': 1.4.0 + '@biomejs/cli-win32-x64': 1.4.0 dev: true - /@biomejs/cli-darwin-arm64@1.3.3: - resolution: {integrity: sha512-2X87ZfbmWwe4NGukrUvnoYdI//muSgjNUCAHJ2DO+kS1sB7kDy1s6PN/IYyTJuqRcJtDuOnSpaUDE7KxR1YhtA==} + /@biomejs/cli-darwin-arm64@1.4.0: + resolution: {integrity: sha512-nBrtVRwr4IlTtxLOHwBwLv1sWvggf9/DnT5/ALIANJZOpoING6u8jHWipods69wK8kGa8Ld7iwHm3W5BrJJFFQ==} engines: {node: '>=14.*'} cpu: [arm64] os: [darwin] @@ -347,8 +347,8 @@ packages: dev: true optional: true - /@biomejs/cli-darwin-x64@1.3.3: - resolution: {integrity: sha512-t+7DWTCbSgHOBcPsGKuwS1qh1z9zbXFK8i8ktE18yW7iF/W0zI62k44fYqYeFJKlb0Q08aqUvez3L+AQJFsn+w==} + /@biomejs/cli-darwin-x64@1.4.0: + resolution: {integrity: sha512-nny0VgOj3ksUGzU5GblgtQEvrAZFgFe1IJBoYOP978OQdDrg7BpS+GX5udfof87Dl4ZlHPRBU951ceHOxF7BTg==} engines: {node: '>=14.*'} cpu: [x64] os: [darwin] @@ -356,8 +356,8 @@ packages: dev: true optional: true - /@biomejs/cli-linux-arm64@1.3.3: - resolution: {integrity: sha512-D8CvXaB8lkXXBQ6B3n0MXSSZFiE60+aNHorBLimVTtKiMod8QvAP425oQFZFul5wMXZqPLGTKFjXbAi/rvnc1A==} + /@biomejs/cli-linux-arm64@1.4.0: + resolution: {integrity: sha512-gyLkT/Yh9xfW1T9yjQs/2txkCeG0e+LRs0adLugMwN0ptcNTRyusBvUoiHnpB+9rS6hWu9ZCedGMNmKQ8v2GSw==} engines: {node: '>=14.*'} cpu: [arm64] os: [linux] @@ -365,8 +365,8 @@ packages: dev: true optional: true - /@biomejs/cli-linux-x64@1.3.3: - resolution: {integrity: sha512-bqB05fwJnRZwRlcm/BS/s4qPickqiXZkiU/nOYvHApfsPeqgSHgv5HWoBYuSUjgqBbX3XZJArsC5dCcVW7vAJw==} + /@biomejs/cli-linux-x64@1.4.0: + resolution: {integrity: sha512-LIxTuU2zSbIHM9XDYjQphJ5UU8h2eS7yR8uIvGYSba7Qt9AKqfbenyVJTsVnoj1CXxxgKNVSc/wVmlOlGz5DBQ==} engines: {node: '>=14.*'} cpu: [x64] os: [linux] @@ -374,8 +374,8 @@ packages: dev: true optional: true - /@biomejs/cli-win32-arm64@1.3.3: - resolution: {integrity: sha512-muFOjAv1ONMfaJDlo4Ds+Qb9lkdSLM2XaxOe3AJPejSq3Vi0aRr51ZnE02BofMnL2sVsOA9cO54wibsuTcopbw==} + /@biomejs/cli-win32-arm64@1.4.0: + resolution: {integrity: sha512-U2jT1/0wZLJIRqnU8qHAfi/A/+yUwlL3sYJgqs+wO0BbR22WGQZlj03u5FdpEoyLXdsLv1pbeIcjNp+V0NYXWA==} engines: {node: '>=14.*'} cpu: [arm64] os: [win32] @@ -383,8 +383,8 @@ packages: dev: true optional: true - /@biomejs/cli-win32-x64@1.3.3: - resolution: {integrity: sha512-PMkMhS4smmmTMflxuZUx3REFSazEL9xsGscvZO1dKWI4ET23la+KxEM4TlSpjOyO66UerqSkuUlZecn0QhD63A==} + /@biomejs/cli-win32-x64@1.4.0: + resolution: {integrity: sha512-gN6DgyyBxIwoCovAUFJHFWVallb0cLosayDRtNyxU3MDv/atZxSXOWQezfVKBIbgmFPxYWJObd+awvbPYXwwww==} engines: {node: '>=14.*'} cpu: [x64] os: [win32] diff --git a/src/types.ts b/src/types.ts index a34a3576..7f0ab8e4 100644 --- a/src/types.ts +++ b/src/types.ts @@ -46,15 +46,15 @@ import { export type SoraDevtoolsState = { alertMessages: AlertMessage[] audio: boolean - audioBitRate: typeof AUDIO_BIT_RATES[number] - audioCodecType: typeof AUDIO_CODEC_TYPES[number] - audioContentHint: typeof AUDIO_CONTENT_HINTS[number] + audioBitRate: (typeof AUDIO_BIT_RATES)[number] + audioCodecType: (typeof AUDIO_CODEC_TYPES)[number] + audioContentHint: (typeof AUDIO_CONTENT_HINTS)[number] audioInput: string audioInputDevices: MediaDeviceInfo[] audioOutput: string audioOutputDevices: MediaDeviceInfo[] - autoGainControl: typeof AUTO_GAIN_CONTROLS[number] - blurRadius: typeof BLUR_RADIUS[number] + autoGainControl: (typeof AUTO_GAIN_CONTROLS)[number] + blurRadius: (typeof BLUR_RADIUS)[number] bundleId: string channelId: string clientId: string @@ -63,12 +63,12 @@ export type SoraDevtoolsState = { debug: boolean debugFilterText: string debugType: DebugType - dataChannelSignaling: typeof DATA_CHANNEL_SIGNALING[number] + dataChannelSignaling: (typeof DATA_CHANNEL_SIGNALING)[number] dataChannels: string dataChannelMessages: DataChannelMessage[] - displayResolution: typeof DISPLAY_RESOLUTIONS[number] - echoCancellation: typeof ECHO_CANCELLATIONS[number] - echoCancellationType: typeof ECHO_CANCELLATION_TYPES[number] + displayResolution: (typeof DISPLAY_RESOLUTIONS)[number] + echoCancellation: (typeof ECHO_CANCELLATIONS)[number] + echoCancellationType: (typeof ECHO_CANCELLATION_TYPES)[number] e2ee: boolean enabledBundleId: boolean enabledClientId: boolean @@ -83,16 +83,16 @@ export type SoraDevtoolsState = { enabledVideoAV1Params: boolean audioStreamingLanguageCode: string enabledAudioStreamingLanguageCode: boolean - audioLyraParamsBitrate: typeof AUDIO_LYRA_PARAMS_BITRATES[number] + audioLyraParamsBitrate: (typeof AUDIO_LYRA_PARAMS_BITRATES)[number] fakeContents: { worker: Worker | null colorCode: number gainNode: GainNode | null } fakeVolume: string - frameRate: typeof FRAME_RATES[number] + frameRate: (typeof FRAME_RATES)[number] soraContents: { - connectionStatus: typeof CONNECTION_STATUS[number] + connectionStatus: (typeof CONNECTION_STATUS)[number] reconnecting: boolean reconnectingTrials: number sora: ConnectionPublisher | ConnectionSubscriber | null @@ -104,35 +104,35 @@ export type SoraDevtoolsState = { statsReport: RTCStats[] datachannels: DataChannelConfiguration[] } - ignoreDisconnectWebSocket: typeof IGNORE_DISCONNECT_WEBSOCKET[number] + ignoreDisconnectWebSocket: (typeof IGNORE_DISCONNECT_WEBSOCKET)[number] logMessages: LogMessage[] mediaProcessorsNoiseSuppression: boolean - mediaType: typeof MEDIA_TYPES[number] + mediaType: (typeof MEDIA_TYPES)[number] metadata: string - multistream: typeof MULTISTREAM[number] + multistream: (typeof MULTISTREAM)[number] mute: boolean - noiseSuppression: typeof NOISE_SUPPRESSIONS[number] + noiseSuppression: (typeof NOISE_SUPPRESSIONS)[number] notifyMessages: NotifyMessage[] pushMessages: PushMessage[] - resolution: typeof RESOLUTIONS[number] + resolution: (typeof RESOLUTIONS)[number] showStats: boolean signalingMessages: SignalingMessage[] signalingNotifyMetadata: string signalingUrlCandidates: string[] forwardingFilter: string - simulcast: typeof SIMULCAST[number] - simulcastRid: typeof SIMULCAST_RID[number] - spotlight: typeof SPOTLIGHT[number] + simulcast: (typeof SIMULCAST)[number] + simulcastRid: (typeof SIMULCAST_RID)[number] + spotlight: (typeof SPOTLIGHT)[number] focusedSpotlightConnectionIds: { [key: string]: boolean } - spotlightNumber: typeof SPOTLIGHT_NUMBERS[number] - spotlightFocusRid: typeof SPOTLIGHT_FOCUS_RIDS[number] - spotlightUnfocusRid: typeof SPOTLIGHT_FOCUS_RIDS[number] + spotlightNumber: (typeof SPOTLIGHT_NUMBERS)[number] + spotlightFocusRid: (typeof SPOTLIGHT_FOCUS_RIDS)[number] + spotlightUnfocusRid: (typeof SPOTLIGHT_FOCUS_RIDS)[number] video: boolean - videoBitRate: typeof VIDEO_BIT_RATES[number] - videoCodecType: typeof VIDEO_CODEC_TYPES[number] - videoContentHint: typeof VIDEO_CONTENT_HINTS[number] + videoBitRate: (typeof VIDEO_BIT_RATES)[number] + videoCodecType: (typeof VIDEO_CODEC_TYPES)[number] + videoContentHint: (typeof VIDEO_CONTENT_HINTS)[number] videoInput: string videoInputDevices: MediaDeviceInfo[] videoVP9Params: string @@ -146,13 +146,13 @@ export type SoraDevtoolsState = { role: Role reconnect: boolean apiUrl: null | string - aspectRatio: typeof ASPECT_RATIO_TYPES[number] - resizeMode: typeof RESIZE_MODE_TYPES[number] - lightAdjustment: typeof LIGHT_ADJUSTMENT[number] + aspectRatio: (typeof ASPECT_RATIO_TYPES)[number] + resizeMode: (typeof RESIZE_MODE_TYPES)[number] + lightAdjustment: (typeof LIGHT_ADJUSTMENT)[number] lightAdjustmentProcessor: LightAdjustmentProcessor | null noiseSuppressionProcessor: NoiseSuppressionProcessor | null virtualBackgroundProcessor: VirtualBackgroundProcessor | null - facingMode: typeof FACING_MODES[number] + facingMode: (typeof FACING_MODES)[number] } // 画面表示する message の Type @@ -307,7 +307,7 @@ export type DataChannelMessage = { } // Debug 表示タブ選択状態用の Type -export type DebugType = typeof DEBUG_TYPES[number] +export type DebugType = (typeof DEBUG_TYPES)[number] // クエリ文字列から取得する parameter の Type export type QueryStringParameters = Omit< diff --git a/src/utils.ts b/src/utils.ts index 33e86eca..a063e3d3 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -71,7 +71,7 @@ export function copy2clipboard(text: string): Promise { export function checkFormValue( value: unknown, candidates: T, -): value is typeof candidates[number] { +): value is (typeof candidates)[number] { if (typeof value === 'string') { return candidates.indexOf(value) >= 0 } @@ -102,7 +102,7 @@ export function parseQueryString(): Partial { const parseSpecifiedStringParameter = ( parameter: string | (string | null)[] | null, candidates: T, - ): typeof candidates[number] | undefined => { + ): (typeof candidates)[number] | undefined => { if (checkFormValue(parameter, candidates)) { return parameter } @@ -263,7 +263,7 @@ export function getValueByAspectRatio(aspectRatio: string): number { } // devtools の blurRadius 文字列に対する数値を返す -export function getBlurRadiusNumber(blurRadius: typeof BLUR_RADIUS[number]): number { +export function getBlurRadiusNumber(blurRadius: (typeof BLUR_RADIUS)[number]): number { switch (blurRadius) { case 'weak': return 5 @@ -278,7 +278,7 @@ export function getBlurRadiusNumber(blurRadius: typeof BLUR_RADIUS[number]): num // devtools の lightAdjustment 文字列に対するオプションを返す export function getLightAdjustmentOptions( - lightAdjustment: typeof LIGHT_ADJUSTMENT[number], + lightAdjustment: (typeof LIGHT_ADJUSTMENT)[number], ): LightAdjustmentProcessorOptions { switch (lightAdjustment) { case 'weak': @@ -301,10 +301,10 @@ export function getLightAdjustmentOptions( // getUserMedia の audio constraints を生成 type CreateAudioConstraintsParameters = { audio: boolean - autoGainControl: typeof AUTO_GAIN_CONTROLS[number] - noiseSuppression: typeof NOISE_SUPPRESSIONS[number] - echoCancellation: typeof ECHO_CANCELLATIONS[number] - echoCancellationType: typeof ECHO_CANCELLATION_TYPES[number] + autoGainControl: (typeof AUTO_GAIN_CONTROLS)[number] + noiseSuppression: (typeof NOISE_SUPPRESSIONS)[number] + echoCancellation: (typeof ECHO_CANCELLATIONS)[number] + echoCancellationType: (typeof ECHO_CANCELLATION_TYPES)[number] audioInput: string } export function createAudioConstraints( @@ -558,7 +558,8 @@ export function drawFakeCanvas( export function parseBooleanString(value: string): boolean | undefined { if (value === 'true') { return true - } else if (value === 'false') { + } + if (value === 'false') { return false } return @@ -576,7 +577,7 @@ export function parseMetadata(enabledMetadata: boolean, metadata: string): Json return metadata } -export function getDefaultVideoCodecType(): typeof VIDEO_CODEC_TYPES[number] { +export function getDefaultVideoCodecType(): (typeof VIDEO_CODEC_TYPES)[number] { // getCapabilities API が存在しない場合 if (!window.RTCRtpSender || !RTCRtpSender.getCapabilities) { return 'VP9'