Skip to content

Commit

Permalink
formatbot: Automatically format code
Browse files Browse the repository at this point in the history
  • Loading branch information
tscircuitbot committed Jul 29, 2024
1 parent 2996fa4 commit 151485d
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 14 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 15 additions & 7 deletions src/lib/builder/component-builder/BugBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type { Except } from "type-fest"
import getPortPosition, {
DEFAULT_PIN_SPACING,
getPortArrangementSize,
getPortIndices
getPortIndices,
} from "../../utils/get-port-position"
import { associatePcbPortsWithPads } from "../footprint-builder/associate-pcb-ports-with-pads"
import type { ProjectBuilder } from "../project-builder"
Expand All @@ -27,13 +27,14 @@ export interface BugBuilder extends BaseComponentBuilder<BugBuilder> {
properties: Except<
SourceSimpleBugInput,
"type" | "source_component_id" | "ftype" | "name"
> & { name?: string, schWidth?: number }
> & { name?: string; schWidth?: number }
): BugBuilder
}

export class BugBuilderClass
extends ComponentBuilderClass
implements BugBuilder {
implements BugBuilder
{
builder_type = "bug_builder" as const

constructor(project_builder: ProjectBuilder) {
Expand All @@ -42,7 +43,12 @@ export class BugBuilderClass
...this.source_properties,
ftype: "simple_bug",
}
this.settable_schematic_properties.push("port_labels", "port_arrangement", "pin_spacing", "schWidth")
this.settable_schematic_properties.push(
"port_labels",
"port_arrangement",
"pin_spacing",
"schWidth"
)
}

setSourceProperties(props) {
Expand Down Expand Up @@ -94,7 +100,9 @@ export class BugBuilderClass
schWidth: this.source_properties.schPortArrangement.schWidth,
}

const port_arrangement_size = getPortArrangementSize(extended_port_arrangement)
const port_arrangement_size = getPortArrangementSize(
extended_port_arrangement
)

const schematic_component: Soup.SchematicComponent = {
type: "schematic_component",
Expand Down Expand Up @@ -206,7 +214,7 @@ export class BugBuilderClass

const footprint_elements = await this.footprint.build(bc)
for (const fe of footprint_elements) {
; (fe as any).pcb_component_id = pcb_component_id
;(fe as any).pcb_component_id = pcb_component_id
}

this._computeSizeOfPcbElement(pcb_component, footprint_elements as any)
Expand All @@ -226,4 +234,4 @@ export const createBugBuilder = (
project_builder: ProjectBuilder
): BugBuilder => {
return new BugBuilderClass(project_builder)
}
}
2 changes: 1 addition & 1 deletion src/lib/builder/component-builder/remap-prop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ export const remapProp = (prop: string, val: any): [string, any] => {
default:
return [prop, val]
}
}
}
11 changes: 7 additions & 4 deletions src/lib/utils/get-port-position.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const getNormalToExplicitPinMapping = (
if (!definedOrderNormal) {
definedPins.reverse()
}
for (let i = 0;i < definedPins.length;i++) {
for (let i = 0; i < definedPins.length; i++) {
normal_to_explicit.push(definedPins[i])
}
}
Expand All @@ -83,7 +83,7 @@ export const getExplicitToNormalPinMapping = (
): number[] => {
const normal_to_explicit: number[] = getNormalToExplicitPinMapping(pa)
const explicit_to_normal: number[] = []
for (let i = 0;i < normal_to_explicit.length;i++) {
for (let i = 0; i < normal_to_explicit.length; i++) {
explicit_to_normal[normal_to_explicit[i]] = i
}
return explicit_to_normal
Expand Down Expand Up @@ -169,7 +169,10 @@ export const getPortArrangementSize = (
(bottom_size + 1) * pinSpacing
)

const width = port_arrangement.schWidth !== undefined ? port_arrangement.schWidth : calculatedWidth
const width =
port_arrangement.schWidth !== undefined
? port_arrangement.schWidth
: calculatedWidth
const height = Math.max(
MIN_SIDE_DIST,
(left_size + 1) * pinSpacing,
Expand Down Expand Up @@ -259,4 +262,4 @@ export const getPortPosition = (
return { x, y, side }
}

export default getPortPosition
export default getPortPosition

0 comments on commit 151485d

Please sign in to comment.