- 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

@@ -263,7 +263,7 @@ const svgElementToPdf = function (element, pdf, options) {
pdf.setFillColor(fillRGB.r, fillRGB.g, fillRGB.b);
}
if (attributeIsNotEmpty(node, 'stroke-width')) {
pdf.setLineWidth(k * parseInt(node.getAttribute('stroke-width')));
pdf.setLineWidth(k * Number.parseInt(node.getAttribute('stroke-width')));
}
const strokeColor = node.getAttribute('stroke');
if (attributeIsNotEmpty(strokeColor) && node.getAttribute('stroke-width') !== '0' && node.getAttribute('stroke-opacity') !== '0') {
@@ -291,38 +291,38 @@ const svgElementToPdf = function (element, pdf, options) {
break;
case 'line':
pdf.line(
k * parseInt(node.getAttribute('x1')),
k * parseInt(node.getAttribute('y1')),
k * parseInt(node.getAttribute('x2')),
k * parseInt(node.getAttribute('y2'))
k * Number.parseInt(node.getAttribute('x1')),
k * Number.parseInt(node.getAttribute('y1')),
k * Number.parseInt(node.getAttribute('x2')),
k * Number.parseInt(node.getAttribute('y2'))
);
removeAttributes(node, pdfSvgAttr.line);
break;
case 'rect':
pdf.rect(
k * parseInt(node.getAttribute('x')),
k * parseInt(node.getAttribute('y')),
k * parseInt(node.getAttribute('width')),
k * parseInt(node.getAttribute('height')),
k * Number.parseInt(node.getAttribute('x')),
k * Number.parseInt(node.getAttribute('y')),
k * Number.parseInt(node.getAttribute('width')),
k * Number.parseInt(node.getAttribute('height')),
colorMode
);
removeAttributes(node, pdfSvgAttr.rect);
break;
case 'ellipse':
pdf.ellipse(
k * parseInt(node.getAttribute('cx')),
k * parseInt(node.getAttribute('cy')),
k * parseInt(node.getAttribute('rx')),
k * parseInt(node.getAttribute('ry')),
k * Number.parseInt(node.getAttribute('cx')),
k * Number.parseInt(node.getAttribute('cy')),
k * Number.parseInt(node.getAttribute('rx')),
k * Number.parseInt(node.getAttribute('ry')),
colorMode
);
removeAttributes(node, pdfSvgAttr.ellipse);
break;
case 'circle':
pdf.circle(
k * parseInt(node.getAttribute('cx')),
k * parseInt(node.getAttribute('cy')),
k * parseInt(node.getAttribute('r')),
k * Number.parseInt(node.getAttribute('cx')),
k * Number.parseInt(node.getAttribute('cy')),
k * Number.parseInt(node.getAttribute('r')),
colorMode
);
removeAttributes(node, pdfSvgAttr.circle);
@@ -405,7 +405,7 @@ const svgElementToPdf = function (element, pdf, options) {
}
pdf.setFontType(fontType);
const pdfFontSize = node.hasAttribute('font-size')
? parseInt(node.getAttribute('font-size'))
? Number.parseInt(node.getAttribute('font-size'))
: 16;
/**
@@ -441,8 +441,8 @@ const svgElementToPdf = function (element, pdf, options) {
case 'start': break;
case 'default': node.setAttribute('text-anchor', 'start'); break;
}
x = parseInt(node.getAttribute('x')) - xOffset;
y = parseInt(node.getAttribute('y'));
x = Number.parseInt(node.getAttribute('x')) - xOffset;
y = Number.parseInt(node.getAttribute('y'));
}
// console.log('fontSize:', pdfFontSize, 'text:', node.textContent);
pdf.setFontSize(pdfFontSize).text(