From d2d4220aedcb507adb00fcd546e49a462aeeebe9 Mon Sep 17 00:00:00 2001 From: Dave Nicolson Date: Tue, 22 Nov 2022 16:19:00 +0100 Subject: [PATCH 1/4] Remove unused dependencies --- src/index.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/index.js b/src/index.js index 6cb1c26..a3c00d0 100644 --- a/src/index.js +++ b/src/index.js @@ -31,13 +31,10 @@ import first from 'lodash/first' import last from 'lodash/last' import omit from 'lodash/omit' import maxBy from 'lodash/maxBy' -import isEmpty from 'lodash/isEmpty' import orderBy from 'lodash/orderBy' import uniqueId from 'lodash/uniqueId' import takeRight from 'lodash/takeRight' -import assign from 'lodash/assign' import { exec } from 'child_process' -import fs from 'fs' import appRoot from 'app-root-path' import os from 'os' From 2c7ea66a183d9c2e76d26e3a4507cedd11d4da7c Mon Sep 17 00:00:00 2001 From: Dave Nicolson Date: Tue, 22 Nov 2022 16:19:17 +0100 Subject: [PATCH 2/4] Remove unused variable --- src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index a3c00d0..98135fd 100644 --- a/src/index.js +++ b/src/index.js @@ -123,7 +123,7 @@ class ClapDetector { listen() { try { - const { MAX_HISTORY_LENGTH, AUDIO_SOURCE, DETECTION_PERCENTAGE_START, DETECTION_PERCENTAGE_END } = this.config + const { AUDIO_SOURCE, DETECTION_PERCENTAGE_START, DETECTION_PERCENTAGE_END } = this.config const filename = appRoot + '/input.wav' // Listen for sound const cmd = 'sox -t ' + AUDIO_SOURCE + ' ' + filename + ' silence 1 0.0001 ' + DETECTION_PERCENTAGE_START + ' 1 0.1 ' + DETECTION_PERCENTAGE_END + ' −−no−show−progress stat' From 84185def00d0ef6fa88414c579e77e9535130837 Mon Sep 17 00:00:00 2001 From: Dave Nicolson Date: Tue, 22 Nov 2022 16:19:26 +0100 Subject: [PATCH 3/4] Remove unreachable code --- src/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/index.js b/src/index.js index 98135fd..4fe1cfd 100644 --- a/src/index.js +++ b/src/index.js @@ -132,7 +132,6 @@ class ClapDetector { this.child = exec(cmd, (err) => { if (err) { throw err - return } }) From f9f5b1fdda456059af07bd53a5a0f61331f7f212 Mon Sep 17 00:00:00 2001 From: Dave Nicolson Date: Tue, 22 Nov 2022 16:53:39 +0100 Subject: [PATCH 4/4] Fix no-cond-assign linter error --- src/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 4fe1cfd..80c0d9d 100644 --- a/src/index.js +++ b/src/index.js @@ -57,7 +57,9 @@ const parseOutput = body => { const split = new RegExp("^(.*):\\s*(.*)$", "mg") let match = '' let dict = {} //simple key:value - while(match = split.exec(body)) dict[match[1]] = parseFloat(match[2]) + while((match = split.exec(body)) !== null) { + dict[match[1]] = parseFloat(match[2]) + } return dict }