From 08c7b91b402bd40eaf451affe93dc97c3753e3f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFs=20Poujade?= <lois.poujade@tetras-libre.fr> Date: Wed, 21 Dec 2022 10:24:35 +0100 Subject: [PATCH] Ran linter + fix mismatching type --- src/AnnotationCreation.js | 18 ++++++++++++------ src/HMSInput.js | 1 + 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/AnnotationCreation.js b/src/AnnotationCreation.js index e7ecb7f..bfad765 100644 --- a/src/AnnotationCreation.js +++ b/src/AnnotationCreation.js @@ -38,9 +38,9 @@ function timeFromAnnoTarget(annotarget) { // TODO w3c media fragments: t=,10 t=5, const r = /t=([0-9.]+),([0-9.]+)/.exec(annotarget); if (!r || r.length !== 3) { - return ['', '']; + return [0, 0]; } - return [r[1], r[2]]; + return [Number(r[1]), Number(r[2])]; } /** Extract xywh from annotation target */ @@ -160,10 +160,16 @@ class AnnotationCreation extends Component { } /** set annotation start time to current time */ - setTstartNow() { this.setState({ tstart: Math.floor(this.props.currentTime) }); } + setTstartNow() { + // eslint-disable-next-line react/destructuring-assignment + this.setState({ tstart: Math.floor(this.props.currentTime) }); + } /** set annotation end time to current time */ - setTendNow() { this.setState({ tend: Math.floor(this.props.currentTime) }); } + setTendNow() { + // eslint-disable-next-line react/destructuring-assignment + this.setState({ tend: Math.floor(this.props.currentTime) }); + } /** update annotation start time */ updateTstart(value) { this.setState({ tstart: value }); } @@ -263,9 +269,9 @@ class AnnotationCreation extends Component { this.setState({ annoBody: '', svg: null, - tend: '', + tend: 0, textEditorStateBustingKey: textEditorStateBustingKey + 1, - tstart: '', + tstart: 0, xywh: null, }); } diff --git a/src/HMSInput.js b/src/HMSInput.js index 57f7f12..2005ba1 100644 --- a/src/HMSInput.js +++ b/src/HMSInput.js @@ -103,6 +103,7 @@ const styles = (theme) => ({ }); HMSInput.propTypes = { + // eslint-disable-next-line react/forbid-prop-types classes: PropTypes.object.isRequired, onChange: PropTypes.func.isRequired, seconds: PropTypes.number.isRequired, -- GitLab