diff options
author | silverwind <me@silverwind.io> | 2022-07-22 03:10:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-22 09:10:22 +0800 |
commit | bc17cba83587f2b4015f0df25925817abef5c082 (patch) | |
tree | 31ea16d21d92793b9f71e9dd553b43f0ec6326e7 /web_src | |
parent | 3df33799c1b8775b4110ed11171a37f6c5ef4ae2 (diff) | |
download | gitea-bc17cba83587f2b4015f0df25925817abef5c082.tar.gz gitea-bc17cba83587f2b4015f0df25925817abef5c082.zip |
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 <wxiaoguang@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
Diffstat (limited to 'web_src')
-rw-r--r-- | web_src/js/features/stopwatch.js | 6 | ||||
-rw-r--r-- | web_src/js/utils.js | 2 |
2 files changed, 4 insertions, 4 deletions
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(''); |