Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2358,6 +2358,9 @@ export interface RectSmtPadProps extends Omit<PcbLayoutProps, "pcbRotation"> {
solderMaskMarginRight?: Distance;
solderMaskMarginTop?: Distance;
solderMaskMarginBottom?: Distance;
// Disable solder paste without affecting the solder mask.
// Omitted or false preserves default paste behavior; true overrides solderPasteMargin.
noSolderPaste?: boolean;
solderPasteMargin?: Distance;
}
```
Expand Down
24 changes: 24 additions & 0 deletions generated/COMPONENT_TYPES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5290,6 +5290,9 @@ export interface RectSmtPadProps extends Omit<PcbLayoutProps, "pcbRotation"> {
solderMaskMarginRight?: Distance
solderMaskMarginTop?: Distance
solderMaskMarginBottom?: Distance
// Disable solder paste without affecting the solder mask.
// Omitted or false preserves default paste behavior; true overrides solderPasteMargin.
noSolderPaste?: boolean
solderPasteMargin?: Distance
}
export interface RotatedRectSmtPadProps
Expand All @@ -5307,6 +5310,9 @@ export interface RotatedRectSmtPadProps
solderMaskMarginRight?: Distance
solderMaskMarginTop?: Distance
solderMaskMarginBottom?: Distance
// Disable solder paste without affecting the solder mask.
// Omitted or false preserves default paste behavior; true overrides solderPasteMargin.
noSolderPaste?: boolean
solderPasteMargin?: Distance
}
export interface CircleSmtPadProps extends Omit<PcbLayoutProps, "pcbRotation"> {
Expand All @@ -5316,6 +5322,9 @@ export interface CircleSmtPadProps extends Omit<PcbLayoutProps, "pcbRotation"> {
portHints?: PortHints
coveredWithSolderMask?: boolean
solderMaskMargin?: Distance
// Disable solder paste without affecting the solder mask.
// Omitted or false preserves default paste behavior; true overrides solderPasteMargin.
noSolderPaste?: boolean
solderPasteMargin?: Distance
}
export interface PillSmtPadProps extends Omit<PcbLayoutProps, "pcbRotation"> {
Expand All @@ -5327,6 +5336,9 @@ export interface PillSmtPadProps extends Omit<PcbLayoutProps, "pcbRotation"> {
portHints?: PortHints
coveredWithSolderMask?: boolean
solderMaskMargin?: Distance
// Disable solder paste without affecting the solder mask.
// Omitted or false preserves default paste behavior; true overrides solderPasteMargin.
noSolderPaste?: boolean
solderPasteMargin?: Distance
}
export interface RotatedPillSmtPadProps
Expand All @@ -5340,6 +5352,9 @@ export interface RotatedPillSmtPadProps
portHints?: PortHints
coveredWithSolderMask?: boolean
solderMaskMargin?: Distance
// Disable solder paste without affecting the solder mask.
// Omitted or false preserves default paste behavior; true overrides solderPasteMargin.
noSolderPaste?: boolean
solderPasteMargin?: Distance
}
export interface PolygonSmtPadProps
Expand All @@ -5350,6 +5365,9 @@ export interface PolygonSmtPadProps
portHints?: PortHints
coveredWithSolderMask?: boolean
solderMaskMargin?: Distance
// Disable solder paste without affecting the solder mask.
// Omitted or false preserves default paste behavior; true overrides solderPasteMargin.
noSolderPaste?: boolean
solderPasteMargin?: Distance
}
export const rectSmtPadProps = pcbLayoutProps
Expand All @@ -5368,6 +5386,7 @@ export const rectSmtPadProps = pcbLayoutProps
solderMaskMarginRight: distance.optional(),
solderMaskMarginTop: distance.optional(),
solderMaskMarginBottom: distance.optional(),
noSolderPaste: z.boolean().optional(),
solderPasteMargin: distance.optional(),
})
export const rotatedRectSmtPadProps = pcbLayoutProps
Expand All @@ -5386,6 +5405,7 @@ export const rotatedRectSmtPadProps = pcbLayoutProps
solderMaskMarginRight: distance.optional(),
solderMaskMarginTop: distance.optional(),
solderMaskMarginBottom: distance.optional(),
noSolderPaste: z.boolean().optional(),
solderPasteMargin: distance.optional(),
})
export const circleSmtPadProps = pcbLayoutProps
Expand All @@ -5397,6 +5417,7 @@ export const circleSmtPadProps = pcbLayoutProps
portHints: portHints.optional(),
coveredWithSolderMask: z.boolean().optional(),
solderMaskMargin: distance.optional(),
noSolderPaste: z.boolean().optional(),
solderPasteMargin: distance.optional(),
})
export const pillSmtPadProps = pcbLayoutProps
Expand All @@ -5410,6 +5431,7 @@ export const pillSmtPadProps = pcbLayoutProps
portHints: portHints.optional(),
coveredWithSolderMask: z.boolean().optional(),
solderMaskMargin: distance.optional(),
noSolderPaste: z.boolean().optional(),
solderPasteMargin: distance.optional(),
})
export const rotatedPillSmtPadProps = pcbLayoutProps
Expand All @@ -5424,6 +5446,7 @@ export const rotatedPillSmtPadProps = pcbLayoutProps
portHints: portHints.optional(),
coveredWithSolderMask: z.boolean().optional(),
solderMaskMargin: distance.optional(),
noSolderPaste: z.boolean().optional(),
solderPasteMargin: distance.optional(),
})
export const polygonSmtPadProps = pcbLayoutProps
Expand All @@ -5435,6 +5458,7 @@ export const polygonSmtPadProps = pcbLayoutProps
portHints: portHints.optional(),
coveredWithSolderMask: z.boolean().optional(),
solderMaskMargin: distance.optional(),
noSolderPaste: z.boolean().optional(),
solderPasteMargin: distance.optional(),
})
```
Expand Down
18 changes: 18 additions & 0 deletions generated/PROPS_OVERVIEW.md
Original file line number Diff line number Diff line change
Expand Up @@ -1024,6 +1024,9 @@ export interface CircleSmtPadProps extends Omit<PcbLayoutProps, "pcbRotation"> {
portHints?: PortHints
coveredWithSolderMask?: boolean
solderMaskMargin?: Distance
// Disable solder paste without affecting the solder mask.
// Omitted or false preserves default paste behavior; true overrides solderPasteMargin.
noSolderPaste?: boolean
solderPasteMargin?: Distance
}

Expand Down Expand Up @@ -2508,6 +2511,9 @@ export interface PillSmtPadProps extends Omit<PcbLayoutProps, "pcbRotation"> {
portHints?: PortHints
coveredWithSolderMask?: boolean
solderMaskMargin?: Distance
// Disable solder paste without affecting the solder mask.
// Omitted or false preserves default paste behavior; true overrides solderPasteMargin.
noSolderPaste?: boolean
solderPasteMargin?: Distance
}

Expand Down Expand Up @@ -2849,6 +2855,9 @@ export interface PolygonSmtPadProps
portHints?: PortHints
coveredWithSolderMask?: boolean
solderMaskMargin?: Distance
// Disable solder paste without affecting the solder mask.
// Omitted or false preserves default paste behavior; true overrides solderPasteMargin.
noSolderPaste?: boolean
solderPasteMargin?: Distance
}

Expand Down Expand Up @@ -2901,6 +2910,9 @@ export interface RectSmtPadProps extends Omit<PcbLayoutProps, "pcbRotation"> {
solderMaskMarginRight?: Distance
solderMaskMarginTop?: Distance
solderMaskMarginBottom?: Distance
// Disable solder paste without affecting the solder mask.
// Omitted or false preserves default paste behavior; true overrides solderPasteMargin.
noSolderPaste?: boolean
solderPasteMargin?: Distance
}

Expand Down Expand Up @@ -2953,6 +2965,9 @@ export interface RotatedPillSmtPadProps
portHints?: PortHints
coveredWithSolderMask?: boolean
solderMaskMargin?: Distance
// Disable solder paste without affecting the solder mask.
// Omitted or false preserves default paste behavior; true overrides solderPasteMargin.
noSolderPaste?: boolean
solderPasteMargin?: Distance
}

Expand All @@ -2972,6 +2987,9 @@ export interface RotatedRectSmtPadProps
solderMaskMarginRight?: Distance
solderMaskMarginTop?: Distance
solderMaskMarginBottom?: Distance
// Disable solder paste without affecting the solder mask.
// Omitted or false preserves default paste behavior; true overrides solderPasteMargin.
noSolderPaste?: boolean
solderPasteMargin?: Distance
}

Expand Down
24 changes: 24 additions & 0 deletions lib/components/smtpad.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ export interface RectSmtPadProps extends Omit<PcbLayoutProps, "pcbRotation"> {
solderMaskMarginRight?: Distance
solderMaskMarginTop?: Distance
solderMaskMarginBottom?: Distance
// Disable solder paste without affecting the solder mask.
// Omitted or false preserves default paste behavior; true overrides solderPasteMargin.
noSolderPaste?: boolean
solderPasteMargin?: Distance
}

Expand All @@ -41,6 +44,9 @@ export interface RotatedRectSmtPadProps
solderMaskMarginRight?: Distance
solderMaskMarginTop?: Distance
solderMaskMarginBottom?: Distance
// Disable solder paste without affecting the solder mask.
// Omitted or false preserves default paste behavior; true overrides solderPasteMargin.
noSolderPaste?: boolean
solderPasteMargin?: Distance
}

Expand All @@ -51,6 +57,9 @@ export interface CircleSmtPadProps extends Omit<PcbLayoutProps, "pcbRotation"> {
portHints?: PortHints
coveredWithSolderMask?: boolean
solderMaskMargin?: Distance
// Disable solder paste without affecting the solder mask.
// Omitted or false preserves default paste behavior; true overrides solderPasteMargin.
noSolderPaste?: boolean
solderPasteMargin?: Distance
}

Expand All @@ -63,6 +72,9 @@ export interface PillSmtPadProps extends Omit<PcbLayoutProps, "pcbRotation"> {
portHints?: PortHints
coveredWithSolderMask?: boolean
solderMaskMargin?: Distance
// Disable solder paste without affecting the solder mask.
// Omitted or false preserves default paste behavior; true overrides solderPasteMargin.
noSolderPaste?: boolean
solderPasteMargin?: Distance
}

Expand All @@ -77,6 +89,9 @@ export interface RotatedPillSmtPadProps
portHints?: PortHints
coveredWithSolderMask?: boolean
solderMaskMargin?: Distance
// Disable solder paste without affecting the solder mask.
// Omitted or false preserves default paste behavior; true overrides solderPasteMargin.
noSolderPaste?: boolean
solderPasteMargin?: Distance
}

Expand All @@ -88,6 +103,9 @@ export interface PolygonSmtPadProps
portHints?: PortHints
coveredWithSolderMask?: boolean
solderMaskMargin?: Distance
// Disable solder paste without affecting the solder mask.
// Omitted or false preserves default paste behavior; true overrides solderPasteMargin.
noSolderPaste?: boolean
solderPasteMargin?: Distance
}

Expand Down Expand Up @@ -119,6 +137,7 @@ export const rectSmtPadProps = pcbLayoutProps
solderMaskMarginRight: distance.optional(),
solderMaskMarginTop: distance.optional(),
solderMaskMarginBottom: distance.optional(),
noSolderPaste: z.boolean().optional(),
solderPasteMargin: distance.optional(),
})
type InferredRectSmtPadProps = z.input<typeof rectSmtPadProps>
Expand All @@ -140,6 +159,7 @@ export const rotatedRectSmtPadProps = pcbLayoutProps
solderMaskMarginRight: distance.optional(),
solderMaskMarginTop: distance.optional(),
solderMaskMarginBottom: distance.optional(),
noSolderPaste: z.boolean().optional(),
solderPasteMargin: distance.optional(),
})
type InferredRotatedRectSmtPadProps = z.input<typeof rotatedRectSmtPadProps>
Expand All @@ -154,6 +174,7 @@ export const circleSmtPadProps = pcbLayoutProps
portHints: portHints.optional(),
coveredWithSolderMask: z.boolean().optional(),
solderMaskMargin: distance.optional(),
noSolderPaste: z.boolean().optional(),
solderPasteMargin: distance.optional(),
})
type InferredCircleSmtPadProps = z.input<typeof circleSmtPadProps>
Expand All @@ -170,6 +191,7 @@ export const pillSmtPadProps = pcbLayoutProps
portHints: portHints.optional(),
coveredWithSolderMask: z.boolean().optional(),
solderMaskMargin: distance.optional(),
noSolderPaste: z.boolean().optional(),
solderPasteMargin: distance.optional(),
})
type InferredPillSmtPadProps = z.input<typeof pillSmtPadProps>
Expand All @@ -187,6 +209,7 @@ export const rotatedPillSmtPadProps = pcbLayoutProps
portHints: portHints.optional(),
coveredWithSolderMask: z.boolean().optional(),
solderMaskMargin: distance.optional(),
noSolderPaste: z.boolean().optional(),
solderPasteMargin: distance.optional(),
})
type InferredRotatedPillSmtPadProps = z.input<typeof rotatedPillSmtPadProps>
Expand All @@ -201,6 +224,7 @@ export const polygonSmtPadProps = pcbLayoutProps
portHints: portHints.optional(),
coveredWithSolderMask: z.boolean().optional(),
solderMaskMargin: distance.optional(),
noSolderPaste: z.boolean().optional(),
solderPasteMargin: distance.optional(),
})
type InferredPolygonSmtPadProps = z.input<typeof polygonSmtPadProps>
Expand Down
45 changes: 45 additions & 0 deletions tests/smtpad.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,48 @@ test("should parse solder paste margin on every smtpad shape", () => {
if (polygon.shape !== "polygon") throw new Error("Expected polygon")
expect(polygon.solderPasteMargin).toBe(0)
})

const smtPadShapes: SmtPadProps[] = [
{ shape: "rect", width: 2, height: 1 },
{ shape: "rotated_rect", width: 2, height: 1, ccwRotation: 45 },
{ shape: "circle", radius: 0.5 },
{ shape: "pill", width: 2, height: 1, radius: 0.5 },
{ shape: "rotated_pill", width: 2, height: 1, radius: 0.5, ccwRotation: 45 },
{
shape: "polygon",
points: [
{ x: 0, y: 0 },
{ x: 1, y: 0 },
{ x: 1, y: 1 },
],
},
]

for (const pad of smtPadShapes) {
test(`${pad.shape} accepts optional noSolderPaste independently of solder mask`, () => {
expect(smtPadProps.parse(pad).noSolderPaste).toBeUndefined()
for (const noSolderPaste of [true, false]) {
for (const coveredWithSolderMask of [true, false]) {
const rawProps: SmtPadProps = {
...pad,
noSolderPaste,
coveredWithSolderMask,
solderPasteMargin: "0.1mm",
}
expect(smtPadProps.parse(rawProps)).toMatchObject({
noSolderPaste,
coveredWithSolderMask,
solderPasteMargin: 0.1,
})
}
}
})

test(`${pad.shape} rejects non-boolean noSolderPaste`, () => {
for (const noSolderPaste of ["true", "false", 0, 1, null]) {
expect(smtPadProps.safeParse({ ...pad, noSolderPaste }).success).toBe(
false,
)
}
})
}
Comment on lines +191 to +218

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rule states that a *.test.ts file may have AT MOST one test(...) call; after that the user should split into multiple, numbered files (e.g., smtpad1.test.ts, smtpad2.test.ts). The added for loop over smtPadShapes generates two test(...) calls per shape (6 shapes × 2 = 12 new tests), and the file already contained multiple test(...) calls before line 174. All these tests must be split into separate, numbered test files rather than accumulated in a single smtpad.test.ts.

Spotted by Graphite (based on custom rule: Custom rule)

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

Loading