- Linting (ESLint): As per latest ash-nazg

This commit is contained in:
Brett Zamir
2020-03-27 20:39:51 +08:00
parent 1f1452f4fa
commit 7914f26e02
20 changed files with 113 additions and 101 deletions

View File

@@ -515,7 +515,7 @@ export default function jQueryPluginJGraduate ($) {
let inverted = '';
for (let i = 0; i < 6; i += 2) {
// const ch = color.substr(i, 2);
let inv = (255 - parseInt(color.substr(i, 2), 16)).toString(16);
let inv = (255 - Number.parseInt(color.substr(i, 2), 16)).toString(16);
if (inv.length < 2) inv = 0 + inv;
inverted += inv;
}
@@ -535,15 +535,15 @@ export default function jQueryPluginJGraduate ($) {
}
}
const x1 = parseFloat(grad.getAttribute('x1') || 0.0),
y1 = parseFloat(grad.getAttribute('y1') || 0.0),
x2 = parseFloat(grad.getAttribute('x2') || 1.0),
y2 = parseFloat(grad.getAttribute('y2') || 0.0);
const x1 = Number.parseFloat(grad.getAttribute('x1') || 0.0),
y1 = Number.parseFloat(grad.getAttribute('y1') || 0.0),
x2 = Number.parseFloat(grad.getAttribute('x2') || 1.0),
y2 = Number.parseFloat(grad.getAttribute('y2') || 0.0);
const cx = parseFloat(grad.getAttribute('cx') || 0.5),
cy = parseFloat(grad.getAttribute('cy') || 0.5),
fx = parseFloat(grad.getAttribute('fx') || cx),
fy = parseFloat(grad.getAttribute('fy') || cy);
const cx = Number.parseFloat(grad.getAttribute('cx') || 0.5),
cy = Number.parseFloat(grad.getAttribute('cy') || 0.5),
fx = Number.parseFloat(grad.getAttribute('fx') || cx),
fy = Number.parseFloat(grad.getAttribute('fy') || cy);
const previewRect = mkElem('rect', {
id: id + '_jgraduate_rect',
@@ -617,7 +617,7 @@ export default function jQueryPluginJGraduate ($) {
.val(attrval)
.change(function () {
// TODO: Support values < 0 and > 1 (zoomable preview?)
if (isNaN(parseFloat(this.value)) || this.value < 0) {
if (isNaN(Number.parseFloat(this.value)) || this.value < 0) {
this.value = 0.0;
} else if (this.value > 1) {
this.value = 1.0;
@@ -692,7 +692,7 @@ export default function jQueryPluginJGraduate ($) {
const colorhandle = this; // eslint-disable-line consistent-this
let stopOpacity = Number(stop.getAttribute('stop-opacity')) || 1;
let stopColor = stop.getAttribute('stop-color') || 1;
let thisAlpha = (parseFloat(stopOpacity) * 255).toString(16);
let thisAlpha = (Number.parseFloat(stopOpacity) * 255).toString(16);
while (thisAlpha.length < 2) { thisAlpha = '0' + thisAlpha; }
colr = stopColor.substr(1) + thisAlpha;
$('#' + id + '_jGraduate_stopPicker').css({left: 100, bottom: 15}).jPicker({
@@ -1052,7 +1052,7 @@ export default function jQueryPluginJGraduate ($) {
const setSlider = function (e) {
const {offset: {left}} = slider;
const div = slider.parent;
let x = (e.pageX - left - parseInt(div.css('border-left-width')));
let x = (e.pageX - left - Number.parseInt(div.css('border-left-width')));
if (x > SLIDERW) x = SLIDERW;
if (x <= 0) x = 0;
const posx = x - 5;
@@ -1066,7 +1066,7 @@ export default function jQueryPluginJGraduate ($) {
curGradient.setAttribute('r', x);
break;
case 'opacity':
$this.paint.alpha = parseInt(x * 100);
$this.paint.alpha = Number.parseInt(x * 100);
previewRect.setAttribute('fill-opacity', x);
break;
case 'ellip':

View File

@@ -463,11 +463,11 @@ const jPicker = function ($) {
case alpha && alpha.get(0):
switch (e.keyCode) {
case 38:
alpha.val(setValueInRange.call(that, parseFloat(alpha.val()) + 1, 0, 100));
alpha.val(setValueInRange.call(that, Number.parseFloat(alpha.val()) + 1, 0, 100));
color.val('a', toFixedNumeric((alpha.val() * 255) / 100, alphaPrecision), e.target);
return false;
case 40:
alpha.val(setValueInRange.call(that, parseFloat(alpha.val()) - 1, 0, 100));
alpha.val(setValueInRange.call(that, Number.parseFloat(alpha.val()) - 1, 0, 100));
color.val('a', toFixedNumeric((alpha.val() * 255) / 100, alphaPrecision), e.target);
return false;
}
@@ -563,7 +563,7 @@ const jPicker = function ($) {
break;
case ahex && ahex.get(0):
ahex.val(ahex.val().replace(/[^a-fA-F\d]/g, '').toLowerCase().substring(0, 2));
color.val('a', !isNullish(ahex.val()) ? parseInt(ahex.val(), 16) : null, e.target);
color.val('a', !isNullish(ahex.val()) ? Number.parseInt(ahex.val(), 16) : null, e.target);
break;
}
return undefined;
@@ -1086,7 +1086,7 @@ const jPicker = function ($) {
* @returns {Integer}
*/
hexToInt (hex) {
return parseInt(hex, 16);
return Number.parseInt(hex, 16);
},
/**
* @typedef {PlainObject} module:jPicker.HSV
@@ -1120,7 +1120,7 @@ const jPicker = function ($) {
if (r === max) hsv.h = (g - b) / delta;
else if (g === max) hsv.h = 2 + (b - r) / delta;
else hsv.h = 4 + (r - g) / delta;
hsv.h = parseInt(hsv.h * 60);
hsv.h = Number.parseInt(hsv.h * 60);
if (hsv.h < 0) hsv.h += 360;
}
hsv.s = (hsv.s * 100) | 0;
@@ -1251,7 +1251,7 @@ const jPicker = function ($) {
} else {
settings.window.liveUpdate = false; // Basic control binding for inline use - You will need to override the liveCallback or commitCallback function to retrieve results
}
const isLessThanIE7 = parseFloat(navigator.appVersion.split('MSIE')[1]) < 7 && document.body.filters; // needed to run the AlphaImageLoader function for IE6
const isLessThanIE7 = Number.parseFloat(navigator.appVersion.split('MSIE')[1]) < 7 && document.body.filters; // needed to run the AlphaImageLoader function for IE6
// set color mode and update visuals for the new color mode
/**
*
@@ -1802,8 +1802,8 @@ const jPicker = function ($) {
function moveBarMouseDown (e) {
// const {element} = settings.window, // local copies for YUI compressor
// {page} = settings.window;
elementStartX = parseInt(container.css('left'));
elementStartY = parseInt(container.css('top'));
elementStartX = Number.parseInt(container.css('left'));
elementStartY = Number.parseInt(container.css('top'));
pageStartX = e.pageX;
pageStartY = e.pageY;
// bind events to document to move window - we will unbind these on mouseup
@@ -2000,7 +2000,7 @@ const jPicker = function ($) {
? (popup.offset().left - 10 + (win.position.y === 'center' ? 25 : 0)) + 'px'
: win.position.x === 'screenCenter'
? (($(document).width() >> 1) - 260) + 'px'
: (popup.offset().left + parseInt(win.position.x)) + 'px',
: (popup.offset().left + Number.parseInt(win.position.x)) + 'px',
position: 'absolute',
top: win.position.y === 'top'
? (popup.offset().top - 312) + 'px'
@@ -2008,7 +2008,7 @@ const jPicker = function ($) {
? (popup.offset().top - 156) + 'px'
: win.position.y === 'bottom'
? (popup.offset().top + 25) + 'px'
: (popup.offset().top + parseInt(win.position.y)) + 'px'
: (popup.offset().top + Number.parseInt(win.position.y)) + 'px'
}
);
} else {