Skip to content

Commit c44334a

Browse files
authored
Website: Formatter for .tsx in website-nextjs (#137)
Partial of #120
1 parent 4704559 commit c44334a

File tree

88 files changed

+1796
-1763
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+1796
-1763
lines changed

.pre-commit-config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,11 @@ repos:
1717
types_or: [python, pyi, jupyter]
1818
args: [--fix, --exit-non-zero-on-fix]
1919
- id: ruff-format
20+
21+
- repo: https://github.com/pre-commit/mirrors-prettier
22+
rev: v3.1.0
23+
hooks:
24+
- id: prettier
25+
types_or: [javascript, jsx, ts, tsx]
26+
additional_dependencies:
27+
- prettier@3.1.0

website-nextjs/next.config.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
import type { NextConfig } from "next"
1+
import type { NextConfig } from "next";
22

33
const nextConfig: NextConfig = {
44
reactStrictMode: true,
55
webpack(config) {
66
// Grab the existing rule that handles SVG imports
7-
const fileLoaderRule = config.module.rules.find((rule: { test: { test: (arg0: string) => unknown } }) =>
8-
rule.test?.test?.(".svg")
9-
)
7+
const fileLoaderRule = config.module.rules.find(
8+
(rule: { test: { test: (arg0: string) => unknown } }) =>
9+
rule.test?.test?.(".svg"),
10+
);
1011

1112
config.module.rules.push(
1213
// Reapply the existing rule, but only for svg imports ending in ?url
@@ -45,14 +46,14 @@ const nextConfig: NextConfig = {
4546
},
4647
},
4748
],
48-
}
49-
)
49+
},
50+
);
5051

5152
// Modify the file loader rule to ignore *.svg, since we have it handled now.
52-
fileLoaderRule.exclude = /\.svg$/i
53+
fileLoaderRule.exclude = /\.svg$/i;
5354

54-
return config
55+
return config;
5556
},
56-
}
57+
};
5758

58-
export default nextConfig
59+
export default nextConfig;
Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
1-
export { default as AlignLeftJustifyIcon } from "./align-left-justify.svg"
2-
export { default as AppIcon } from "./app.svg"
3-
export { default as ArrowIcon } from "./arrow.svg"
4-
export { default as ArrowUpIcon } from "./arrow-up.svg"
5-
export { default as ArrowUpLeftIcon } from "./arrow-up-left.svg"
6-
export { default as ArrowToRightIcon } from "./arrow-to-right.svg"
7-
export { default as ArrowRightIcon } from "./arrow-right.svg"
8-
export { default as BalanceScaleIcon } from "./balance-scale.svg"
9-
export { default as BrightIcon } from "./bright.svg"
10-
export { default as ChartBarIcon } from "./chart-bar.svg"
11-
export { default as ChartLineIcon } from "./chart-line.svg"
12-
export { default as CircleOutlineIcon } from "./circle-outline.svg"
13-
export { default as CircleIcon } from "./circle.svg"
14-
export { default as CloseIcon } from "./close.svg"
15-
export { default as DatabaseIcon } from "./database.svg"
16-
export { default as FilterIcon } from "./filter.svg"
17-
export { default as ForkIcon } from "./fork-icon.svg"
18-
export { default as GraphBarIcon } from "./graph-bar.svg"
19-
export { default as GithubIcon } from "./github.svg"
20-
export { default as HistoryIcon } from "./history.svg"
21-
export { default as HomeIcon } from "./home.svg"
22-
export { default as LampOnIcon } from "./lamp-on.svg"
23-
export { default as LayoutGroupIcon } from "./layout-group.svg"
24-
export { default as MainIcon } from "./main.svg"
25-
export { default as OetLogo } from "./oet-logo.svg"
26-
export { default as MenuIcon } from "./menu.svg"
27-
export { default as PlusIcon } from "./plus.svg"
28-
export { default as PolygonIcon } from "./polygon.svg"
29-
export { default as ProcessorIcon } from "./processor.svg"
30-
export { default as PreviousIcon } from "./previous.svg"
31-
export { default as StarIcon } from "./star.svg"
32-
export { default as UserIcon } from "./user.svg"
33-
export { default as UsersAltIcon } from "./users-alt.svg"
34-
export { default as VectorSquareIcon } from "./vector-square.svg"
35-
export { default as WindowIcon } from "./window.svg"
36-
export { default as WrenchIcon } from "./wrench.svg"
37-
export { default as CameraIcon } from "./camera.svg"
38-
export { default as DownloadAltIcon } from "./download-alt.svg"
39-
export { default as QuestionLine } from "./question-line.svg"
40-
export { default as SearchPlusIcon } from "./search-plus.svg"
41-
export { default as SearchMinusIcon } from "./search-minus.svg"
42-
export { default as SortVerticalIcon } from "./sort-vertical.svg"
43-
export { default as ArrowsMoveIcon } from "./arrows-move.svg"
44-
export { default as XIcon } from "./x-icon.svg"
1+
export { default as AlignLeftJustifyIcon } from "./align-left-justify.svg";
2+
export { default as AppIcon } from "./app.svg";
3+
export { default as ArrowIcon } from "./arrow.svg";
4+
export { default as ArrowUpIcon } from "./arrow-up.svg";
5+
export { default as ArrowUpLeftIcon } from "./arrow-up-left.svg";
6+
export { default as ArrowToRightIcon } from "./arrow-to-right.svg";
7+
export { default as ArrowRightIcon } from "./arrow-right.svg";
8+
export { default as BalanceScaleIcon } from "./balance-scale.svg";
9+
export { default as BrightIcon } from "./bright.svg";
10+
export { default as ChartBarIcon } from "./chart-bar.svg";
11+
export { default as ChartLineIcon } from "./chart-line.svg";
12+
export { default as CircleOutlineIcon } from "./circle-outline.svg";
13+
export { default as CircleIcon } from "./circle.svg";
14+
export { default as CloseIcon } from "./close.svg";
15+
export { default as DatabaseIcon } from "./database.svg";
16+
export { default as FilterIcon } from "./filter.svg";
17+
export { default as ForkIcon } from "./fork-icon.svg";
18+
export { default as GraphBarIcon } from "./graph-bar.svg";
19+
export { default as GithubIcon } from "./github.svg";
20+
export { default as HistoryIcon } from "./history.svg";
21+
export { default as HomeIcon } from "./home.svg";
22+
export { default as LampOnIcon } from "./lamp-on.svg";
23+
export { default as LayoutGroupIcon } from "./layout-group.svg";
24+
export { default as MainIcon } from "./main.svg";
25+
export { default as OetLogo } from "./oet-logo.svg";
26+
export { default as MenuIcon } from "./menu.svg";
27+
export { default as PlusIcon } from "./plus.svg";
28+
export { default as PolygonIcon } from "./polygon.svg";
29+
export { default as ProcessorIcon } from "./processor.svg";
30+
export { default as PreviousIcon } from "./previous.svg";
31+
export { default as StarIcon } from "./star.svg";
32+
export { default as UserIcon } from "./user.svg";
33+
export { default as UsersAltIcon } from "./users-alt.svg";
34+
export { default as VectorSquareIcon } from "./vector-square.svg";
35+
export { default as WindowIcon } from "./window.svg";
36+
export { default as WrenchIcon } from "./wrench.svg";
37+
export { default as CameraIcon } from "./camera.svg";
38+
export { default as DownloadAltIcon } from "./download-alt.svg";
39+
export { default as QuestionLine } from "./question-line.svg";
40+
export { default as SearchPlusIcon } from "./search-plus.svg";
41+
export { default as SearchMinusIcon } from "./search-minus.svg";
42+
export { default as SortVerticalIcon } from "./sort-vertical.svg";
43+
export { default as ArrowsMoveIcon } from "./arrows-move.svg";
44+
export { default as XIcon } from "./x-icon.svg";
Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,30 @@
1-
import { useSelector } from "react-redux"
1+
import { useSelector } from "react-redux";
22

3-
import { CircleIcon, CloseIcon } from "@/assets/icons"
4-
import D3Chart from "../shared/D3PlotChart"
5-
import { IFilterState, IResultState } from "@/types/state"
6-
import { useMemo } from "react"
7-
import { SgmMode } from "@/constants/filter"
3+
import { CircleIcon, CloseIcon } from "@/assets/icons";
4+
import D3Chart from "../shared/D3PlotChart";
5+
import { IFilterState, IResultState } from "@/types/state";
6+
import { useMemo } from "react";
7+
import { SgmMode } from "@/constants/filter";
88

99
const BenchmarksSection = () => {
1010
const benchmarkLatestResults = useSelector(
1111
(state: { results: IResultState }) => {
12-
return state.results.benchmarkLatestResults
13-
}
14-
)
12+
return state.results.benchmarkLatestResults;
13+
},
14+
);
1515
const sgmMode = useSelector((state: { filters: IFilterState }) => {
16-
return state.filters.sgmMode
17-
})
16+
return state.filters.sgmMode;
17+
});
1818
const benchmarkResults = useMemo(() => {
1919
switch (sgmMode) {
2020
case SgmMode.ONLY_ON_INTERSECTION_OF_SOLVED_BENCHMARKS:
21-
return benchmarkLatestResults.filter((result) => result.status === "ok")
21+
return benchmarkLatestResults.filter(
22+
(result) => result.status === "ok",
23+
);
2224
default:
23-
return benchmarkLatestResults
25+
return benchmarkLatestResults;
2426
}
25-
}, [sgmMode, benchmarkLatestResults])
27+
}, [sgmMode, benchmarkLatestResults]);
2628

2729
return (
2830
<div className="py-4">
@@ -36,7 +38,7 @@ const BenchmarksSection = () => {
3638
</p>
3739
</div>
3840
</div>
39-
)
40-
}
41+
);
42+
};
4143

42-
export default BenchmarksSection
44+
export default BenchmarksSection;

website-nextjs/src/components/admin/DetailSection.tsx

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useSelector } from "react-redux"
1+
import { useSelector } from "react-redux";
22
// internal
33
import {
44
AppIcon,
@@ -7,42 +7,44 @@ import {
77
HistoryIcon,
88
LayoutGroupIcon,
99
VectorSquareIcon,
10-
} from "@/assets/icons"
11-
import { useMemo } from "react"
12-
import { IResultState } from "@/types/state"
10+
} from "@/assets/icons";
11+
import { useMemo } from "react";
12+
import { IResultState } from "@/types/state";
1313

1414
const DetailSection = () => {
1515
const benchmarkResults = useSelector((state: { results: IResultState }) => {
16-
return state.results.rawBenchmarkResults
17-
})
16+
return state.results.rawBenchmarkResults;
17+
});
1818

1919
const rawMetaData = useSelector((state: { results: IResultState }) => {
20-
return state.results.rawMetaData
21-
})
20+
return state.results.rawMetaData;
21+
});
2222

23-
const availableBenchmarksCount = Object.keys(rawMetaData).length
23+
const availableBenchmarksCount = Object.keys(rawMetaData).length;
2424

2525
const availableSolvers = useSelector((state: { results: IResultState }) => {
26-
return state.results.availableSolvers
27-
})
26+
return state.results.availableSolvers;
27+
});
2828

2929
const avaliableVersion = useMemo(
3030
() =>
3131
Array.from(
32-
new Set(benchmarkResults.map((result) => result.solverVersion))
32+
new Set(benchmarkResults.map((result) => result.solverVersion)),
3333
),
34-
[benchmarkResults]
35-
)
34+
[benchmarkResults],
35+
);
3636

3737
const avaliableInstance = useMemo(
3838
() =>
3939
Array.from(
4040
new Set(
41-
benchmarkResults.map((result) => `${result.benchmark}-${result.size}`)
42-
)
41+
benchmarkResults.map(
42+
(result) => `${result.benchmark}-${result.size}`,
43+
),
44+
),
4345
),
44-
[benchmarkResults]
45-
)
46+
[benchmarkResults],
47+
);
4648

4749
const detailData = [
4850
{
@@ -95,7 +97,7 @@ const DetailSection = () => {
9597
value: "10 min",
9698
icon: <HistoryIcon />,
9799
},
98-
]
100+
];
99101

100102
return (
101103
<div className="bg-white rounded-xl py-4 px-12">
@@ -118,6 +120,6 @@ const DetailSection = () => {
118120
))}
119121
</ul>
120122
</div>
121-
)
122-
}
123-
export default DetailSection
123+
);
124+
};
125+
export default DetailSection;

website-nextjs/src/components/admin/FilterSection.tsx

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,53 +3,53 @@ import {
33
PolygonIcon,
44
ProcessorIcon,
55
WrenchIcon,
6-
} from "@/assets/icons"
7-
import { useSelector, useDispatch } from "react-redux"
8-
import filterAction from "@/redux/filters/actions"
9-
import Popup from "reactjs-popup"
10-
import { IFilterState, IResultState } from "@/types/state"
6+
} from "@/assets/icons";
7+
import { useSelector, useDispatch } from "react-redux";
8+
import filterAction from "@/redux/filters/actions";
9+
import Popup from "reactjs-popup";
10+
import { IFilterState, IResultState } from "@/types/state";
1111

1212
const FilterSection = () => {
1313
// eslint-disable-next-line @typescript-eslint/no-explicit-any
14-
const dispatch = useDispatch<any>()
14+
const dispatch = useDispatch<any>();
1515

1616
const selectedFilters = useSelector(
17-
(state: { filters: IFilterState }) => state.filters
18-
)
17+
(state: { filters: IFilterState }) => state.filters,
18+
);
1919

2020
const availableSectors = useSelector(
21-
(state: { results: IResultState }) => state.results.availableSectors
22-
)
21+
(state: { results: IResultState }) => state.results.availableSectors,
22+
);
2323

2424
const availableTechniques = useSelector(
25-
(state: { results: IResultState }) => state.results.availableTechniques
26-
)
25+
(state: { results: IResultState }) => state.results.availableTechniques,
26+
);
2727

2828
const availableKindOfProblems = useSelector(
29-
(state: { results: IResultState }) => state.results.availableKindOfProblems
30-
)
29+
(state: { results: IResultState }) => state.results.availableKindOfProblems,
30+
);
3131

3232
const availableModels = useSelector(
33-
(state: { results: IResultState }) => state.results.availableModels
34-
)
33+
(state: { results: IResultState }) => state.results.availableModels,
34+
);
3535

3636
const availableProblemSizes = useSelector(
37-
(state: { results: IResultState }) => state.results.availableProblemSizes
38-
)
37+
(state: { results: IResultState }) => state.results.availableProblemSizes,
38+
);
3939

4040
const handleCheckboxChange = ({
4141
category,
4242
value,
4343
only = false,
4444
}: {
45-
category: string
46-
value: string
47-
only?: boolean
45+
category: string;
46+
value: string;
47+
only?: boolean;
4848
}) => {
4949
dispatch(
50-
filterAction.toggleFilterAndUpdateResults({ category, value, only })
51-
)
52-
}
50+
filterAction.toggleFilterAndUpdateResults({ category, value, only }),
51+
);
52+
};
5353

5454
return (
5555
<div className="bg-white rounded-xl my-2">
@@ -340,7 +340,7 @@ const FilterSection = () => {
340340
</div>
341341
</div>
342342
</div>
343-
)
344-
}
343+
);
344+
};
345345

346-
export default FilterSection
346+
export default FilterSection;

website-nextjs/src/components/admin/Navbar.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ const Navbar = () => {
466466
</div>
467467
</aside>
468468
</>
469-
)
470-
}
469+
);
470+
};
471471

472-
export default Navbar
472+
export default Navbar;

0 commit comments

Comments
 (0)