From 839a34c7fad4905d67632e3c500437f46217ed48 Mon Sep 17 00:00:00 2001 From: Christopher Dollard Date: Sat, 6 Jul 2024 16:58:35 -0400 Subject: [PATCH] run prettier (#26) --- src/core/architects/utils/script.test.ts | 24 +++++++------ .../transformers/03_plastic/02_strataform.ts | 2 +- .../03_plastic/03_strataflux/edges.ts | 7 ++-- .../03_plastic/03_strataflux/index.ts | 8 +++-- src/webui/components/context_editor/index.tsx | 36 +++++++------------ src/webui/components/map_preview/height.tsx | 29 ++++++++------- 6 files changed, 54 insertions(+), 52 deletions(-) diff --git a/src/core/architects/utils/script.test.ts b/src/core/architects/utils/script.test.ts index 90f15fd..1840f17 100644 --- a/src/core/architects/utils/script.test.ts +++ b/src/core/architects/utils/script.test.ts @@ -1,16 +1,20 @@ import { escapeString } from "./script"; -describe('escapeString', () => { - it('handles the empty string', () => { - expect(escapeString('')).toBe(''); +describe("escapeString", () => { + it("handles the empty string", () => { + expect(escapeString("")).toBe(""); }); - it('handles a normal string', () => { - expect(escapeString('A landslide has occurred!')).toBe('A landslide has occurred!'); + it("handles a normal string", () => { + expect(escapeString("A landslide has occurred!")).toBe( + "A landslide has occurred!", + ); }); - it('escapes quotes', () => { - expect(escapeString('An "Energy Crystal" has been found!')).toBe('An \\"Energy Crystal\\" has been found!'); + it("escapes quotes", () => { + expect(escapeString('An "Energy Crystal" has been found!')).toBe( + 'An \\"Energy Crystal\\" has been found!', + ); }); - it('removes backslashes', () => { - expect(escapeString('\\n\\n\\n\\')).toBe('nnn'); + it("removes backslashes", () => { + expect(escapeString("\\n\\n\\n\\")).toBe("nnn"); }); -}); \ No newline at end of file +}); diff --git a/src/core/transformers/03_plastic/02_strataform.ts b/src/core/transformers/03_plastic/02_strataform.ts index d606d56..c20a090 100644 --- a/src/core/transformers/03_plastic/02_strataform.ts +++ b/src/core/transformers/03_plastic/02_strataform.ts @@ -99,7 +99,7 @@ function spread(cavern: DiscoveredCavern, height: Grid) { const result = new MutableGrid(); for (let x = cavern.left + 1; x < cavern.right; x++) { for (let y = cavern.top + 1; y < cavern.bottom; y++) { - const ht = height.get(x, y) + const ht = height.get(x, y); if (ht) { result.set(x, y, ht); } else { diff --git a/src/core/transformers/03_plastic/03_strataflux/edges.ts b/src/core/transformers/03_plastic/03_strataflux/edges.ts index 537654c..1a613a6 100644 --- a/src/core/transformers/03_plastic/03_strataflux/edges.ts +++ b/src/core/transformers/03_plastic/03_strataflux/edges.ts @@ -141,8 +141,11 @@ function getTileSlopes(cavern: StrataformedCavern): Grid { slope, cavern.pearlInnerDex .get(x, y) - ?.reduce((r: number | undefined, _, i) => Math.min(r ?? Infinity, maxSlopeForPlan[i]), undefined) ?? - planlessSlope + ?.reduce( + (r: number | undefined, _, i) => + Math.min(r ?? Infinity, maxSlopeForPlan[i]), + undefined, + ) ?? planlessSlope, ); result.set(x, y, slope); } diff --git a/src/core/transformers/03_plastic/03_strataflux/index.ts b/src/core/transformers/03_plastic/03_strataflux/index.ts index 039e2f7..d70e926 100644 --- a/src/core/transformers/03_plastic/03_strataflux/index.ts +++ b/src/core/transformers/03_plastic/03_strataflux/index.ts @@ -31,7 +31,11 @@ function superflat(cavern: StrataformedCavern): Grid { return result; } -function getRandomHeight(node: HeightNode, rng: PseudorandomStream, strataplanity: number): number { +function getRandomHeight( + node: HeightNode, + rng: PseudorandomStream, + strataplanity: number, +): number { if (node.min === node.max) { return node.min; } @@ -83,7 +87,7 @@ export default function strataflux( } } return collapseQueue.splice(r, 1)[0]; - } + }; // Collapsing a node means picking a specific height in range for that node. const collapse = () => { diff --git a/src/webui/components/context_editor/index.tsx b/src/webui/components/context_editor/index.tsx index fe5bf03..8a87016 100644 --- a/src/webui/components/context_editor/index.tsx +++ b/src/webui/components/context_editor/index.tsx @@ -280,33 +280,21 @@ export function CavernContextInput({ step={5} {...rest} /> - +

Strataflux

- - {(["caveMaxSlope", "hallMaxSlope", "voidMaxSlope", "borderMaxSlope"] as const).map( - (of) => ( - - ), - )} + + {( + [ + "caveMaxSlope", + "hallMaxSlope", + "voidMaxSlope", + "borderMaxSlope", + ] as const + ).map((of) => ( + + ))}

Populate

diff --git a/src/webui/components/map_preview/height.tsx b/src/webui/components/map_preview/height.tsx index 341c9ff..8009d55 100644 --- a/src/webui/components/map_preview/height.tsx +++ b/src/webui/components/map_preview/height.tsx @@ -1,21 +1,24 @@ import React from "react"; import { Grid } from "../../../core/common/grid"; import styles from "./style.module.scss"; -import { HEIGHT_MAX, HEIGHT_MIN } from "../../../core/transformers/03_plastic/03_strataflux/base"; +import { + HEIGHT_MAX, + HEIGHT_MIN, +} from "../../../core/transformers/03_plastic/03_strataflux/base"; const SCALE = 6; const OCTAGON = [ - 'M0.5,0.125', - 'L0.125,0.5', - 'L-0.125,0.5', - 'L-0.5,0.125', - 'L-0.5,-0.125', - 'L-0.125,-0.5', - 'L0.125,-0.5', - 'L0.5, -0.125', - 'Z', -].join(' ') + "M0.5,0.125", + "L0.125,0.5", + "L-0.125,0.5", + "L-0.5,0.125", + "L-0.5,-0.125", + "L-0.125,-0.5", + "L0.125,-0.5", + "L0.5, -0.125", + "Z", +].join(" "); function toColor(h: number) { const v = (h - HEIGHT_MIN) / (HEIGHT_MAX - HEIGHT_MIN); @@ -32,8 +35,8 @@ export default function HeightPreview({ height }: { height: Grid }) {