From e5e4ddf49e270079854357b81e4a12cb1c8bf03f Mon Sep 17 00:00:00 2001 From: Ramy Melo Date: Fri, 4 Mar 2022 16:04:14 -0500 Subject: [PATCH] chore: eslint --fix after enabling ts typed rules. --- packages/utils/src/colors/index.ts | 6 +++--- packages/utils/src/icon-set/convert-info.ts | 4 ++-- packages/utils/src/icon-set/validate.ts | 2 +- packages/utils/src/svg/size.ts | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/utils/src/colors/index.ts b/packages/utils/src/colors/index.ts index f2f4ed4..ce4bf71 100644 --- a/packages/utils/src/colors/index.ts +++ b/packages/utils/src/colors/index.ts @@ -60,8 +60,8 @@ function fromFunction(value: string): Color | null { } // Get function and values - const func = (parts[0] as string).trim(); - const content = (parts[1] as string).trim(); + const func = parts[0].trim(); + const content = parts[1].trim(); // Get alpha and split content let values: string[]; @@ -133,7 +133,7 @@ function fromFunction(value: string): Color | null { const isPercentage: boolean[] = []; const numbers: number[] = []; for (let i = 0; i < 3; i++) { - const colorStr = values[i] as string; + const colorStr = values[i]; const index = colorStr.indexOf('%'); const hasPercentage = index !== -1; if (hasPercentage && index !== colorStr.length - 1) { diff --git a/packages/utils/src/icon-set/convert-info.ts b/packages/utils/src/icon-set/convert-info.ts index cd8e688..30642ba 100644 --- a/packages/utils/src/icon-set/convert-info.ts +++ b/packages/utils/src/icon-set/convert-info.ts @@ -88,9 +88,9 @@ export function convertIconSetInfo( // Get name let name: string; if (typeof source.name === 'string') { - name = source.name as string; + name = source.name; } else if (typeof source.title === 'string') { - name = source.title as string; + name = source.title; } else { return null; } diff --git a/packages/utils/src/icon-set/validate.ts b/packages/utils/src/icon-set/validate.ts index f92a35c..f0eb341 100644 --- a/packages/utils/src/icon-set/validate.ts +++ b/packages/utils/src/icon-set/validate.ts @@ -304,7 +304,7 @@ export function validateIconSet( if (typeof data.chars === 'object') { const chars = data.chars; Object.keys(chars).forEach((char) => { - if (!char.match(matchChar) || typeof chars[char] !== 'string') { + if (!matchChar.exec(char) || typeof chars[char] !== 'string') { if (fix) { delete chars[char]; return; diff --git a/packages/utils/src/svg/size.ts b/packages/utils/src/svg/size.ts index 6a49e5c..a435117 100644 --- a/packages/utils/src/svg/size.ts +++ b/packages/utils/src/svg/size.ts @@ -33,7 +33,7 @@ export function calculateSize( const newParts = []; let code = oldParts.shift() as string; - let isNumber = unitsTest.test(code as string); + let isNumber = unitsTest.test(code); // eslint-disable-next-line no-constant-condition while (true) {