Skip to content

Commit 4f286f5

Browse files
Auto fix: Prettier & ESLint
1 parent 9d605ea commit 4f286f5

File tree

13 files changed

+5408
-36
lines changed

13 files changed

+5408
-36
lines changed

eslint.config.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ export default tseslint.config(
1919
},
2020
rules: {
2121
...reactHooks.configs.recommended.rules,
22-
"react-refresh/only-export-components": ["warn", { allowConstantExport: true }],
22+
"react-refresh/only-export-components": [
23+
"warn",
24+
{ allowConstantExport: true },
25+
],
2326
"@typescript-eslint/no-unused-vars": [
2427
"error",
2528
{
@@ -33,5 +36,5 @@ export default tseslint.config(
3336
},
3437
],
3538
},
36-
}
39+
},
3740
);

src/blueapi/blueapi.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,20 @@ export function useBlueApiCall(
3030
method?: string,
3131
body?: object,
3232
pollRateMillis?: number,
33-
queryKey?: string
33+
queryKey?: string,
3434
) {
3535
return useQuery(
3636
queryKey ?? "BlueApiCall",
3737
async () => await blueApiCall(endpoint, method, body),
3838
{
3939
refetchInterval: pollRateMillis ?? 500,
40-
}
40+
},
4141
);
4242
}
4343

4444
export function processUseBlueApiCall(
4545
request: UseQueryResult<Response, unknown>,
46-
onSuccess: (data: Response) => string
46+
onSuccess: (data: Response) => string,
4747
) {
4848
if (request.status === "error") {
4949
return "Error fetching query!";
@@ -62,7 +62,7 @@ export function getWorkerStatus(): Promise<BlueApiWorkerState> {
6262

6363
export function submitPlan(
6464
planName: string,
65-
planParams: object
65+
planParams: object,
6666
): Promise<string> {
6767
return blueApiCall("/tasks", "POST", {
6868
name: planName,
@@ -72,14 +72,14 @@ export function submitPlan(
7272

7373
export function submitAndRunPlanImmediately(
7474
planName: string,
75-
planParams: object
75+
planParams: object,
7676
): Promise<string> {
7777
return submitPlan(planName, planParams).then((res) =>
7878
// TODO make sure submitPlan was succesful before then putting it to the worker
7979
// See https://github.com/DiamondLightSource/mx-daq-ui/issues/17
8080
blueApiCall("/worker/task", "PUT", { task_id: res }).then((res) =>
81-
res.json().then((res) => res["task_id"])
82-
)
81+
res.json().then((res) => res["task_id"]),
82+
),
8383
);
8484
}
8585

src/components/CollectionComponents.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ function OxfordMapSelection({
234234

235235
const handleBlocks = (
236236
_event: React.MouseEvent<HTMLElement>,
237-
newBlocks: number[]
237+
newBlocks: number[],
238238
) => {
239239
setChipMap(newBlocks);
240240
};

src/components/CoordNumberInput.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import React from "react";
88

99
export const CoordNumberInput = React.forwardRef(function CustomNumberInput(
1010
props: NumberInputProps,
11-
ref: React.ForwardedRef<HTMLDivElement>
11+
ref: React.ForwardedRef<HTMLDivElement>,
1212
) {
1313
return (
1414
<NumberInput
@@ -87,7 +87,7 @@ const StyledInputRoot = styled("div")(
8787
&:focus-visible {
8888
outline: 0;
8989
}
90-
`
90+
`,
9191
);
9292

9393
const StyledInputElement = styled("input")(
@@ -104,7 +104,7 @@ const StyledInputElement = styled("input")(
104104
border-radius: inherit;
105105
padding: 8px 12px;
106106
outline: 0;
107-
`
107+
`,
108108
);
109109

110110
const StyledButton = styled("button")(
@@ -178,5 +178,5 @@ const StyledButton = styled("button")(
178178
& .arrow {
179179
transform: translateY(-1px);
180180
}
181-
`
181+
`,
182182
);

src/components/OavVideoStream.tsx

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
import { Box } from "@mui/material";
2-
import { PvComponent, PvItem, PvDescription, useParsedPvConnection } from "../pv/PvComponent";
2+
import {
3+
PvComponent,
4+
PvItem,
5+
PvDescription,
6+
useParsedPvConnection,
7+
} from "../pv/PvComponent";
38
import { parseNumericPv, pvIntArrayToString } from "../pv/util";
49
import React from "react";
510

6-
export const useContainerDimensions = (ref: React.MutableRefObject<HTMLHeadingElement | null>) => {
11+
export const useContainerDimensions = (
12+
ref: React.MutableRefObject<HTMLHeadingElement | null>,
13+
) => {
714
const [dimensions, setDimensions] = React.useState({ width: 0, height: 0 });
815
React.useEffect(() => {
916
const getDimensions = () => ({
@@ -34,7 +41,7 @@ export function OavVideoStream(
3441
crosshairX: number;
3542
crosshairY: number;
3643
onCoordClick: (x: number, y: number) => void; // handler for clicking on the OAV: x and y are the pixels on the original OAV stream
37-
}
44+
},
3845
) {
3946
const [crosshairX, crosshairY] = [props.crosshairX, props.crosshairY];
4047
const onCoordClick = props.onCoordClick;
@@ -45,14 +52,14 @@ export function OavVideoStream(
4552
pv: props.pv + "MJPG:ArraySize1_RBV",
4653
label: "OAV MJPG stream x size",
4754
transformValue: parseNumericPv,
48-
})
55+
}),
4956
);
5057
const yDim = Number(
5158
useParsedPvConnection({
5259
pv: props.pv + "MJPG:ArraySize2_RBV",
5360
label: "OAV MJPG stream x size",
5461
transformValue: parseNumericPv,
55-
})
62+
}),
5663
);
5764
console.log(`original stream size ${[xDim, yDim]}`);
5865
const [streamUrl, setStreamUrl] = React.useState<string>("not connected");
@@ -62,7 +69,10 @@ export function OavVideoStream(
6269
label: props.label,
6370
render: (props: PvItem) => {
6471
const value = props.value ? props.value : "undefined";
65-
if (!streamUrl.startsWith("http") && value.toString().startsWith("http")) {
72+
if (
73+
!streamUrl.startsWith("http") &&
74+
value.toString().startsWith("http")
75+
) {
6676
setStreamUrl(value.toString());
6777
}
6878
return (
@@ -85,15 +95,15 @@ export function OavVideoStream(
8595
function drawCanvas(
8696
canvasRef: React.MutableRefObject<HTMLCanvasElement | null>,
8797
crosshairX: number,
88-
crosshairY: number
98+
crosshairY: number,
8999
) {
90100
const context = canvasRef.current?.getContext("2d");
91101
if (context) {
92102
context.clearRect(
93103
0,
94104
0,
95105
canvasRef.current?.width as number,
96-
canvasRef.current?.height as number
106+
canvasRef.current?.height as number,
97107
);
98108
context.strokeStyle = "red";
99109
context.font = "50px sans-serif";
@@ -148,8 +158,12 @@ function VideoBoxWithOverlay(props: {
148158
// x and y relative to the crosshair
149159
const [relX, relY] = [x - props.crosshairX, y - props.crosshairY];
150160
// fraction of the image in x/y * original dimension in pixels
151-
const scaledX = props.originalDims ? (relX / width) * props.originalDims.width : x;
152-
const scaledY = props.originalDims ? (relY / height) * props.originalDims.height : y;
161+
const scaledX = props.originalDims
162+
? (relX / width) * props.originalDims.width
163+
: x;
164+
const scaledY = props.originalDims
165+
? (relY / height) * props.originalDims.height
166+
: y;
153167
props.onCoordClick(scaledX, scaledY);
154168
}
155169
}

src/components/SelectionControl.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export function SelectionWithPlanRunner(props: SelectionProps) {
1919
pv: props.pv,
2020
label: props.label,
2121
transformValue: forceString,
22-
})
22+
}),
2323
);
2424
console.log(`${props.id} current value: ${currentValue}`);
2525
const [_, updateVal] = React.useState<string>(currentValue.toString());

src/components/params.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export type EavaRequest = {
3232
export function calculateEAVA(
3333
laserDwell: number,
3434
expTime: number,
35-
factor: number
35+
factor: number,
3636
): number {
3737
const movetime: number = 0.008;
3838
const windowsPerRow: number = 20;

src/main.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ createRoot(document.getElementById("root")!).render(
2323
</QueryClientProvider>
2424
</Provider>
2525
</ThemeProvider>
26-
</StrictMode>
26+
</StrictMode>,
2727
);

src/pv/PvComponent.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@ export type PvComponentProps = PvDescription & {
1818
};
1919

2020
export function useParsedPvConnection(
21-
props: PvDescription & { transformValue?: Transformer }
21+
props: PvDescription & { transformValue?: Transformer },
2222
) {
2323
const [_effectivePvName, connected, _readonly, latestValue] = useConnection(
2424
props.label,
25-
props.pv
25+
props.pv,
2626
);
2727
const rawValue: RawValue = connected ? latestValue : "not connected";
2828
const returnValue = props.transformValue
2929
? props.transformValue(rawValue)
3030
: rawValue;
3131
console.log(
32-
`fetched parsed value ${returnValue} for PV: ${props.pv} labeled ${props.label}`
32+
`fetched parsed value ${returnValue} for PV: ${props.pv} labeled ${props.label}`,
3333
);
3434
return returnValue;
3535
}

src/pv/util.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export function forceString(value: RawValue | string | number): string {
2020
export function parseNumericPv(
2121
value: string | number | DType | undefined,
2222
decimals?: number,
23-
scaleFactor?: number
23+
scaleFactor?: number,
2424
) {
2525
const decimalsToUse = decimals ? decimals : 2;
2626
const scaleFactorToUse = scaleFactor ? scaleFactor : 1;

0 commit comments

Comments
 (0)