1
0
mirror of https://github.com/svg/svgo.git synced 2025-07-29 20:21:14 +03:00

chore: apply more eslint rules (#2116)

This commit is contained in:
Seth Falco
2025-05-02 10:00:37 +01:00
committed by GitHub
parent 97079fb57e
commit a8a53dbd90
37 changed files with 336 additions and 267 deletions

View File

@ -10,7 +10,7 @@ import { removeLeadingZero } from '../lib/svgo/tools.js';
export const name = 'cleanupNumericValues';
export const description =
'rounds numeric values to the fixed precision, removes default px units';
'rounds numeric values to the fixed precision, removes default "px" units';
const regNumericValues =
/^([-+]?\d*\.?\d+([eE][-+]?\d+)?)(px|pt|pc|mm|cm|m|in|ft|em|ex|%)?$/;
@ -26,8 +26,7 @@ const absoluteLengths = {
};
/**
* Round numeric values to the fixed precision,
* remove default 'px' units.
* Round numeric values to the fixed precision, remove default 'px' units.
*
* @author Kir Belevich
*
@ -69,7 +68,7 @@ export const fn = (_root, params) => {
// round it to the fixed precision
let num = Number(Number(match[1]).toFixed(floatPrecision));
/** @type {any} */
let matchedUnit = match[3] || '';
const matchedUnit = match[3] || '';
/** @type {'' | keyof typeof absoluteLengths} */
let units = matchedUnit;