enforce eslint radix rule for parseInt
This commit is contained in:
parent
53c71614fc
commit
41533e863d
|
@ -203,7 +203,7 @@ rules:
|
||||||
prefer-const: [1, {destructuring: all, ignoreReadBeforeAssign: true}]
|
prefer-const: [1, {destructuring: all, ignoreReadBeforeAssign: true}]
|
||||||
quote-props: [0]
|
quote-props: [0]
|
||||||
quotes: [1, single, avoid-escape]
|
quotes: [1, single, avoid-escape]
|
||||||
radix: [2, as-needed]
|
radix: [2, always]
|
||||||
require-jsdoc: [0]
|
require-jsdoc: [0]
|
||||||
require-yield: [2]
|
require-yield: [2]
|
||||||
semi-spacing: [2, {before: false, after: true}]
|
semi-spacing: [2, {before: false, after: true}]
|
||||||
|
|
|
@ -678,7 +678,7 @@
|
||||||
el.style.width = newWidth + 'px';
|
el.style.width = newWidth + 'px';
|
||||||
}
|
}
|
||||||
const numLines = el.value.split('\n').length;
|
const numLines = el.value.split('\n').length;
|
||||||
if (numLines !== parseInt(el.rows)) {
|
if (numLines !== Number(el.rows)) {
|
||||||
el.rows = numLines;
|
el.rows = numLines;
|
||||||
}
|
}
|
||||||
el.style.overflowX = el.scrollWidth > el.clientWidth ? '' : 'hidden';
|
el.style.overflowX = el.scrollWidth > el.clientWidth ? '' : 'hidden';
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Copied from https://github.com/violentmonkey/violentmonkey/blob/master/src/common/util.js
|
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 */
|
/* exported compareVersion */
|
||||||
|
@ -35,7 +35,7 @@ function compareVersionChunk(ver1, ver2, isSemverMode) {
|
||||||
? a - b
|
? a - b
|
||||||
: a > b || a < b && -1;
|
: a > b || a < b && -1;
|
||||||
} else {
|
} else {
|
||||||
delta = (parseInt(a) || 0) - (parseInt(b) || 0);
|
delta = (parseInt(a, 10) || 0) - (parseInt(b, 10) || 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return delta || isSemverMode && (len1 - len2);
|
return delta || isSemverMode && (len1 - len2);
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
waitForTabUrl
|
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 OPERA = Boolean(chrome.app) && parseFloat(navigator.userAgent.match(/\bOPR\/(\d+\.\d+)|$/)[1]);
|
||||||
const VIVALDI = Boolean(chrome.app) && navigator.userAgent.includes('Vivaldi');
|
const VIVALDI = Boolean(chrome.app) && navigator.userAgent.includes('Vivaldi');
|
||||||
let FIREFOX = !chrome.app && parseFloat(navigator.userAgent.match(/\bFirefox\/(\d+\.\d+)|$/)[1]);
|
let FIREFOX = !chrome.app && parseFloat(navigator.userAgent.match(/\bFirefox\/(\d+\.\d+)|$/)[1]);
|
||||||
|
@ -81,7 +81,7 @@ const URLS = {
|
||||||
extractUsoArchiveId: url =>
|
extractUsoArchiveId: url =>
|
||||||
url &&
|
url &&
|
||||||
url.startsWith(URLS.usoArchiveRaw) &&
|
url.startsWith(URLS.usoArchiveRaw) &&
|
||||||
parseInt(url.match(/\/(\d+)\.user\.css|$/)[1]),
|
Number(url.match(/\/(\d+)\.user\.css|$/)[1]),
|
||||||
extractUsoArchiveInstallUrl: url => {
|
extractUsoArchiveInstallUrl: url => {
|
||||||
const id = URLS.extractUsoArchiveId(url);
|
const id = URLS.extractUsoArchiveId(url);
|
||||||
return id ? `${URLS.usoArchive}?style=${id}` : '';
|
return id ? `${URLS.usoArchive}?style=${id}` : '';
|
||||||
|
|
|
@ -517,7 +517,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function calcUsoId({md5Url: m, updateUrl}) {
|
function calcUsoId({md5Url: m, updateUrl}) {
|
||||||
return parseInt(m && m.match(/\d+|$/)[0]) ||
|
return Number(m && m.match(/\d+|$/)[0]) ||
|
||||||
URLS.extractUsoArchiveId(updateUrl);
|
URLS.extractUsoArchiveId(updateUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user