fixed linting errors

This commit is contained in:
Jon 2021-09-29 14:02:47 +01:00
parent 45ab2a0710
commit e657091a26
7 changed files with 50 additions and 107 deletions

View File

@ -1,42 +1,39 @@
import React, { useRef, useEffect } from 'react';
import PropTypes from 'prop-types';
const AudioTrack = React.memo(
({ track }) => {
const audioRef = useRef(null);
const AudioTrack = ({ track }) => {
const audioRef = useRef(null);
useEffect(() => {
if (!audioRef.current) return false;
let playTimeout;
useEffect(() => {
if (!audioRef.current) return false;
let playTimeout;
const handleCanPlay = () => {
playTimeout = setTimeout(() => {
console.log('Unable to autoplay audio element');
}, 1500);
};
const handlePlay = () => {
clearTimeout(playTimeout);
};
audioRef.current.addEventListener('canplay', handleCanPlay);
audioRef.current.addEventListener('play', handlePlay);
audioRef.current.srcObject = new MediaStream([track]);
const handleCanPlay = () => {
playTimeout = setTimeout(() => {
console.log('Unable to autoplay audio element');
}, 1500);
};
const handlePlay = () => {
clearTimeout(playTimeout);
};
audioRef.current.addEventListener('canplay', handleCanPlay);
audioRef.current.addEventListener('play', handlePlay);
audioRef.current.srcObject = new MediaStream([track]);
const audioEl = audioRef.current;
const audioEl = audioRef.current;
return () => {
audioEl?.removeEventListener('canplay', handleCanPlay);
audioEl?.removeEventListener('play', handlePlay);
};
}, [track]);
return () => {
audioEl?.removeEventListener('canplay', handleCanPlay);
audioEl?.removeEventListener('play', handlePlay);
};
}, [track]);
return track ? (
<audio autoPlay playsInline ref={audioRef}>
<track kind="captions" />
</audio>
) : null;
},
() => true
);
return track ? (
<audio autoPlay playsInline ref={audioRef}>
<track kind="captions" />
</audio>
) : null;
};
AudioTrack.propTypes = {
track: PropTypes.object,

View File

@ -15,10 +15,12 @@ export const DeviceSelectModal = () => {
isOpen={currentModals[DEVICE_MODAL]}
onClose={() => closeModal(DEVICE_MODAL)}
actions={[
<Button fullWidth variant="outline">
<Button key="close" fullWidth variant="outline">
Cancel
</Button>,
<Button fullWidth>Update</Button>,
<Button key="update" fullWidth>
Update
</Button>,
]}
>
<DeviceSelect />

View File

@ -23,8 +23,8 @@ export const MuteButton = ({ isMuted, mic = false, className, ...props }) => {
};
const Icon = mic
? [<IconMicOff />, <IconMicOn />]
: [<IconCameraOff />, <IconCameraOn />];
? [<IconMicOff key="mic-off" />, <IconMicOn key="mic-on" />]
: [<IconCameraOff key="cam-off" />, <IconCameraOn key="cam-on" />];
if (!callObject) return null;

View File

@ -50,6 +50,8 @@ export const Video = memo(
(p, n) => shallowEqualObjects(p, n)
);
Video.displayName = 'Video';
Video.propTypes = {
videoTrack: PropTypes.any,
mirrored: PropTypes.bool,

View File

@ -23,10 +23,20 @@ export const WaitingRoomModal = ({ onClose }) => {
isOpen
onClose={() => onClose()}
actions={[
<Button fullWidth onClick={handleAllowAllClick} variant="success">
<Button
key="allow-all"
fullWidth
onClick={handleAllowAllClick}
variant="success"
>
Allow all
</Button>,
<Button fullWidth onClick={handleDenyAllClick} variant="warning">
<Button
key="deny-all"
fullWidth
onClick={handleDenyAllClick}
variant="warning"
>
Deny all
</Button>,
]}

View File

@ -15,13 +15,9 @@
"babel-eslint": "^10.1.0",
"babel-plugin-inline-react-svg": "^2.0.1",
"eslint": "^7.25.0",
"eslint-config-airbnb": "^18.2.1",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-react": "^7.23.2",
"eslint-plugin-react-hooks": "^4.2.0",
"eslint-plugin-import": "^2.22.1",
"eslint-config-next": "^11.0.1"
}
}

View File

@ -934,11 +934,6 @@ concat-map@0.0.1:
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=
confusing-browser-globals@^1.0.10:
version "1.0.10"
resolved "https://registry.yarnpkg.com/confusing-browser-globals/-/confusing-browser-globals-1.0.10.tgz#30d1e7f3d1b882b25ec4933d1d1adac353d20a59"
integrity sha512-gNld/3lySHwuhaVluJUKLePYirM3QNCKzVxqAdhJII9/WXKVX5PURzMVJspS1jTslSqjeuG4KMVTSouit5YPHA==
console-browserify@^1.1.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/console-browserify/-/console-browserify-1.2.0.tgz#67063cef57ceb6cf4993a2ab3a55840ae8c49336"
@ -1364,24 +1359,6 @@ escape-string-regexp@^1.0.5:
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=
eslint-config-airbnb-base@^14.2.1:
version "14.2.1"
resolved "https://registry.yarnpkg.com/eslint-config-airbnb-base/-/eslint-config-airbnb-base-14.2.1.tgz#8a2eb38455dc5a312550193b319cdaeef042cd1e"
integrity sha512-GOrQyDtVEc1Xy20U7vsB2yAoB4nBlfH5HZJeatRXHleO+OS5Ot+MWij4Dpltw4/DyIkqUfqz1epfhVR5XWWQPA==
dependencies:
confusing-browser-globals "^1.0.10"
object.assign "^4.1.2"
object.entries "^1.1.2"
eslint-config-airbnb@^18.2.1:
version "18.2.1"
resolved "https://registry.yarnpkg.com/eslint-config-airbnb/-/eslint-config-airbnb-18.2.1.tgz#b7fe2b42f9f8173e825b73c8014b592e449c98d9"
integrity sha512-glZNDEZ36VdlZWoxn/bUR1r/sdFKPd1mHPbqUtkctgNG4yT2DLLtJ3D+yCV+jzZCc2V1nBVkmdknOJBZ5Hc0fg==
dependencies:
eslint-config-airbnb-base "^14.2.1"
object.assign "^4.1.2"
object.entries "^1.1.2"
eslint-config-next@^11.0.1:
version "11.0.1"
resolved "https://registry.yarnpkg.com/eslint-config-next/-/eslint-config-next-11.0.1.tgz#abdd2565a6fa5841556a89ba935f044bec173d0b"
@ -1495,24 +1472,6 @@ eslint-plugin-react@^7.23.1:
resolve "^2.0.0-next.3"
string.prototype.matchall "^4.0.5"
eslint-plugin-react@^7.23.2:
version "7.23.2"
resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.23.2.tgz#2d2291b0f95c03728b55869f01102290e792d494"
integrity sha512-AfjgFQB+nYszudkxRkTFu0UR1zEQig0ArVMPloKhxwlwkzaw/fBiH0QWcBBhZONlXqQC51+nfqFrkn4EzHcGBw==
dependencies:
array-includes "^3.1.3"
array.prototype.flatmap "^1.2.4"
doctrine "^2.1.0"
has "^1.0.3"
jsx-ast-utils "^2.4.1 || ^3.0.0"
minimatch "^3.0.4"
object.entries "^1.1.3"
object.fromentries "^2.0.4"
object.values "^1.1.3"
prop-types "^15.7.2"
resolve "^2.0.0-next.3"
string.prototype.matchall "^4.0.4"
eslint-scope@^5.1.1:
version "5.1.1"
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c"
@ -2670,16 +2629,6 @@ object.assign@^4.1.2:
has-symbols "^1.0.1"
object-keys "^1.1.1"
object.entries@^1.1.2, object.entries@^1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/object.entries/-/object.entries-1.1.3.tgz#c601c7f168b62374541a07ddbd3e2d5e4f7711a6"
integrity sha512-ym7h7OZebNS96hn5IJeyUmaWhaSM4SVtAPPfNLQEI2MYWCO2egsITb9nab2+i/Pwibx+R0mtn+ltKJXRSeTMGg==
dependencies:
call-bind "^1.0.0"
define-properties "^1.1.3"
es-abstract "^1.18.0-next.1"
has "^1.0.3"
object.entries@^1.1.4:
version "1.1.4"
resolved "https://registry.yarnpkg.com/object.entries/-/object.entries-1.1.4.tgz#43ccf9a50bc5fd5b649d45ab1a579f24e088cafd"
@ -2699,7 +2648,7 @@ object.fromentries@^2.0.4:
es-abstract "^1.18.0-next.2"
has "^1.0.3"
object.values@^1.1.1, object.values@^1.1.3:
object.values@^1.1.1:
version "1.1.3"
resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.1.3.tgz#eaa8b1e17589f02f698db093f7c62ee1699742ee"
integrity sha512-nkF6PfDB9alkOUxpf1HNm/QlkeW3SReqL5WXeBLpEJJnlPSvRaDQpW3gQTksTN3fgJX4hL42RzKyOin6ff3tyw==
@ -3460,19 +3409,6 @@ string-width@^4.2.0:
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.0"
string.prototype.matchall@^4.0.4:
version "4.0.4"
resolved "https://registry.yarnpkg.com/string.prototype.matchall/-/string.prototype.matchall-4.0.4.tgz#608f255e93e072107f5de066f81a2dfb78cf6b29"
integrity sha512-pknFIWVachNcyqRfaQSeu/FUfpvJTe4uskUSZ9Wc1RijsPuzbZ8TyYT8WCNnntCjUEqQ3vUHMAfVj2+wLAisPQ==
dependencies:
call-bind "^1.0.2"
define-properties "^1.1.3"
es-abstract "^1.18.0-next.2"
has-symbols "^1.0.1"
internal-slot "^1.0.3"
regexp.prototype.flags "^1.3.1"
side-channel "^1.0.4"
string.prototype.matchall@^4.0.5:
version "4.0.5"
resolved "https://registry.yarnpkg.com/string.prototype.matchall/-/string.prototype.matchall-4.0.5.tgz#59370644e1db7e4c0c045277690cf7b01203c4da"