Skip to content

Commit

Permalink
Upgrade Prettier to v3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
axelboc committed Jul 19, 2023
1 parent 7955cd9 commit 3aa38ff
Show file tree
Hide file tree
Showing 141 changed files with 589 additions and 572 deletions.
2 changes: 1 addition & 1 deletion apps/demo/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
4 changes: 2 additions & 2 deletions apps/demo/src/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,13 @@ function Home() {
{index > 0 && ', '}
<Link
to={`h5wasm?url=${encodeURIComponent(
`https://www.silx.org/pub/h5web/${filename}`
`https://www.silx.org/pub/h5web/${filename}`,
)}`}
>
{filename}
</Link>
</Fragment>
)
),
)}
</p>
</section>
Expand Down
2 changes: 1 addition & 1 deletion apps/demo/src/h5wasm/DropZone.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function DropZone(props: Props) {
reader.readAsArrayBuffer(file);
setReadingFile(true);
},
[onH5File]
[onH5File],
);

const { getRootProps, getInputProps, open, isDragActive, fileRejections } =
Expand Down
2 changes: 1 addition & 1 deletion apps/demo/src/h5wasm/UrlForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function UrlForm(props: Props) {

const [{ loading, error }, execute] = useAxios<ArrayBuffer>(
{ url, responseType: 'arraybuffer' },
{ manual: true }
{ manual: true },
);

const fetchFile = useCallback(async () => {
Expand Down
2 changes: 1 addition & 1 deletion apps/demo/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ ReactDOM.render(
<StrictMode>
<DemoApp />
</StrictMode>,
document.querySelector('#root')
document.querySelector('#root'),
);
2 changes: 1 addition & 1 deletion apps/storybook/src/Annotation.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ function PointerTracker(props: {
const { x, y } = evt.dataPt;
setCoords([x, y]);
},
[setCoords]
[setCoords],
);

useCanvasEvents({ onPointerMove });
Expand Down
2 changes: 1 addition & 1 deletion apps/storybook/src/DomainSlider.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const Default = {
const [safeDomain, errors] = useSafeDomain(
visDomain,
dataDomain,
scaleType
scaleType,
);

const [sliderDomain, setSliderDomain] = useState<Domain>(visDomain);
Expand Down
6 changes: 3 additions & 3 deletions apps/storybook/src/HeatmapMesh.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ const uint16Domain: Domain = [10, 40];
const mask = ndarray(
Uint8Array.from(
range(0, 20 * 41).map((val) =>
((val % 41) * Math.floor(val / 41)) % 5 === 0 ? 255 : 0
)
((val % 41) * Math.floor(val / 41)) % 5 === 0 ? 255 : 0,
),
),
[20, 41]
[20, 41],
);

const meta = {
Expand Down
10 changes: 5 additions & 5 deletions apps/storybook/src/HeatmapVis.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const domain = getDomain(dataArray.data);

const alphaArray = ndarray(
dataArray.data.map((x) => Math.abs(x)),
dataArray.shape
dataArray.shape,
);
const alphaDomain = getDomain(alphaArray);
assertDefined(alphaDomain);
Expand Down Expand Up @@ -87,13 +87,13 @@ export const AxisValues = {
abscissaParams: {
value: Array.from(
{ length: dataArray.shape[1] }, // works even when right edge of last pixel is not provided
(_, i) => 100 + 10 * i
(_, i) => 100 + 10 * i,
),
},
ordinateParams: {
value: Array.from(
{ length: dataArray.shape[0] + 1 },
(_, i) => -100 + 10 * i
(_, i) => -100 + 10 * i,
),
},
},
Expand All @@ -104,13 +104,13 @@ export const DescendingAxisValues = {
abscissaParams: {
value: Array.from(
{ length: dataArray.shape[1] }, // works even when right edge of last pixel is not provided
(_, i) => -100 - 10 * i
(_, i) => -100 - 10 * i,
),
},
ordinateParams: {
value: Array.from(
{ length: dataArray.shape[0] + 1 },
(_, i) => -100 - 10 * i
(_, i) => -100 - 10 * i,
),
},
},
Expand Down
2 changes: 1 addition & 1 deletion apps/storybook/src/Html.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export const CustomContainer = {
rendered with a separate <code>Html</code> element and a
portal.
</p>,
portalTarget
portalTarget,
)}
</Html>
)}
Expand Down
4 changes: 2 additions & 2 deletions apps/storybook/src/LineVis.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ const tertiaryArray = ndarray(mockValues.tertiary[0]);

const abscissas = Array.from(
{ length: dataArray.size },
(_, i) => -10 + 0.5 * i
(_, i) => -10 + 0.5 * i,
);
const errorsArray = ndarray(
Array.from({ length: dataArray.size }, (_, i) => Math.abs(10 - 0.5 * i)),
dataArray.shape
dataArray.shape,
);

const meta = {
Expand Down
2 changes: 1 addition & 1 deletion apps/storybook/src/MatrixVis.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import FillHeight from './decorators/FillHeight';

const dataArray = getMockDataArray('/nD_datasets/twoD');
const complexDataArray = getMockDataArray<H5WebComplex>(
'/nD_datasets/twoD_cplx'
'/nD_datasets/twoD_cplx',
);

const formatMatrixValue = format('.3e');
Expand Down
2 changes: 1 addition & 1 deletion apps/storybook/src/SelectionTool.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export const LineWithLengthValidation = {
render: () => {
const [isValid, setValid] = useThrottledState<boolean | undefined>(
undefined,
50
50,
);

return (
Expand Down
2 changes: 1 addition & 1 deletion apps/storybook/src/SurfaceVis.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type { Meta, StoryObj } from '@storybook/react';
import FillHeight from './decorators/FillHeight';

const dataArray = createArrayFromView(
getMockDataArray('/nD_datasets/fourD').pick(0, 0, null, null)
getMockDataArray('/nD_datasets/fourD').pick(0, 0, null, null),
);
const domain = getDomain(dataArray.data);
assertDefined(domain);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ const defaultApi = new MandelbrotTilesApi(
{ width: 1e9, height: 1e9 },
{ width: 128, height: 128 },
[-2, 1],
[-1.5, 1.5]
[-1.5, 1.5],
);
const halfMandelbrotApi = new MandelbrotTilesApi(
{ width: 1e9, height: 5e8 },
{ width: 256, height: 128 },
[-2, 1],
[0, 1.5]
[0, 1.5],
);
const checkerboardApi = new CheckerboardTilesApi(
{ width: 1e9, height: 1e9 },
{ width: 128, height: 128 }
{ width: 128, height: 128 },
);

const meta = {
Expand Down
8 changes: 4 additions & 4 deletions apps/storybook/src/TiledHeatmapMesh/checkerboard-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { areTilesEqual } from './utils';
const getCheckerboardArray = greenlet(
async (length: number, value: number): Promise<Uint8Array> => {
return Uint8Array.from({ length }, () => value);
}
},
);

export class CheckerboardTilesApi extends TilesApi {
Expand All @@ -32,18 +32,18 @@ export class CheckerboardTilesApi extends TilesApi {
const height = clamp(
layerSize.height - offset.y,
0,
this.tileSize.height
this.tileSize.height,
);

const value = Math.abs(
(Math.floor(offset.x / this.tileSize.width) % 2) -
(Math.floor(offset.y / this.tileSize.height) % 2)
(Math.floor(offset.y / this.tileSize.height) % 2),
);

const arr = await getCheckerboardArray(width * height, value);
return ndarray(arr, [height, width]);
},
{ type: 'Map', areEqual: areTilesEqual }
{ type: 'Map', areEqual: areTilesEqual },
);
}

Expand Down
10 changes: 5 additions & 5 deletions apps/storybook/src/TiledHeatmapMesh/mandlebrot-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const mandlebrot = greenlet(
xDomain: Domain,
yDomain: Domain,
width: number,
height: number
height: number,
): Promise<Float32Array> => {
const xRange = xDomain[1] - xDomain[0];
const yRange = yDomain[1] - yDomain[0];
Expand Down Expand Up @@ -53,7 +53,7 @@ const mandlebrot = greenlet(
}

return array;
}
},
);

export class MandelbrotTilesApi extends TilesApi {
Expand All @@ -65,7 +65,7 @@ export class MandelbrotTilesApi extends TilesApi {
size: Size,
tileSize: Size,
xDomain: Domain,
yDomain: Domain
yDomain: Domain,
) {
super(tileSize, getLayerSizes(size, tileSize));
this.xDomain = xDomain;
Expand All @@ -80,7 +80,7 @@ export class MandelbrotTilesApi extends TilesApi {
const height = clamp(
layerSize.height - offset.y,
0,
this.tileSize.height
this.tileSize.height,
);

const xScale = (this.xDomain[1] - this.xDomain[0]) / layerSize.width;
Expand All @@ -97,7 +97,7 @@ export class MandelbrotTilesApi extends TilesApi {
const arr = await mandlebrot(50, xRange, yRange, width, height);
return ndarray(arr, [height, width]);
},
{ type: 'Map', areEqual: areTilesEqual }
{ type: 'Map', areEqual: areTilesEqual },
);
}

Expand Down
4 changes: 2 additions & 2 deletions apps/storybook/src/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ type NestedNumArray = (number | NestedNumArray)[];

export function useMockData(
mockNumArray: NestedNumArray,
shape: ArrayShape = [mockNumArray.length]
shape: ArrayShape = [mockNumArray.length],
): { values: NdArray<Float32Array>; domain: Domain } {
const values = useMemo(
() => ndarray(Float32Array.from(mockNumArray.flat() as number[]), shape),
[mockNumArray, shape]
[mockNumArray, shape],
);

const domain = useDomain(values) || [1, 2];
Expand Down
2 changes: 1 addition & 1 deletion apps/storybook/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function getTitleForSelection(selection: Rect | undefined) {

const [start, end] = selection;
return `Selection from (${formatCoord(start.x)}, ${formatCoord(
start.y
start.y,
)}) to (${formatCoord(end.x)}, ${formatCoord(end.y)})`;
}

Expand Down
Loading

0 comments on commit 3aa38ff

Please sign in to comment.