Fix lint errors

This commit is contained in:
c-bata
2023-05-22 21:17:30 +09:00
parent f98ddc9784
commit 3ff8b1344e
5 changed files with 19 additions and 13 deletions
+1 -1
View File
@@ -8,7 +8,7 @@
"fmt": "prettier --write \"optuna_dashboard/ts/**/*.{ts,tsx}\" \"typescript_tests/**/*.{ts,tsx}\" \"standalone_app/src/**/*.{ts,tsx}\"",
"lint": "npm run lint:eslint && npm run lint:fmt",
"lint:eslint": "eslint . --ext .ts,.tsx",
"lint:fmt": "prettier --list-different \"optuna_dashboard/ts/**/*.{ts,tsx}\" \"typescript_tests/*.{ts,tsx}\" \"standalone_app/*.{ts,tsx}\"",
"lint:fmt": "prettier --list-different \"optuna_dashboard/ts/**/*.{ts,tsx}\" \"typescript_tests/**/*.{ts,tsx}\" \"standalone_app/src/**/*.{ts,tsx}\"",
"watch": "NODE_ENV=development TYPESCRIPT_LOADER=esbuild-loader webpack --watch",
"build": "webpack",
"build:dev": "NODE_ENV=development TYPESCRIPT_LOADER=esbuild-loader webpack",
@@ -19,7 +19,7 @@ export const PlotImportance: FC<{ study: Study }> = ({ study }) => {
await init()
const x: ParamImportance[][] = study.directions.map((d, objectiveId) => {
let filteredTrials = study.trials.filter((t) =>
const filteredTrials = study.trials.filter((t) =>
filterFunc(t, objectiveId)
)
if (filteredTrials.length === 0) {
@@ -18,7 +18,7 @@ import {
} from "@mui/material"
import UploadFileIcon from "@mui/icons-material/UploadFile"
export const StorageLoader: FC<{}> = () => {
export const StorageLoader: FC = () => {
const theme = useTheme()
const [dragOver, setDragOver] = useState<boolean>(false)
+4 -4
View File
@@ -43,7 +43,7 @@ export const loadStorage = (
}
// Get studies
let studies: Study[] = []
const studies: Study[] = []
db.exec({
sql:
"SELECT s.study_id, s.study_name, sd.direction, sd.objective" +
@@ -86,11 +86,11 @@ export const loadStorage = (
const state: TrialState =
vals[3] === "COMPLETE"
? "Complete"
: "PRUNED"
: vals[3] === "PRUNED"
? "Pruned"
: "RUNNING"
: vals[3] === "RUNNING"
? "Running"
: "WAITING"
: vals[3] === "WAITING"
? "Waiting"
: "Fail"
const trial: Trial = {
+12 -6
View File
@@ -10,7 +10,7 @@ export const AppWrapper: FC = () => {
const setStudies = useSetRecoilState<Study[]>(studiesState)
const onceSetStudies: SetterOrUpdater<Study[]> = (
setter: ((currVal: Study) => Study) | Study
setter: (currVal: Study[]) => Study[]
): void => {
const studies = setter([])
setStudies(studies)
@@ -19,16 +19,22 @@ export const AppWrapper: FC = () => {
useEffect(() => {
window.addEventListener("message", (event) => {
const message = event.data
let fileContentBase64: string
let binaryString: string
let len: number
let bytes: Uint8Array
let arrayBuffer: ArrayBuffer
switch (message.type) {
case "optunaStorage":
const fileContentBase64 = message.content
const binaryString = atob(fileContentBase64)
const len = binaryString.length
const bytes = new Uint8Array(len)
fileContentBase64 = message.content
binaryString = atob(fileContentBase64)
len = binaryString.length
bytes = new Uint8Array(len)
for (let i = 0; i < len; i++) {
bytes[i] = binaryString.charCodeAt(i)
}
const arrayBuffer = bytes.buffer
arrayBuffer = bytes.buffer
loadStorage(arrayBuffer, onceSetStudies)
break
}