From 1a2bffbe3e5423052302c5d266ede934b9c3f8d8 Mon Sep 17 00:00:00 2001 From: GitHub Actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 27 Mar 2024 20:57:39 +0000 Subject: [PATCH] Linting changes --- src/constants/references.ts | 2 +- src/converters/hexToRgba.ts | 18 +++++++++--------- src/converters/hslToRgb.ts | 2 +- src/converters/hsvToRgb.ts | 2 +- src/converters/labToLch.ts | 2 +- src/converters/labToXyz.ts | 2 +- src/converters/lchToLab.ts | 2 +- src/converters/lchToRgb.ts | 2 +- src/converters/rgbToHex.ts | 2 +- src/converters/rgbToHsl.ts | 2 +- src/converters/rgbToHsv.ts | 2 +- src/converters/rgbToLch.ts | 2 +- src/converters/rgbToXyz.ts | 2 +- src/converters/rgbaToHex.ts | 2 +- src/converters/xyzToLab.ts | 2 +- src/converters/xyzToRgb.ts | 2 +- 16 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/constants/references.ts b/src/constants/references.ts index 5b51efd..386ace0 100644 --- a/src/constants/references.ts +++ b/src/constants/references.ts @@ -1,4 +1,4 @@ -import { References } from "../types"; +import type { References } from "../types"; export const references = { /**Incandescent/tungsten */ diff --git a/src/converters/hexToRgba.ts b/src/converters/hexToRgba.ts index 09954f3..d92ffbe 100644 --- a/src/converters/hexToRgba.ts +++ b/src/converters/hexToRgba.ts @@ -1,4 +1,4 @@ -import { RGBA } from "../types"; +import type { RGBA } from "../types"; export const hexToRgba = (hex: string): RGBA => { let r = 0; @@ -12,16 +12,16 @@ export const hexToRgba = (hex: string): RGBA => { // #FFFFFF // #FFFFFF00 if ([4, 5].includes(hex.length)) { - r = parseInt(hex.slice(1, 2).repeat(2), 16); - g = parseInt(hex.slice(2, 3).repeat(2), 16); - b = parseInt(hex.slice(3, 4).repeat(2), 16); - if (hex.length === 5) a = parseInt(hex.slice(4, 5).repeat(2), 16); + r = Number.parseInt(hex.slice(1, 2).repeat(2), 16); + g = Number.parseInt(hex.slice(2, 3).repeat(2), 16); + b = Number.parseInt(hex.slice(3, 4).repeat(2), 16); + if (hex.length === 5) a = Number.parseInt(hex.slice(4, 5).repeat(2), 16); } else { if ([7, 9].includes(hex.length)) { - r = parseInt(hex.slice(1, 3), 16); - g = parseInt(hex.slice(3, 5), 16); - b = parseInt(hex.slice(5, 7), 16); - if (hex.length === 9) a = parseInt(hex.slice(7, 9), 16); + r = Number.parseInt(hex.slice(1, 3), 16); + g = Number.parseInt(hex.slice(3, 5), 16); + b = Number.parseInt(hex.slice(5, 7), 16); + if (hex.length === 9) a = Number.parseInt(hex.slice(7, 9), 16); } else throw "Not supported Hex, we only support Hex with 3, 4, 6 or 8 digits"; } diff --git a/src/converters/hslToRgb.ts b/src/converters/hslToRgb.ts index fe0d514..ebd41bb 100644 --- a/src/converters/hslToRgb.ts +++ b/src/converters/hslToRgb.ts @@ -1,4 +1,4 @@ -import { HSL, RGB } from "../types"; +import type { HSL, RGB } from "../types"; const HueToRgb = (v1: number, v2: number, vH: number) => { if (vH < 0) vH += 1; diff --git a/src/converters/hsvToRgb.ts b/src/converters/hsvToRgb.ts index 3f5c7d7..3886979 100644 --- a/src/converters/hsvToRgb.ts +++ b/src/converters/hsvToRgb.ts @@ -1,4 +1,4 @@ -import { HSV, RGB } from "src/types"; +import type { HSV, RGB } from "src/types"; export const hsvToRgb = ({ h, s, v }: HSV): RGB => { if (s === 0) diff --git a/src/converters/labToLch.ts b/src/converters/labToLch.ts index 55a140e..9b5d240 100644 --- a/src/converters/labToLch.ts +++ b/src/converters/labToLch.ts @@ -1,4 +1,4 @@ -import { LAB, LCH } from "../types"; +import type { LAB, LCH } from "../types"; export const labToLch = ({ l, a, b }: LAB): LCH => { // Convert to polar form diff --git a/src/converters/labToXyz.ts b/src/converters/labToXyz.ts index 79020ec..d38a6c4 100644 --- a/src/converters/labToXyz.ts +++ b/src/converters/labToXyz.ts @@ -1,5 +1,5 @@ import { DefaultReference } from "../constants"; -import { LAB, XYZ } from "../types"; +import type { LAB, XYZ } from "../types"; const calculate = (x: number) => { const pow = Math.pow(x, 3); diff --git a/src/converters/lchToLab.ts b/src/converters/lchToLab.ts index 418726b..16acdac 100644 --- a/src/converters/lchToLab.ts +++ b/src/converters/lchToLab.ts @@ -1,4 +1,4 @@ -import { LAB, LCH } from "../types"; +import type { LAB, LCH } from "../types"; export const lchToLab = ({ l, c, h }: LCH): LAB => ({ l, diff --git a/src/converters/lchToRgb.ts b/src/converters/lchToRgb.ts index 049ee05..64151f2 100644 --- a/src/converters/lchToRgb.ts +++ b/src/converters/lchToRgb.ts @@ -1,6 +1,6 @@ import { labToXyz } from "./labToXyz"; import { lchToLab } from "./lchToLab"; -import { LCH, RGB, XYZ } from "../types"; +import type { LCH, RGB, XYZ } from "../types"; import { xyzToRgb } from "./xyzToRgb"; import { DefaultReference } from "../constants"; diff --git a/src/converters/rgbToHex.ts b/src/converters/rgbToHex.ts index dbab6eb..4c9553b 100644 --- a/src/converters/rgbToHex.ts +++ b/src/converters/rgbToHex.ts @@ -1,4 +1,4 @@ -import { RGB } from "../types"; +import type { RGB } from "../types"; export const toHex = (x: number) => { const asHex = x.toString(16); diff --git a/src/converters/rgbToHsl.ts b/src/converters/rgbToHsl.ts index 7c36e4e..bd137b7 100644 --- a/src/converters/rgbToHsl.ts +++ b/src/converters/rgbToHsl.ts @@ -1,4 +1,4 @@ -import { HSL, RGB } from "../types"; +import type { HSL, RGB } from "../types"; export const rgbToHsl = ({ r, g, b }: RGB): HSL => { const varR = r / 255; diff --git a/src/converters/rgbToHsv.ts b/src/converters/rgbToHsv.ts index 03cb9d3..3b959d8 100644 --- a/src/converters/rgbToHsv.ts +++ b/src/converters/rgbToHsv.ts @@ -1,4 +1,4 @@ -import { HSV, RGB } from "src/types"; +import type { HSV, RGB } from "src/types"; export const rgbToHsv = ({ r, g, b }: RGB): HSV => { const varR = r / 255; diff --git a/src/converters/rgbToLch.ts b/src/converters/rgbToLch.ts index bb676fa..08ef7ed 100644 --- a/src/converters/rgbToLch.ts +++ b/src/converters/rgbToLch.ts @@ -1,7 +1,7 @@ import { hexToRgba } from "./hexToRgba"; import { labToLch } from "./labToLch"; import { rgbToXyz } from "./rgbToXyz"; -import { LCH, XYZ } from "../types"; +import type { LCH, XYZ } from "../types"; import { xyzToLab } from "./xyzToLab"; import { DefaultReference } from "../constants"; diff --git a/src/converters/rgbToXyz.ts b/src/converters/rgbToXyz.ts index f9e1a41..f5ee568 100644 --- a/src/converters/rgbToXyz.ts +++ b/src/converters/rgbToXyz.ts @@ -1,4 +1,4 @@ -import { RGB, XYZ } from "../types"; +import type { RGB, XYZ } from "../types"; const calculate = (x: number) => (x > 0.04045 ? Math.pow((x + 0.055) / 1.055, 2.4) : x / 12.92) * 100; diff --git a/src/converters/rgbaToHex.ts b/src/converters/rgbaToHex.ts index 2c86207..921a567 100644 --- a/src/converters/rgbaToHex.ts +++ b/src/converters/rgbaToHex.ts @@ -1,4 +1,4 @@ import { rgbToHex, toHex } from "./rgbToHex"; -import { RGBA } from "../types"; +import type { RGBA } from "../types"; export const rgbaToHex = ({ a, ...rgb }: RGBA) => `${rgbToHex(rgb)}${toHex(a)}`; diff --git a/src/converters/xyzToLab.ts b/src/converters/xyzToLab.ts index 99355d9..f8c129b 100644 --- a/src/converters/xyzToLab.ts +++ b/src/converters/xyzToLab.ts @@ -1,5 +1,5 @@ import { DefaultReference } from "../constants"; -import { LAB, XYZ } from "../types"; +import type { LAB, XYZ } from "../types"; const calculate = (x: number) => x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116; diff --git a/src/converters/xyzToRgb.ts b/src/converters/xyzToRgb.ts index a268287..e7818c5 100644 --- a/src/converters/xyzToRgb.ts +++ b/src/converters/xyzToRgb.ts @@ -1,4 +1,4 @@ -import { RGB, XYZ } from "../types"; +import type { RGB, XYZ } from "../types"; const calculate = (x: number) => (x > 0.0031308 ? 1.055 * Math.pow(x, 1 / 2.4) - 0.055 : 12.92 * x) * 255;