From bc17cba83587f2b4015f0df25925817abef5c082 Mon Sep 17 00:00:00 2001 From: silverwind Date: Fri, 22 Jul 2022 03:10:22 +0200 Subject: Add eslint-plugin-sonarjs (#20431) We had this plugin before but it was removed as it became outdated, now it was updated again, so it's compatible again. Co-authored-by: wxiaoguang Co-authored-by: 6543 <6543@obermui.de> --- web_src/js/features/stopwatch.js | 6 +++--- web_src/js/utils.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'web_src') diff --git a/web_src/js/features/stopwatch.js b/web_src/js/features/stopwatch.js index c47ba22124..d63da4155a 100644 --- a/web_src/js/features/stopwatch.js +++ b/web_src/js/features/stopwatch.js @@ -140,7 +140,7 @@ function updateStopwatchData(data) { $('.stopwatch-cancel').attr('action', `${issueUrl}/times/stopwatch/cancel`); $('.stopwatch-issue').text(`${repo_owner_name}/${repo_name}#${issue_index}`); $('.stopwatch-time').text(prettyMilliseconds(seconds * 1000)); - updateStopwatchTime(seconds); + updateTimeInterval = updateStopwatchTime(seconds); btnEl.removeClass('hidden'); } @@ -149,10 +149,10 @@ function updateStopwatchData(data) { function updateStopwatchTime(seconds) { const secs = parseInt(seconds); - if (!Number.isFinite(secs)) return; + if (!Number.isFinite(secs)) return null; const start = Date.now(); - updateTimeInterval = setInterval(() => { + return setInterval(() => { const delta = Date.now() - start; const dur = prettyMilliseconds(secs * 1000 + delta, {compact: true}); $('.stopwatch-time').text(dur); diff --git a/web_src/js/utils.js b/web_src/js/utils.js index f01f2d3b22..e9cd39032d 100644 --- a/web_src/js/utils.js +++ b/web_src/js/utils.js @@ -64,7 +64,7 @@ export function parseIssueHref(href) { export function strSubMatch(full, sub) { const res = ['']; let i = 0, j = 0; - for (; i < sub.length && j < full.length;) { + while (i < sub.length && j < full.length) { while (j < full.length) { if (sub[i] === full[j]) { if (res.length % 2 !== 0) res.push(''); -- cgit v1.2.3