From 975478e86fbe4e9af907234cf63da80f14bdad76 Mon Sep 17 00:00:00 2001 From: a-wing <1@233.email> Date: Thu, 21 Nov 2024 13:13:45 +0800 Subject: [PATCH] update eslint rule --- eslint.config.js | 11 +++++++++++ webapp/components/device.tsx | 4 ++-- webapp/lib/device.ts | 6 +++--- webapp/store/atom.ts | 2 +- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index aebbc50..abd50b1 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -16,7 +16,18 @@ export default ts.config( '@stylistic/js': stylisticJs }, rules: { + '@stylistic/js/comma-spacing': ['warn', {'before': false, 'after': true}], '@stylistic/js/semi': ['warn', 'never'], + '@stylistic/js/space-in-parens': ['warn', 'never'], + '@stylistic/js/space-before-blocks': ['warn', { 'functions': 'always', 'keywords': 'always', 'classes': 'always' }], + '@stylistic/js/space-infix-ops': ['warn', { 'int32Hint': false }], + '@stylistic/js/space-unary-ops': ['warn'], + '@stylistic/js/switch-colon-spacing': ['warn'], + '@stylistic/js/no-multi-spaces': ['warn'], + '@stylistic/js/no-multiple-empty-lines': ['warn'], + '@stylistic/js/no-trailing-spaces': ['warn'], + '@stylistic/js/no-whitespace-before-property': ['warn'], + '@stylistic/js/new-parens': ['warn', 'always'], 'comma-dangle': ['warn', 'only-multiline'], '@stylistic/js/quotes': ['warn', 'single', { 'avoidEscape': true }], '@stylistic/js/indent': ['warn', 2, { 'SwitchCase': 1 }], diff --git a/webapp/components/device.tsx b/webapp/components/device.tsx index 7659fee..5e1ebc9 100644 --- a/webapp/components/device.tsx +++ b/webapp/components/device.tsx @@ -74,12 +74,12 @@ export default function DeviceBar(props: { streamId: string }) { try { await navigator.mediaDevices.getUserMedia({ audio: true }) } catch { /* empty */ } - + try { await navigator.mediaDevices.getUserMedia({ video: true }) } catch { /* empty */ } } - + const devices = (await navigator.mediaDevices.enumerateDevices()).filter(i => !!i.deviceId) const audios = devices.filter(i => i.kind === 'audioinput').map(toDevice) diff --git a/webapp/lib/device.ts b/webapp/lib/device.ts index 2904b37..9fccafa 100644 --- a/webapp/lib/device.ts +++ b/webapp/lib/device.ts @@ -14,7 +14,7 @@ const deviceScreen = { } async function asyncGetAudioStream(deviceId: string): Promise { - let stream: MediaStream = new MediaStream + let stream: MediaStream = new MediaStream() if (deviceId !== 'none') { stream = await navigator.mediaDevices.getUserMedia({ audio: { deviceId: deviceId }, video: false }) } @@ -22,9 +22,9 @@ async function asyncGetAudioStream(deviceId: string): Promise { } async function asyncGetVideoStream(deviceId: string): Promise { - let stream: MediaStream = new MediaStream + let stream: MediaStream = new MediaStream() if (deviceId === 'none') { - stream = new MediaStream + /* empty */ } else if (deviceId === 'screen') { stream = await navigator.mediaDevices.getDisplayMedia({ audio: false, video: { width: 640 } }) } else { diff --git a/webapp/store/atom.ts b/webapp/store/atom.ts index 7366e6e..e7f0238 100644 --- a/webapp/store/atom.ts +++ b/webapp/store/atom.ts @@ -27,7 +27,7 @@ const meetingJoinedAtom = atom(false) meetingJoinedAtom.debugLabel = 'meetingJoined' const presentationStreamAtom = atom({ - stream: new MediaStream, + stream: new MediaStream(), name: 'Presentation', }) presentationStreamAtom.debugLabel = 'presentationStream'