From c419d4d2c6510f15797f0712193a1da77899cf81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Pereira=20Mu=C3=B1oz?= <elchininet@gmail.com> Date: Thu, 19 Jan 2023 23:27:39 +0100 Subject: [PATCH] Enforce no trailing spaces --- .eslintrc.js | 3 ++- src/color/css.ts | 12 ++++++------ src/color/translators.ts | 2 +- src/color/utils.ts | 14 +++++++------- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 292c81f..5455162 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -21,7 +21,8 @@ module.exports = { plugins: ['@typescript-eslint'], rules: { quotes: ['error', 'single', { 'avoidEscape': true, 'allowTemplateLiterals': true }], - semi: ['error', 'always'] + semi: ['error', 'always'], + 'no-trailing-spaces': ['error'] }, overrides: [ { diff --git a/src/color/css.ts b/src/color/css.ts index 7db190b..7191864 100644 --- a/src/color/css.ts +++ b/src/color/css.ts @@ -5,12 +5,12 @@ import { HSLObject, CMYKObject } from '@types'; -import { - toHEX, - hasProp, - round, - roundAll, - toHEXAll +import { + toHEX, + hasProp, + round, + roundAll, + toHEXAll } from '#helpers'; export const CSS = { diff --git a/src/color/translators.ts b/src/color/translators.ts index 0056d7f..6850c3a 100644 --- a/src/color/translators.ts +++ b/src/color/translators.ts @@ -137,7 +137,7 @@ export const rybToRGB = (r: number, y: number, b: number): RGBObject => { //---Hue RYB export const hueRYB = (hue: number, toRYB: boolean): number => { - + if (hue < 0) hue += 360; if (hue > 360) hue -= 360; diff --git a/src/color/utils.ts b/src/color/utils.ts index 8817095..3ac68aa 100644 --- a/src/color/utils.ts +++ b/src/color/utils.ts @@ -72,7 +72,7 @@ export const normalizeHue = (hue: number | string): number => { break; case 'deg': case 'grad': - default: + default: hue = value; } } @@ -82,7 +82,7 @@ export const normalizeHue = (hue: number | string): number => { } return hue; -}; +}; //---Normalize alpha export const normalizeAlpha = (alpha: number | string | undefined | null): number => { @@ -100,7 +100,7 @@ export const normalizeAlpha = (alpha: number | string | undefined | null): numbe const harmony = (color: HSLObject, angles: number[], mode: Mix): HSLObject[] => angles.reduce( (arr: HSLObject[], num: number): HSLObject[] => - ( + ( [ ...arr, { @@ -158,7 +158,7 @@ const getColorModelFromObject = (color: Color): ColorModel => { let model: ColorModel; let invalid = false; const props = getOrderedArrayString(Object.keys(color)); - + if(VALID_COLOR_OBJECTS[props]) { model = VALID_COLOR_OBJECTS[props]; } @@ -183,7 +183,7 @@ const getColorModelFromObject = (color: Color): ColorModel => { if (hasInvalidHex && hasInvalidRegb) { invalid = true; } - + if (!hasInvalidHex) { model = ColorModel.HEX; } @@ -436,7 +436,7 @@ export const getColorMixture = (color: ColorInputWithoutCMYK, steps: number, sha ? translateColor.HSLA({ ...hslToRGB(hslColor.h, hslColor.s, hslColor.l), a: hslColor.a }) : translateColor.HSL(hslToRGB(hslColor.h, hslColor.s, hslColor.l)); }); - + } }; @@ -623,7 +623,7 @@ export const colorMixer = { mix = rybToRGB(ryb.r, ryb.y, ryb.b); mix.a = ryb.a; } - + return { r: round(mix.r, 2), g: round(mix.g, 2),