diff --git a/.eslintrc.yml b/.eslintrc.yml index 66788098..ffcbf8ce 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -203,7 +203,7 @@ rules: prefer-const: [1, {destructuring: all, ignoreReadBeforeAssign: true}] quote-props: [0] quotes: [1, single, avoid-escape] - radix: [2, as-needed] + radix: [2, always] require-jsdoc: [0] require-yield: [2] semi-spacing: [2, {before: false, after: true}] diff --git a/edit/global-search.js b/edit/global-search.js index fac31d07..d66f4463 100644 --- a/edit/global-search.js +++ b/edit/global-search.js @@ -678,7 +678,7 @@ el.style.width = newWidth + 'px'; } const numLines = el.value.split('\n').length; - if (numLines !== parseInt(el.rows)) { + if (numLines !== Number(el.rows)) { el.rows = numLines; } el.style.overflowX = el.scrollWidth > el.clientWidth ? '' : 'hidden'; diff --git a/js/cmpver.js b/js/cmpver.js index 170e2f6f..5ff46ba2 100644 --- a/js/cmpver.js +++ b/js/cmpver.js @@ -2,7 +2,7 @@ /** Copied from https://github.com/violentmonkey/violentmonkey/blob/master/src/common/util.js - A couple of trivial changes: switched to Math.sign, removed the default radix from parseInt + and switched to Math.sign */ /* exported compareVersion */ @@ -35,7 +35,7 @@ function compareVersionChunk(ver1, ver2, isSemverMode) { ? a - b : a > b || a < b && -1; } else { - delta = (parseInt(a) || 0) - (parseInt(b) || 0); + delta = (parseInt(a, 10) || 0) - (parseInt(b, 10) || 0); } } return delta || isSemverMode && (len1 - len2); diff --git a/js/toolbox.js b/js/toolbox.js index 8307aea8..57d1ad9a 100644 --- a/js/toolbox.js +++ b/js/toolbox.js @@ -21,7 +21,7 @@ waitForTabUrl */ -const CHROME = Boolean(chrome.app) && parseInt(navigator.userAgent.match(/Chrom\w+\/(\d+)|$/)[1]); +const CHROME = Boolean(chrome.app) && Number(navigator.userAgent.match(/Chrom\w+\/(\d+)|$/)[1]); const OPERA = Boolean(chrome.app) && parseFloat(navigator.userAgent.match(/\bOPR\/(\d+\.\d+)|$/)[1]); const VIVALDI = Boolean(chrome.app) && navigator.userAgent.includes('Vivaldi'); let FIREFOX = !chrome.app && parseFloat(navigator.userAgent.match(/\bFirefox\/(\d+\.\d+)|$/)[1]); @@ -81,7 +81,7 @@ const URLS = { extractUsoArchiveId: url => url && url.startsWith(URLS.usoArchiveRaw) && - parseInt(url.match(/\/(\d+)\.user\.css|$/)[1]), + Number(url.match(/\/(\d+)\.user\.css|$/)[1]), extractUsoArchiveInstallUrl: url => { const id = URLS.extractUsoArchiveId(url); return id ? `${URLS.usoArchive}?style=${id}` : ''; diff --git a/popup/search.js b/popup/search.js index 820084f5..cac23f0d 100644 --- a/popup/search.js +++ b/popup/search.js @@ -517,7 +517,7 @@ } function calcUsoId({md5Url: m, updateUrl}) { - return parseInt(m && m.match(/\d+|$/)[0]) || + return Number(m && m.match(/\d+|$/)[0]) || URLS.extractUsoArchiveId(updateUrl); }