diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index e7faf7a6..00000000 --- a/.prettierignore +++ /dev/null @@ -1,2 +0,0 @@ -optuna_dashboard/ts/components/PlotlyDarkMode.ts -standalone_app/src/PlotlyDarkMode.ts diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index 24ae9a99..00000000 --- a/.prettierrc +++ /dev/null @@ -1,4 +0,0 @@ -trailingComma: "es5" -tabWidth: 2 -semi: false -singleQuote: false diff --git a/biome.json b/biome.json new file mode 100644 index 00000000..740e9600 --- /dev/null +++ b/biome.json @@ -0,0 +1,28 @@ +{ + "$schema": "https://biomejs.dev/schemas/1.5.3/schema.json", + "files": { + "include": [ + "optuna_dashboard/ts/**/*.ts", + "optuna_dashboard/ts/**/*.tsx", + "typescript_tests/**/*.ts", + "typescript_tests/**/*.tsx", + "standalone_app/src/**/*.ts", + "standalone_app/src/**/*.tsx", + "vscode/src/**/*.ts", + "vscode/src/**/*.tsx" + ], + "ignore": [ + "optuna_dashboard/ts/components/PlotlyDarkMode.ts", + "standalone_app/src/PlotlyDarkMode.ts" + ] + }, + "javascript": { + "formatter": { + "trailingComma": "es5", + "indentWidth": 2, + "indentStyle": "space", + "semicolons": "asNeeded", + "quoteStyle": "double" + } + } +} diff --git a/optuna_dashboard/ts/components/Artifact/DeleteArtifactDialog.tsx b/optuna_dashboard/ts/components/Artifact/DeleteArtifactDialog.tsx index 2055ea4c..4c2f16d1 100644 --- a/optuna_dashboard/ts/components/Artifact/DeleteArtifactDialog.tsx +++ b/optuna_dashboard/ts/components/Artifact/DeleteArtifactDialog.tsx @@ -11,7 +11,7 @@ import { actionCreator } from "../../action" export const useDeleteTrialArtifactDialog = (): [ (studyId: number, trialId: number, artifact: Artifact) => void, - () => ReactNode + () => ReactNode, ] => { const action = actionCreator() @@ -58,7 +58,7 @@ export const useDeleteTrialArtifactDialog = (): [ export const useDeleteStudyArtifactDialog = (): [ (studyId: number, artifact: Artifact) => void, - () => ReactNode + () => ReactNode, ] => { const action = actionCreator() diff --git a/optuna_dashboard/ts/components/Artifact/ThreejsArtifactViewer.tsx b/optuna_dashboard/ts/components/Artifact/ThreejsArtifactViewer.tsx index 8e574680..7787e8a4 100644 --- a/optuna_dashboard/ts/components/Artifact/ThreejsArtifactViewer.tsx +++ b/optuna_dashboard/ts/components/Artifact/ThreejsArtifactViewer.tsx @@ -124,7 +124,7 @@ export const ThreejsArtifactViewer: React.FC = ( export const useThreejsArtifactModal = (): [ (path: string, artifact: Artifact) => void, - () => ReactNode + () => ReactNode, ] => { const [open, setOpen] = useState(false) const [target, setTarget] = useState<[string, Artifact | null]>(["", null]) diff --git a/optuna_dashboard/ts/components/Artifact/WaveSurferArtifactViewer.tsx b/optuna_dashboard/ts/components/Artifact/WaveSurferArtifactViewer.tsx index 74177602..96713e69 100644 --- a/optuna_dashboard/ts/components/Artifact/WaveSurferArtifactViewer.tsx +++ b/optuna_dashboard/ts/components/Artifact/WaveSurferArtifactViewer.tsx @@ -34,39 +34,38 @@ const useWavesurfer = ( } // Create a React component of wavesurfer. -export const WaveSurferArtifactViewer: React.FC< - WaveSurferArtifactViewerProps -> = (props) => { - const containerRef = useRef(null!) - const [isPlaying, setIsPlaying] = useState(false) - const wavesurfer = useWavesurfer(containerRef, props) +export const WaveSurferArtifactViewer: React.FC = + (props) => { + const containerRef = useRef(null!) + const [isPlaying, setIsPlaying] = useState(false) + const wavesurfer = useWavesurfer(containerRef, props) - const onPlayClick = useCallback(() => { - if (!wavesurfer) return - wavesurfer.isPlaying() ? wavesurfer.pause() : wavesurfer.play() - }, [wavesurfer]) + const onPlayClick = useCallback(() => { + if (!wavesurfer) return + wavesurfer.isPlaying() ? wavesurfer.pause() : wavesurfer.play() + }, [wavesurfer]) - useEffect(() => { - if (!wavesurfer) return + useEffect(() => { + if (!wavesurfer) return - setIsPlaying(false) + setIsPlaying(false) - const subscriptions = [ - wavesurfer.on("play", () => setIsPlaying(true)), - wavesurfer.on("pause", () => setIsPlaying(false)), - ] + const subscriptions = [ + wavesurfer.on("play", () => setIsPlaying(true)), + wavesurfer.on("pause", () => setIsPlaying(false)), + ] - return () => { - subscriptions.forEach((unsub) => unsub()) - } - }, [wavesurfer]) + return () => { + subscriptions.forEach((unsub) => unsub()) + } + }, [wavesurfer]) - return ( - -
- - - ) -} + return ( + +
+ + + ) + } diff --git a/optuna_dashboard/ts/components/DataGrid.tsx b/optuna_dashboard/ts/components/DataGrid.tsx index 22693a5b..2aaba509 100644 --- a/optuna_dashboard/ts/components/DataGrid.tsx +++ b/optuna_dashboard/ts/components/DataGrid.tsx @@ -71,8 +71,8 @@ function DataGrid(props: { initialRowsPerPage = initialRowsPerPage // use first element as default ? initialRowsPerPage : isNumber(rowsPerPageOption[0]) - ? rowsPerPageOption[0] - : rowsPerPageOption[0].value + ? rowsPerPageOption[0] + : rowsPerPageOption[0].value const [rowsPerPage, setRowsPerPage] = React.useState(initialRowsPerPage) const handleChangePage = (event: unknown, newPage: number) => { @@ -321,8 +321,8 @@ function DataGridHeaderColumn(props: { filter === null ? filterChoices.filter((v) => v !== choice) // By default, every choice is ticked, so the chosen option will be unticked. : filter.values.some((v) => v === choice) - ? filter.values.filter((v) => v !== choice) - : [...filter.values, choice] + ? filter.values.filter((v) => v !== choice) + : [...filter.values, choice] onFilterChange(newTickedValues) }} > diff --git a/optuna_dashboard/ts/components/DeleteStudyDialog.tsx b/optuna_dashboard/ts/components/DeleteStudyDialog.tsx index c7d7a135..73940b2a 100644 --- a/optuna_dashboard/ts/components/DeleteStudyDialog.tsx +++ b/optuna_dashboard/ts/components/DeleteStudyDialog.tsx @@ -11,7 +11,7 @@ import { actionCreator } from "../action" export const useDeleteStudyDialog = (): [ (studyId: number) => void, - () => ReactNode + () => ReactNode, ] => { const action = actionCreator() diff --git a/optuna_dashboard/ts/components/GraphHistory.tsx b/optuna_dashboard/ts/components/GraphHistory.tsx index 0afcb555..4bd2fd76 100644 --- a/optuna_dashboard/ts/components/GraphHistory.tsx +++ b/optuna_dashboard/ts/components/GraphHistory.tsx @@ -251,8 +251,8 @@ const plotHistory = ( return xAxis === "number" ? trial.number : xAxis === "datetime_start" - ? trial.datetime_start ?? new Date() - : trial.datetime_complete ?? new Date() + ? trial.datetime_start ?? new Date() + : trial.datetime_complete ?? new Date() } const plotData: Partial[] = [] diff --git a/optuna_dashboard/ts/components/GraphIntermediateValues.tsx b/optuna_dashboard/ts/components/GraphIntermediateValues.tsx index a06832d9..d0a3c075 100644 --- a/optuna_dashboard/ts/components/GraphIntermediateValues.tsx +++ b/optuna_dashboard/ts/components/GraphIntermediateValues.tsx @@ -95,8 +95,8 @@ const plotIntermediateValue = ( trial.state === "Running" ? "(running)" : !isFeasible - ? "(infeasible)" - : "" + ? "(infeasible)" + : "" }`, ...(!isFeasible && { line: { color: "#CCCCCC" } }), } diff --git a/optuna_dashboard/ts/components/GraphParetoFront.tsx b/optuna_dashboard/ts/components/GraphParetoFront.tsx index f2b11145..ec8faef0 100644 --- a/optuna_dashboard/ts/components/GraphParetoFront.tsx +++ b/optuna_dashboard/ts/components/GraphParetoFront.tsx @@ -207,12 +207,12 @@ const getIsDominated2D = (normalizedValues: number[][]) => { a[0] > b[0] ? 1 : a[0] < b[0] - ? -1 - : a[1] > b[1] - ? 1 - : a[1] < b[1] - ? -1 - : 0 + ? -1 + : a[1] > b[1] + ? 1 + : a[1] < b[1] + ? -1 + : 0 ) let maxValueSeen0 = sorted[0][0] let minValueSeen1 = sorted[0][1] diff --git a/optuna_dashboard/ts/components/GraphRank.tsx b/optuna_dashboard/ts/components/GraphRank.tsx index ab25afeb..d1ce9d19 100644 --- a/optuna_dashboard/ts/components/GraphRank.tsx +++ b/optuna_dashboard/ts/components/GraphRank.tsx @@ -190,8 +190,8 @@ const getRankPlotInfo = ( return typeof value === "number" ? value : value.includes("-") - ? -Infinity - : Infinity + ? -Infinity + : Infinity } filteredTrials.forEach((trial, i) => { const xValue = xAxis.values[i] diff --git a/optuna_dashboard/ts/components/TrialFormWidgets.tsx b/optuna_dashboard/ts/components/TrialFormWidgets.tsx index f727ac80..36bea2a7 100644 --- a/optuna_dashboard/ts/components/TrialFormWidgets.tsx +++ b/optuna_dashboard/ts/components/TrialFormWidgets.tsx @@ -42,8 +42,8 @@ export const TrialFormWidgets: FC<{ formWidgets.output_type === "user_attr" ? "Set User Attributes Form" : directions.length > 1 - ? "Set Objective Values Form" - : "Set Objective Value Form" + ? "Set Objective Values Form" + : "Set Objective Value Form" const widgetNames = formWidgets.widgets.map((widget, i) => { if (formWidgets.output_type === "objective") { if (objectiveNames.at(i) !== undefined) { diff --git a/optuna_dashboard/ts/graphUtil.ts b/optuna_dashboard/ts/graphUtil.ts index 35a9002b..2bed664e 100644 --- a/optuna_dashboard/ts/graphUtil.ts +++ b/optuna_dashboard/ts/graphUtil.ts @@ -47,8 +47,8 @@ const getAxisInfoForCategoricalParams = ( a.toLowerCase() < b.toLowerCase() ? -1 : a.toLowerCase() > b.toLowerCase() - ? 1 - : 0 + ? 1 + : 0 ) return { name: paramName, diff --git a/package-lock.json b/package-lock.json index 1b432956..f6a8bdc3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -38,6 +38,7 @@ "devDependencies": { "@babel/core": "^7.23.9", "@babel/preset-env": "^7.23.9", + "@biomejs/biome": "1.5.3", "@testing-library/react": "^14.1.2", "@types/jest": "^29.5.11", "@types/plotly.js": "^2.12.32", @@ -53,7 +54,6 @@ "jest": "^29.7.0", "jest-canvas-mock": "^2.5.2", "jest-environment-jsdom": "^29.7.0", - "prettier": "^2.5.1", "style-loader": "^3.3.4", "ts-jest": "^29.1.2", "ts-loader": "^9.5.1", @@ -1818,6 +1818,161 @@ "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", "dev": true }, + "node_modules/@biomejs/biome": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-1.5.3.tgz", + "integrity": "sha512-yvZCa/g3akwTaAQ7PCwPWDCkZs3Qa5ONg/fgOUT9e6wAWsPftCjLQFPXBeGxPK30yZSSpgEmRCfpGTmVbUjGgg==", + "dev": true, + "hasInstallScript": true, + "bin": { + "biome": "bin/biome" + }, + "engines": { + "node": ">=14.*" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/biome" + }, + "optionalDependencies": { + "@biomejs/cli-darwin-arm64": "1.5.3", + "@biomejs/cli-darwin-x64": "1.5.3", + "@biomejs/cli-linux-arm64": "1.5.3", + "@biomejs/cli-linux-arm64-musl": "1.5.3", + "@biomejs/cli-linux-x64": "1.5.3", + "@biomejs/cli-linux-x64-musl": "1.5.3", + "@biomejs/cli-win32-arm64": "1.5.3", + "@biomejs/cli-win32-x64": "1.5.3" + } + }, + "node_modules/@biomejs/cli-darwin-arm64": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-1.5.3.tgz", + "integrity": "sha512-ImU7mh1HghEDyqNmxEZBoMPr8SxekkZuYcs+gynKlNW+TALQs7swkERiBLkG9NR0K1B3/2uVzlvYowXrmlW8hw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=14.*" + } + }, + "node_modules/@biomejs/cli-darwin-x64": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-1.5.3.tgz", + "integrity": "sha512-vCdASqYnlpq/swErH7FD6nrFz0czFtK4k/iLgj0/+VmZVjineFPgevOb+Sr9vz0tk0GfdQO60bSpI74zU8M9Dw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=14.*" + } + }, + "node_modules/@biomejs/cli-linux-arm64": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-1.5.3.tgz", + "integrity": "sha512-cupBQv0sNF1OKqBfx7EDWMSsKwRrBUZfjXawT4s6hKV6ALq7p0QzWlxr/sDmbKMLOaLQtw2Qgu/77N9rm+f9Rg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.*" + } + }, + "node_modules/@biomejs/cli-linux-arm64-musl": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-1.5.3.tgz", + "integrity": "sha512-DYuMizUYUBYfS0IHGjDrOP1RGipqWfMGEvNEJ398zdtmCKLXaUvTimiox5dvx4X15mBK5M2m8wgWUgOP1giUpQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.*" + } + }, + "node_modules/@biomejs/cli-linux-x64": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-1.5.3.tgz", + "integrity": "sha512-YQrSArQvcv4FYsk7Q91Yv4uuu5F8hJyORVcv3zsjCLGkjIjx2RhjYLpTL733SNL7v33GmOlZY0eFR1ko38tuUw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.*" + } + }, + "node_modules/@biomejs/cli-linux-x64-musl": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-1.5.3.tgz", + "integrity": "sha512-UUHiAnlDqr2Y/LpvshBFhUYMWkl2/Jn+bi3U6jKuav0qWbbBKU/ByHgR4+NBxpKBYoCtWxhnmatfH1bpPIuZMw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.*" + } + }, + "node_modules/@biomejs/cli-win32-arm64": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-1.5.3.tgz", + "integrity": "sha512-HxatYH7vf/kX9nrD+pDYuV2GI9GV8EFo6cfKkahAecTuZLPxryHx1WEfJthp5eNsE0+09STGkKIKjirP0ufaZA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=14.*" + } + }, + "node_modules/@biomejs/cli-win32-x64": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-1.5.3.tgz", + "integrity": "sha512-fMvbSouZEASU7mZH8SIJSANDm5OqsjgtVXlbUqxwed6BP7uuHRSs396Aqwh2+VoW8fwTpp6ybIUoC9FrzB0kyA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=14.*" + } + }, "node_modules/@discoveryjs/json-ext": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz", @@ -12830,21 +12985,6 @@ "node": ">= 0.8.0" } }, - "node_modules/prettier": { - "version": "2.8.8", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", - "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", - "dev": true, - "bin": { - "prettier": "bin-prettier.js" - }, - "engines": { - "node": ">=10.13.0" - }, - "funding": { - "url": "https://github.com/prettier/prettier?sponsor=1" - } - }, "node_modules/pretty-format": { "version": "27.5.1", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz", @@ -16840,6 +16980,78 @@ "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", "dev": true }, + "@biomejs/biome": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-1.5.3.tgz", + "integrity": "sha512-yvZCa/g3akwTaAQ7PCwPWDCkZs3Qa5ONg/fgOUT9e6wAWsPftCjLQFPXBeGxPK30yZSSpgEmRCfpGTmVbUjGgg==", + "dev": true, + "requires": { + "@biomejs/cli-darwin-arm64": "1.5.3", + "@biomejs/cli-darwin-x64": "1.5.3", + "@biomejs/cli-linux-arm64": "1.5.3", + "@biomejs/cli-linux-arm64-musl": "1.5.3", + "@biomejs/cli-linux-x64": "1.5.3", + "@biomejs/cli-linux-x64-musl": "1.5.3", + "@biomejs/cli-win32-arm64": "1.5.3", + "@biomejs/cli-win32-x64": "1.5.3" + } + }, + "@biomejs/cli-darwin-arm64": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-1.5.3.tgz", + "integrity": "sha512-ImU7mh1HghEDyqNmxEZBoMPr8SxekkZuYcs+gynKlNW+TALQs7swkERiBLkG9NR0K1B3/2uVzlvYowXrmlW8hw==", + "dev": true, + "optional": true + }, + "@biomejs/cli-darwin-x64": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-1.5.3.tgz", + "integrity": "sha512-vCdASqYnlpq/swErH7FD6nrFz0czFtK4k/iLgj0/+VmZVjineFPgevOb+Sr9vz0tk0GfdQO60bSpI74zU8M9Dw==", + "dev": true, + "optional": true + }, + "@biomejs/cli-linux-arm64": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-1.5.3.tgz", + "integrity": "sha512-cupBQv0sNF1OKqBfx7EDWMSsKwRrBUZfjXawT4s6hKV6ALq7p0QzWlxr/sDmbKMLOaLQtw2Qgu/77N9rm+f9Rg==", + "dev": true, + "optional": true + }, + "@biomejs/cli-linux-arm64-musl": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-1.5.3.tgz", + "integrity": "sha512-DYuMizUYUBYfS0IHGjDrOP1RGipqWfMGEvNEJ398zdtmCKLXaUvTimiox5dvx4X15mBK5M2m8wgWUgOP1giUpQ==", + "dev": true, + "optional": true + }, + "@biomejs/cli-linux-x64": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-1.5.3.tgz", + "integrity": "sha512-YQrSArQvcv4FYsk7Q91Yv4uuu5F8hJyORVcv3zsjCLGkjIjx2RhjYLpTL733SNL7v33GmOlZY0eFR1ko38tuUw==", + "dev": true, + "optional": true + }, + "@biomejs/cli-linux-x64-musl": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-1.5.3.tgz", + "integrity": "sha512-UUHiAnlDqr2Y/LpvshBFhUYMWkl2/Jn+bi3U6jKuav0qWbbBKU/ByHgR4+NBxpKBYoCtWxhnmatfH1bpPIuZMw==", + "dev": true, + "optional": true + }, + "@biomejs/cli-win32-arm64": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-1.5.3.tgz", + "integrity": "sha512-HxatYH7vf/kX9nrD+pDYuV2GI9GV8EFo6cfKkahAecTuZLPxryHx1WEfJthp5eNsE0+09STGkKIKjirP0ufaZA==", + "dev": true, + "optional": true + }, + "@biomejs/cli-win32-x64": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-1.5.3.tgz", + "integrity": "sha512-fMvbSouZEASU7mZH8SIJSANDm5OqsjgtVXlbUqxwed6BP7uuHRSs396Aqwh2+VoW8fwTpp6ybIUoC9FrzB0kyA==", + "dev": true, + "optional": true + }, "@discoveryjs/json-ext": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz", @@ -24733,12 +24945,6 @@ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true }, - "prettier": { - "version": "2.8.8", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", - "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", - "dev": true - }, "pretty-format": { "version": "27.5.1", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz", diff --git a/package.json b/package.json index cfed3c3b..08bd980d 100644 --- a/package.json +++ b/package.json @@ -5,10 +5,10 @@ "description": "Dashboard for Optuna", "main": "index.js", "scripts": { - "fmt": "prettier --write \"{optuna_dashboard/ts,typescript_tests,standalone_app/src,vscode/src}/**/*.{ts,tsx}\"", + "fmt": "biome format --write .", "lint": "npm run lint:eslint && npm run lint:fmt", "lint:eslint": "eslint . --ext .ts,.tsx --max-warnings 0", - "lint:fmt": "prettier --list-different \"{optuna_dashboard/ts,typescript_tests,standalone_app/src,vscode/src}/**/*.{ts,tsx}\"", + "lint:fmt": "biome format .", "watch": "NODE_ENV=development TYPESCRIPT_LOADER=esbuild-loader webpack --watch", "build": "webpack", "build:dev": "NODE_ENV=development TYPESCRIPT_LOADER=esbuild-loader webpack", @@ -47,6 +47,7 @@ "devDependencies": { "@babel/core": "^7.23.9", "@babel/preset-env": "^7.23.9", + "@biomejs/biome": "1.5.3", "@testing-library/react": "^14.1.2", "@types/jest": "^29.5.11", "@types/plotly.js": "^2.12.32", @@ -62,7 +63,6 @@ "jest": "^29.7.0", "jest-canvas-mock": "^2.5.2", "jest-environment-jsdom": "^29.7.0", - "prettier": "^2.5.1", "style-loader": "^3.3.4", "ts-jest": "^29.1.2", "ts-loader": "^9.5.1", diff --git a/standalone_app/src/components/DataGrid.tsx b/standalone_app/src/components/DataGrid.tsx index 2855f1f7..ec70e294 100644 --- a/standalone_app/src/components/DataGrid.tsx +++ b/standalone_app/src/components/DataGrid.tsx @@ -65,8 +65,8 @@ function DataGrid(props: { initialRowsPerPage = initialRowsPerPage // use first element as default ? initialRowsPerPage : isNumber(rowsPerPageOption[0]) - ? rowsPerPageOption[0] - : rowsPerPageOption[0].value + ? rowsPerPageOption[0] + : rowsPerPageOption[0].value const [rowsPerPage, setRowsPerPage] = React.useState(initialRowsPerPage) const handleChangePage = (event: unknown, newPage: number) => { diff --git a/standalone_app/src/components/PlotHistory.tsx b/standalone_app/src/components/PlotHistory.tsx index 0b421e5a..24f90034 100644 --- a/standalone_app/src/components/PlotHistory.tsx +++ b/standalone_app/src/components/PlotHistory.tsx @@ -231,8 +231,8 @@ const plotHistory = ( return xAxis === "number" ? trial.number : xAxis === "datetime_start" - ? trial.datetime_start ?? new Date() - : trial.datetime_complete ?? new Date() + ? trial.datetime_start ?? new Date() + : trial.datetime_complete ?? new Date() } const getValue = (trial: Trial, objectiveId: number): number | null => { diff --git a/standalone_app/src/sqlite3.ts b/standalone_app/src/sqlite3.ts index d01a7e52..a0bf018b 100644 --- a/standalone_app/src/sqlite3.ts +++ b/standalone_app/src/sqlite3.ts @@ -174,12 +174,12 @@ const getTrials = ( vals[2] === "COMPLETE" ? "Complete" : vals[2] === "PRUNED" - ? "Pruned" - : vals[2] === "RUNNING" - ? "Running" - : vals[2] === "WAITING" - ? "Waiting" - : "Fail" + ? "Pruned" + : vals[2] === "RUNNING" + ? "Running" + : vals[2] === "WAITING" + ? "Waiting" + : "Fail" const trial: Trial = { trial_id: trialId, number: vals[1], @@ -220,8 +220,8 @@ const getTrialValues = ( vals[1] === "INF_NEG" ? "-inf" : vals[1] === "INF_POS" - ? "+inf" - : vals[0] + ? "+inf" + : vals[0] ) }, }) @@ -391,10 +391,10 @@ const getTrialIntermediateValues = ( vals[2] === "INF_NEG" ? "-inf" : vals[2] === "INF_POS" - ? "+inf" - : vals[2] === "NAN" - ? "nan" - : vals[1], + ? "+inf" + : vals[2] === "NAN" + ? "nan" + : vals[1], }) }, })