Skip to content

Commit

Permalink
chore: fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
wzc520pyfm committed Mar 27, 2024
1 parent 8494138 commit 60997b6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
10 changes: 7 additions & 3 deletions src/plugin/inputHex/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import type { MyColorCfg as OColorCfg, MyColorPlugin, InputColor as OInputColor } from "../..";
import type {
MyColorCfg as OColorCfg,
MyColorPlugin,
InputColor as OInputColor,
} from "../..";

type ColorHexString = string; // should recognize hexadecimal string, like #ff3399 and #F39
interface ColorCfg {
Expand Down Expand Up @@ -74,8 +78,8 @@ export const inputHex: MyColorPlugin = (_, c) => {
};
};

type InputColor = OInputColor | ColorHexString
type InputColor = OInputColor | ColorHexString;

export type { ColorHexString, MyColorCfg, InputColor }
export type { ColorHexString, MyColorCfg, InputColor };

export default inputHex;
13 changes: 9 additions & 4 deletions src/plugin/inputNamed/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import type { MyColorPlugin } from "../..";
import type { InputColor as OInputColor, MyColorCfg as OColorCfg } from "../inputHex";
import type {
InputColor as OInputColor,
MyColorCfg as OColorCfg,
} from "../inputHex";
import { w3cx11, type W3CX11 } from "./w3cx11";

interface ColorCfg {
Expand All @@ -12,7 +15,9 @@ const parseColor = (cfg: MyColorCfg): OInputColor => {
const { color } = cfg;
const namedColor = color.toLowerCase() as W3CX11;

Check failure on line 16 in src/plugin/inputNamed/index.ts

View workflow job for this annotation

GitHub Actions / ci

test/index.test.ts > mycolor > should get default rgba color

TypeError: color.toLowerCase is not a function ❯ MyColor.parseColor src/plugin/inputNamed/index.ts:16:28 ❯ MyColor.proto.parse src/plugin/inputNamed/index.ts:35:39 ❯ new MyColor src/index.ts:83:10 ❯ Module.mycolor src/index.ts:28:10 ❯ test/index.test.ts:11:12

Check failure on line 16 in src/plugin/inputNamed/index.ts

View workflow job for this annotation

GitHub Actions / ci

test/index.test.ts > mycolor > should get a new mycolor instance

TypeError: color.toLowerCase is not a function ❯ MyColor.parseColor src/plugin/inputNamed/index.ts:16:28 ❯ MyColor.proto.parse src/plugin/inputNamed/index.ts:35:39 ❯ new MyColor src/index.ts:83:10 ❯ Module.mycolor src/index.ts:28:10 ❯ test/index.test.ts:19:20

Check failure on line 16 in src/plugin/inputNamed/index.ts

View workflow job for this annotation

GitHub Actions / ci

test/index.test.ts > mycolor > input rgba params, should get a rgba array

TypeError: color.toLowerCase is not a function ❯ MyColor.parseColor src/plugin/inputNamed/index.ts:16:28 ❯ MyColor.proto.parse src/plugin/inputNamed/index.ts:35:39 ❯ new MyColor src/index.ts:83:10 ❯ Module.mycolor src/index.ts:28:10 ❯ test/index.test.ts:24:12

if (w3cx11[namedColor]) { return w3cx11[namedColor]; }
if (w3cx11[namedColor]) {
return w3cx11[namedColor];
}

// parse failed, return original color
return color;
Expand All @@ -33,9 +38,9 @@ export const inputNamed: MyColorPlugin = (_, c) => {
};
};

type InputColor = OInputColor | W3CX11
type InputColor = OInputColor | W3CX11;

export type { MyColorCfg, InputColor }
export type { MyColorCfg, InputColor };

export default inputNamed;

Expand Down

0 comments on commit 60997b6

Please sign in to comment.