Skip to content

Commit

Permalink
chore(ci): test error (#320)
Browse files Browse the repository at this point in the history
* chore(ci): test error

* chore: format code
  • Loading branch information
wangxingkang authored Jul 31, 2024
1 parent 36c6e4b commit 96e2066
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 41 deletions.
2 changes: 1 addition & 1 deletion __tests__/integration/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand Down
2 changes: 1 addition & 1 deletion __tests__/performance/analysis.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand Down
2 changes: 1 addition & 1 deletion __tests__/performance/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!doctype html>
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8" />
Expand Down
2 changes: 1 addition & 1 deletion __tests__/performance/preview.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand Down
2 changes: 1 addition & 1 deletion __tests__/performance/report.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"size": "limit-size",
"lint": "NODE_ENV=test && eslint ./src/**/*.ts ./__tests__/**/*.ts && prettier ./src ./__tests__ --check ",
"fix": "eslint ./src/**/*.ts ./__tests__/**/*.ts --fix && prettier ./src ./__tests__ --write ",
"test": "NODE_OPTIONS=--experimental-vm-modules npx jest",
"test": "jest",
"build": "run-s clean build:* size",
"build:umd": "webpack",
"build:cjs": "tsc -p tsconfig.json --target ES5 --module commonjs --outDir lib",
Expand Down Expand Up @@ -60,6 +60,7 @@
"@commitlint/cli": "^11.0.0",
"@commitlint/config-conventional": "^12.0.1",
"@types/jest": "^29.5.1",
"@types/prettier": "^2.7.3",
"@types/jsdom": "^21.1.1",
"@types/react": "^16.14.34",
"@types/react-dom": "^18.0.9",
Expand All @@ -78,7 +79,7 @@
"eslint-config-prettier": "^9.0.0",
"eslint-import-resolver-typescript": "^3.6.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-prettier": "^4.2.1",
"gh-pages": "^3.2.3",
"husky": "^5.0.9",
"jest": "^29.7.0",
Expand All @@ -87,7 +88,7 @@
"limit-size": "^0.1.4",
"lint-staged": "^10.5.4",
"npm-run-all": "^4.1.5",
"prettier": "^3.0.3",
"prettier": "^2.8.8",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-i18next": "^11.7.0",
Expand Down
4 changes: 2 additions & 2 deletions src/core/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export type PrefixStyleProps<T extends Record<string, any>, P extends string> =
[K in keyof T as K extends `show${infer S}`
? `show${Capitalize<P>}${S}`
: K extends string
? `${P}${Capitalize<K>}`
: never]: T[K];
? `${P}${Capitalize<K>}`
: never]: T[K];
};

export type CallableStyleProps<T extends Record<string, any>, P extends any[]> = {
Expand Down
11 changes: 4 additions & 7 deletions src/ui/legend/continuous/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,10 @@ export function getBlockColor(partition: number[], color: string[], orientation:
const colors = Array.from(color);
const count = partition.length;

return new Array(count).fill(0).reduce(
(r, v, idx) => {
const c = colors[idx % colors.length];
return (r += ` ${partition[idx]}:${c}${idx < count - 1 ? ` ${partition[idx + 1]}:${c}` : ''}`);
},
`l(${orientation === 'horizontal' ? '0' : '270'})`
);
return new Array(count).fill(0).reduce((r, v, idx) => {
const c = colors[idx % colors.length];
return (r += ` ${partition[idx]}:${c}${idx < count - 1 ? ` ${partition[idx + 1]}:${c}` : ''}`);
}, `l(${orientation === 'horizontal' ? '0' : '270'})`);
}

export function getNextTickValue(ticks: number[], value: number) {
Expand Down
15 changes: 6 additions & 9 deletions src/ui/timebar/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,12 @@ export class Controller extends Component<ControllerStyleProps> {
padding: [, right, , left],
} = this;

const components = functions.reduce(
(prev, curr) => {
if (prev.length && curr.length) {
return prev.concat('split', ...curr);
}
return prev.concat(...curr);
},
[] as (keyof typeof componentsMap)[]
);
const components = functions.reduce((prev, curr) => {
if (prev.length && curr.length) {
return prev.concat('split', ...curr);
}
return prev.concat(...curr);
}, [] as (keyof typeof componentsMap)[]);

const componentsWidth = components.length * (iconSize + iconSpacing) - iconSpacing;
const xOffset =
Expand Down
13 changes: 5 additions & 8 deletions src/ui/title/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,11 @@ export function getBBox(title: Title, content: DisplayObject): DOMRect {
}

function mayApplyStyle(el: Selection, style: any) {
const finalStyle = Object.entries(style).reduce(
(acc, [key, value]) => {
const currAttr = el.node().attr(key);
if (!currAttr) acc[key] = value;
return acc;
},
{} as Record<string, any>
);
const finalStyle = Object.entries(style).reduce((acc, [key, value]) => {
const currAttr = el.node().attr(key);
if (!currAttr) acc[key] = value;
return acc;
}, {} as Record<string, any>);

el.styles(finalStyle);
}
Expand Down
11 changes: 4 additions & 7 deletions src/util/group-by.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
export function groupBy<T extends { [key: string]: any }>(source: T[], by: keyof T) {
return source.reduce(
(acc, curr) => {
(acc[curr[by]] = acc[curr[by]] || []).push(curr);
return acc;
},
{} as { [key in T[keyof T]]: T[] }
);
return source.reduce((acc, curr) => {
(acc[curr[by]] = acc[curr[by]] || []).push(curr);
return acc;
}, {} as { [key in T[keyof T]]: T[] });
}

0 comments on commit 96e2066

Please sign in to comment.