From d8b07e790f20bb53e6059e2d74e16d01f326df94 Mon Sep 17 00:00:00 2001 From: Sunil Pai Date: Fri, 9 Aug 2024 11:35:27 +0100 Subject: [PATCH] more eslint rules and fixes. lots more. --- .eslintignore | 16 + .eslintrc.cjs | 20 +- app/components/AudioGlow.tsx | 4 +- app/components/AudioIndicator.tsx | 4 +- app/components/AudioInputSelector.tsx | 1 + app/components/AudioStream.tsx | 11 +- app/components/Button.tsx | 3 +- app/components/CopyButton.tsx | 12 +- app/components/EnsurePermissions.tsx | 4 +- app/components/HoverFade.tsx | 2 +- app/components/Icon/Icon.tsx | 2 +- .../Icon/custom/MicrophoneSlashIcon.tsx | 2 +- app/components/Input.tsx | 2 +- app/components/Participant.tsx | 2 +- app/components/ReportBugDialog.tsx | 2 +- app/components/TextArea.tsx | 2 +- app/components/VideoInputSelector.tsx | 8 +- app/components/VideoSrcObject.tsx | 3 +- app/durableObjects/ChatRoom.server.ts | 21 +- app/entry.server.tsx | 2 +- app/hooks/useBroadcastStatus.ts | 1 + app/hooks/useConditionForAtLeast.ts | 2 +- app/hooks/useDeadPulledTrackMonitor.tsx | 5 +- app/hooks/useIsSpeaking.tsx | 2 +- app/hooks/useRoom.ts | 2 +- app/hooks/useUserMetadata.ts | 4 +- app/root.test.ts | 8 +- app/routes/[site.webmanifest].tsx | 1 + app/routes/_room.tsx | 4 +- app/routes/api.bugReport.tsx | 2 +- app/routes/demo.rxjs.tsx | 1 + app/routes/new.tsx | 1 + app/routes/set-username.tsx | 1 + app/types/Env.ts | 1 + app/utils/Peer.client.ts | 18 +- app/utils/Peer.test.ts | 18 +- app/utils/Peer.utils.ts | 8 +- app/utils/blurVideoTrack.ts | 5 +- app/utils/calculateLayout.ts | 2 +- app/utils/constants.ts | 7 +- app/utils/debounce.ts | 12 - app/utils/ewma.ts | 2 + app/utils/getIceServers.server.ts | 9 +- app/utils/getUsername.server.ts | 2 +- app/utils/keyInObject.ts | 6 - app/utils/metaKey.ts | 4 + app/utils/monitorAudioLevel.ts | 4 +- app/utils/noiseSuppression.ts | 4 +- app/utils/rxjs/RxjsPeer.client.ts | 42 +- app/utils/rxjs/getScreenshare$.ts | 4 +- app/utils/rxjs/getUserMediaTrack$.ts | 2 + app/utils/rxjs/trackIsHealthy.ts | 1 + package-lock.json | 3559 ++++++++--------- package.json | 11 +- server.ts | 17 +- 55 files changed, 1905 insertions(+), 1990 deletions(-) create mode 100644 .eslintignore delete mode 100644 app/utils/debounce.ts delete mode 100644 app/utils/keyInObject.ts diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 00000000..0b9eacfa --- /dev/null +++ b/.eslintignore @@ -0,0 +1,16 @@ +node_modules +.DS_STORE +.wrangler + +/.cache +/build +/dist +/public/build +/.mf +.env +.dev.vars +.sentryclirc +public/mockServiceWorker.js + +tailwind.config.js +remix.config.js \ No newline at end of file diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 6029ba11..253c6ce4 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -1,8 +1,25 @@ /** @type {import('eslint').Linter.Config} */ module.exports = { - extends: ['@remix-run/eslint-config', '@remix-run/eslint-config/node'], + reportUnusedDisableDirectives: true, + parser: '@typescript-eslint/parser', + parserOptions: { + ecmaVersion: 2020, + EXPERIMENTAL_useProjectService: true, + sourceType: 'module', + }, + plugins: ['@typescript-eslint'], + extends: [ + 'eslint:recommended', + 'plugin:@typescript-eslint/recommended', + 'plugin:@typescript-eslint/recommended-requiring-type-checking', + 'plugin:react/jsx-runtime', + 'plugin:react-hooks/recommended', + 'plugin:jsx-a11y/recommended', + 'plugin:deprecation/recommended', + ], ignorePatterns: ['/public/noise/*'], rules: { + 'no-mixed-spaces-and-tabs': ['error', 'smart-tabs'], '@typescript-eslint/no-extra-semi': ['off'], '@typescript-eslint/no-unused-vars': [ 'warn', @@ -14,4 +31,5 @@ module.exports = { }, ], }, + root: true, } diff --git a/app/components/AudioGlow.tsx b/app/components/AudioGlow.tsx index 03079fa5..5d65469e 100644 --- a/app/components/AudioGlow.tsx +++ b/app/components/AudioGlow.tsx @@ -23,7 +23,9 @@ export const AudioGlow: FC = ({ 'opacity-[--opacity] transition-opacity', className )} - style={{ '--opacity': Math.min(1, audioLevel * 4) } as any} + style={ + { '--opacity': Math.min(1, audioLevel * 4) } as React.CSSProperties + } aria-hidden > {children} diff --git a/app/components/AudioIndicator.tsx b/app/components/AudioIndicator.tsx index 2ca6191e..62c6a14e 100644 --- a/app/components/AudioIndicator.tsx +++ b/app/components/AudioIndicator.tsx @@ -17,7 +17,7 @@ export const AudioIndicator: FC = ({ audioTrack }) => { style={ { '--scale': Math.max(minSize, audioLevel + scaleModifier), - } as any + } as React.CSSProperties } >
= ({ audioTrack }) => { style={ { '--scale': Math.max(minSize, audioLevel + scaleModifier), - } as any + } as React.CSSProperties } >
diff --git a/app/components/AudioInputSelector.tsx b/app/components/AudioInputSelector.tsx index 627d85c7..33442046 100644 --- a/app/components/AudioInputSelector.tsx +++ b/app/components/AudioInputSelector.tsx @@ -29,6 +29,7 @@ export const AudioInputSelector: FC<{ id?: string }> = ({ id }) => { return (
+ {/* eslint-disable-next-line @typescript-eslint/no-misused-promises */} = ({ onOpenChange }) => { ) } -const ReportBugForm: FC<{}> = () => { +const ReportBugForm: FC = () => { const { Form, data, state } = useFetcher() const { room, roomHistory } = useRoomContext() const { roomName } = useParams() diff --git a/app/components/TextArea.tsx b/app/components/TextArea.tsx index 3ad5a2b7..3e32cd5f 100644 --- a/app/components/TextArea.tsx +++ b/app/components/TextArea.tsx @@ -3,7 +3,7 @@ import { cn } from '~/utils/style' export const TextArea = forwardRef< HTMLTextAreaElement, - JSX.IntrinsicElements['textarea'] + React.JSX.IntrinsicElements['textarea'] >(({ className, ...rest }, ref) => (