From cd5ea7a8c0605927b4d2572ea1f43e04898ba58d Mon Sep 17 00:00:00 2001
From: Andrii Balitskyi <10balian10@gmail.com>
Date: Wed, 6 Nov 2024 14:48:33 +0100
Subject: [PATCH] Format
---
lib/components/normal-components/Capacitor.ts | 16 ++++++++--
lib/components/normal-components/Diode.ts | 12 ++++++--
lib/components/normal-components/Inductor.ts | 6 +++-
lib/components/normal-components/Led.ts | 19 ++++++++++--
.../chip-cad-model-position-offset.test.tsx | 2 +-
.../normal-components/inductor.test.tsx | 8 ++++-
.../normal-components/power-source.test.tsx | 18 +++++------
.../json/manual-edits.json | 2 +-
.../manual-edits-layout.test.tsx | 2 +-
.../manual-trace-hints.test.tsx | 4 +--
.../primitive-components/net-alias.test.tsx | 16 +++++-----
.../silkscreen-rect.test.tsx | 30 +++++++++----------
.../silkscreenpath.test.tsx | 8 ++---
.../primitive-components/via.test.tsx | 22 +++++++-------
tests/examples/bug-high-port-number.test.tsx | 2 +-
tests/readme.test.tsx | 26 ++++++++--------
tsconfig.json | 2 +-
17 files changed, 119 insertions(+), 76 deletions(-)
diff --git a/lib/components/normal-components/Capacitor.ts b/lib/components/normal-components/Capacitor.ts
index 9bcd87c..71a479e 100644
--- a/lib/components/normal-components/Capacitor.ts
+++ b/lib/components/normal-components/Capacitor.ts
@@ -25,8 +25,20 @@ export class Capacitor extends NormalComponent<
}
initPorts() {
- this.add(new Port({ name: "pin1", pinNumber: 1, aliases: ["anode", "pos", "left"] }))
- this.add(new Port({ name: "pin2", pinNumber: 2, aliases: ["cathode", "neg", "right"] }))
+ this.add(
+ new Port({
+ name: "pin1",
+ pinNumber: 1,
+ aliases: ["anode", "pos", "left"],
+ }),
+ )
+ this.add(
+ new Port({
+ name: "pin2",
+ pinNumber: 2,
+ aliases: ["cathode", "neg", "right"],
+ }),
+ )
}
doInitialCreateNetsFromProps() {
diff --git a/lib/components/normal-components/Diode.ts b/lib/components/normal-components/Diode.ts
index 3a8fabd..3228d68 100644
--- a/lib/components/normal-components/Diode.ts
+++ b/lib/components/normal-components/Diode.ts
@@ -24,10 +24,18 @@ export class Diode extends NormalComponent<
initPorts() {
this.add(
- new Port({ name: "pin1", pinNumber: 1, aliases: ["anode", "pos", "left"] }),
+ new Port({
+ name: "pin1",
+ pinNumber: 1,
+ aliases: ["anode", "pos", "left"],
+ }),
)
this.add(
- new Port({ name: "pin2", pinNumber: 2, aliases: ["cathode", "neg", "right"] }),
+ new Port({
+ name: "pin2",
+ pinNumber: 2,
+ aliases: ["cathode", "neg", "right"],
+ }),
)
}
diff --git a/lib/components/normal-components/Inductor.ts b/lib/components/normal-components/Inductor.ts
index 8a2857a..b9e1f46 100644
--- a/lib/components/normal-components/Inductor.ts
+++ b/lib/components/normal-components/Inductor.ts
@@ -1,6 +1,10 @@
import { inductorProps } from "@tscircuit/props"
import type { SourceSimpleInductor } from "circuit-json"
-import { FTYPE, type BaseSymbolName,type PassivePorts } from "lib/utils/constants"
+import {
+ FTYPE,
+ type BaseSymbolName,
+ type PassivePorts,
+} from "lib/utils/constants"
import { NormalComponent } from "../base-components/NormalComponent"
import { Port } from "../primitive-components/Port"
diff --git a/lib/components/normal-components/Led.ts b/lib/components/normal-components/Led.ts
index dbf528c..59a3b4b 100644
--- a/lib/components/normal-components/Led.ts
+++ b/lib/components/normal-components/Led.ts
@@ -15,15 +15,28 @@ export class Led extends NormalComponent<
get config() {
return {
componentName: "Led",
- schematicSymbolName: this.props.symbolName ?? "led_horz" as BaseSymbolName,
+ schematicSymbolName:
+ this.props.symbolName ?? ("led_horz" as BaseSymbolName),
zodProps: ledProps,
sourceFtype: "simple_diode" as Ftype,
}
}
initPorts() {
- this.add(new Port({ name: "pin1", pinNumber: 1, aliases: ["anode", "pos", "left"] }))
- this.add(new Port({ name: "pin2", pinNumber: 2, aliases: ["cathode", "neg", "right"] }))
+ this.add(
+ new Port({
+ name: "pin1",
+ pinNumber: 1,
+ aliases: ["anode", "pos", "left"],
+ }),
+ )
+ this.add(
+ new Port({
+ name: "pin2",
+ pinNumber: 2,
+ aliases: ["cathode", "neg", "right"],
+ }),
+ )
}
pos = this.portMap.pin1
diff --git a/tests/components/normal-components/chip-cad-model-position-offset.test.tsx b/tests/components/normal-components/chip-cad-model-position-offset.test.tsx
index 4b20cf2..42f998c 100644
--- a/tests/components/normal-components/chip-cad-model-position-offset.test.tsx
+++ b/tests/components/normal-components/chip-cad-model-position-offset.test.tsx
@@ -16,7 +16,7 @@ test("chip with cadModel positionOffset", () => {
positionOffset: { x: 1, y: 2, z: 3 },
}}
/>
-
+ ,
)
project.render()
diff --git a/tests/components/normal-components/inductor.test.tsx b/tests/components/normal-components/inductor.test.tsx
index 6be812a..e03f2ef 100644
--- a/tests/components/normal-components/inductor.test.tsx
+++ b/tests/components/normal-components/inductor.test.tsx
@@ -6,7 +6,13 @@ test(" component", async () => {
circuit.add(
-
+
,
)
diff --git a/tests/components/normal-components/power-source.test.tsx b/tests/components/normal-components/power-source.test.tsx
index 90e0aca..a6aa91f 100644
--- a/tests/components/normal-components/power-source.test.tsx
+++ b/tests/components/normal-components/power-source.test.tsx
@@ -1,16 +1,16 @@
-import { expect, it } from "bun:test";
-import { getTestFixture } from "tests/fixtures/get-test-fixture";
+import { expect, it } from "bun:test"
+import { getTestFixture } from "tests/fixtures/get-test-fixture"
it("should render a power source", async () => {
- const { project } = getTestFixture();
+ const { project } = getTestFixture()
project.add(
-
- );
+ ,
+ )
- project.render();
- expect(project.db.schematic_component.list()).toHaveLength(1);
- expect(project.db.schematic_port.list()).toHaveLength(2);
-});
+ project.render()
+ expect(project.db.schematic_component.list()).toHaveLength(1)
+ expect(project.db.schematic_port.list()).toHaveLength(2)
+})
diff --git a/tests/components/primitive-components/json/manual-edits.json b/tests/components/primitive-components/json/manual-edits.json
index 284a72d..4dd901b 100644
--- a/tests/components/primitive-components/json/manual-edits.json
+++ b/tests/components/primitive-components/json/manual-edits.json
@@ -12,4 +12,4 @@
],
"edit_events": [],
"manual_trace_hints": []
-}
\ No newline at end of file
+}
diff --git a/tests/components/primitive-components/manual-edits-layout.test.tsx b/tests/components/primitive-components/manual-edits-layout.test.tsx
index 4d7baa3..effa8d9 100644
--- a/tests/components/primitive-components/manual-edits-layout.test.tsx
+++ b/tests/components/primitive-components/manual-edits-layout.test.tsx
@@ -7,7 +7,7 @@ test("Manual edits prop usage", () => {
project.add(
-
+
,
)
diff --git a/tests/components/primitive-components/manual-trace-hints.test.tsx b/tests/components/primitive-components/manual-trace-hints.test.tsx
index fea7cfe..92c3a2c 100644
--- a/tests/components/primitive-components/manual-trace-hints.test.tsx
+++ b/tests/components/primitive-components/manual-trace-hints.test.tsx
@@ -50,12 +50,12 @@ test("manual trace hints correctly change trace routes", async () => {
expect(traceRoute.map((p) => ("layer" in p ? p.layer : ""))).toContain(
"bottom",
)
-
+
expect(circuit.selectAll("tracehint").length).toBe(1)
expect(circuit.db.pcb_trace_hint.list().length).toBe(1)
expect(circuit.db.pcb_trace_hint.list()[0].pcb_port_id).toBeTruthy()
-
+
expect(circuit).toMatchPcbSnapshot(import.meta.path)
})
diff --git a/tests/components/primitive-components/net-alias.test.tsx b/tests/components/primitive-components/net-alias.test.tsx
index f1db0b4..a775d57 100644
--- a/tests/components/primitive-components/net-alias.test.tsx
+++ b/tests/components/primitive-components/net-alias.test.tsx
@@ -1,16 +1,16 @@
-import { expect, it } from "bun:test";
-import { getTestFixture } from "tests/fixtures/get-test-fixture";
+import { expect, it } from "bun:test"
+import { getTestFixture } from "tests/fixtures/get-test-fixture"
it("should render a net alias", async () => {
- const { project } = getTestFixture();
+ const { project } = getTestFixture()
project.add(
-
- );
+ ,
+ )
- project.render();
+ project.render()
- expect(project.db.schematic_net_label.list()).toHaveLength(1);
-});
+ expect(project.db.schematic_net_label.list()).toHaveLength(1)
+})
diff --git a/tests/components/primitive-components/silkscreen-rect.test.tsx b/tests/components/primitive-components/silkscreen-rect.test.tsx
index adb719d..3260dd1 100644
--- a/tests/components/primitive-components/silkscreen-rect.test.tsx
+++ b/tests/components/primitive-components/silkscreen-rect.test.tsx
@@ -1,8 +1,8 @@
-import { expect, test } from "bun:test";
-import { getTestFixture } from "tests/fixtures/get-test-fixture";
+import { expect, test } from "bun:test"
+import { getTestFixture } from "tests/fixtures/get-test-fixture"
test("SilkscreenRect rendering", () => {
- const { project } = getTestFixture();
+ const { project } = getTestFixture()
project.add(
{
height={"1.5mm"}
layer="bottom"
/>
-
- );
- project.render();
+ ,
+ )
+ project.render()
- const silkscreenRects = project.db.pcb_silkscreen_rect.list();
+ const silkscreenRects = project.db.pcb_silkscreen_rect.list()
- expect(silkscreenRects.length).toBe(1);
- expect(silkscreenRects[0].center.x).toBe(2);
- expect(silkscreenRects[0].center.y).toBe(3);
- expect(silkscreenRects[0].width).toBe(2);
- expect(silkscreenRects[0].height).toBe(1.5);
- expect(silkscreenRects[0].layer).toBe("bottom");
+ expect(silkscreenRects.length).toBe(1)
+ expect(silkscreenRects[0].center.x).toBe(2)
+ expect(silkscreenRects[0].center.y).toBe(3)
+ expect(silkscreenRects[0].width).toBe(2)
+ expect(silkscreenRects[0].height).toBe(1.5)
+ expect(silkscreenRects[0].layer).toBe("bottom")
- expect(project).toMatchPcbSnapshot(import.meta.path);
-});
+ expect(project).toMatchPcbSnapshot(import.meta.path)
+})
diff --git a/tests/components/primitive-components/silkscreenpath.test.tsx b/tests/components/primitive-components/silkscreenpath.test.tsx
index 5655e6e..ccc7061 100644
--- a/tests/components/primitive-components/silkscreenpath.test.tsx
+++ b/tests/components/primitive-components/silkscreenpath.test.tsx
@@ -10,12 +10,12 @@ test("SilkscreenPath rendering", () => {
route={[
{ x: "0mm", y: "0mm" },
{ x: "5mm", y: "5mm" },
- { x: "10mm", y: "0mm" }
+ { x: "10mm", y: "0mm" },
]}
strokeWidth="0.2mm"
layer="top"
/>
-
+ ,
)
project.render()
@@ -25,11 +25,11 @@ test("SilkscreenPath rendering", () => {
expect(silkscreenPaths.length).toBe(1)
expect(silkscreenPaths[0].layer).toBe("top")
expect(silkscreenPaths[0].stroke_width).toBe(0.2)
-
+
expect(silkscreenPaths[0].route).toEqual([
{ x: 0, y: 0 },
{ x: 5, y: 5 },
- { x: 10, y: 0 }
+ { x: 10, y: 0 },
])
expect(silkscreenPaths[0].pcb_silkscreen_path_id).toBeTruthy()
diff --git a/tests/components/primitive-components/via.test.tsx b/tests/components/primitive-components/via.test.tsx
index cc4c5ed..bd6e0f6 100644
--- a/tests/components/primitive-components/via.test.tsx
+++ b/tests/components/primitive-components/via.test.tsx
@@ -1,9 +1,9 @@
-import { expect, it } from "bun:test";
-import type { Via } from "lib/components";
-import { getTestFixture } from "tests/fixtures/get-test-fixture";
+import { expect, it } from "bun:test"
+import type { Via } from "lib/components"
+import { getTestFixture } from "tests/fixtures/get-test-fixture"
it("should create a Via component with correct properties", () => {
- const { project } = getTestFixture();
+ const { project } = getTestFixture()
project.add(
@@ -15,15 +15,15 @@ it("should create a Via component with correct properties", () => {
fromLayer="top"
toLayer="bottom"
/>
-
- );
+ ,
+ )
- project.render();
+ project.render()
expect(project).toMatchPcbSnapshot(import.meta.path)
- const via = project.selectOne("via") as Via;
+ const via = project.selectOne("via") as Via
- expect(via).not.toBeNull();
- expect(via.props.pcbX).toBe("0mm");
-});
+ expect(via).not.toBeNull()
+ expect(via.props.pcbX).toBe("0mm")
+})
diff --git a/tests/examples/bug-high-port-number.test.tsx b/tests/examples/bug-high-port-number.test.tsx
index 86da596..2d0317b 100644
--- a/tests/examples/bug-high-port-number.test.tsx
+++ b/tests/examples/bug-high-port-number.test.tsx
@@ -9,7 +9,7 @@ test("bug high port number", async () => {
width={10}
height={10}
// @ts-ignore
- // _schDebugObjectsEnabled
+ // _schDebugObjectsEnabled
>
{
- const project = new Circuit();
+ const project = new Circuit()
const board = new Board({
width: "10mm",
height: "10mm",
- });
- project.add(board);
+ })
+ project.add(board)
- const R1 = ;
- board.add(R1);
+ const R1 =
+ board.add(R1)
- board.add();
+ board.add()
- project.render();
+ project.render()
// Let's check the db to make sure everything we expect is there
- expect(project.db.source_component.select(".R1")?.name).toBe("R1");
+ expect(project.db.source_component.select(".R1")?.name).toBe("R1")
// expect(project.db.source_component.select(".LED1")?.name).toBe("LED1")
- expect(project.db.pcb_smtpad.list()).toHaveLength(4);
+ expect(project.db.pcb_smtpad.list()).toHaveLength(4)
// console.log("pcb_trace", project.db.pcb_trace.list())
// console.log(project.getSoup())
-});
+})
diff --git a/tsconfig.json b/tsconfig.json
index 43b7cdd..ae5da2b 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -11,7 +11,7 @@
"baseUrl": ".",
"paths": {
- "lib/*": ["lib/*"],
+ "lib/*": ["lib/*"]
},
// Bundler mode