Skip to content

Commit 57797f9

Browse files
committed
fix(wardley): resolve lint errors in wardleyLabelPlacement
Reword a doc comment to drop a word cspell does not know, and collapse a lonely nested if into its else-if condition (unicorn/no-lonely-if).
1 parent 49b8d57 commit 57797f9

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

packages/mermaid/src/diagrams/wardley/wardleyLabelPlacement.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -240,11 +240,11 @@ export const scoreCandidate = (
240240
* pipeline box), spills outside the chart bounds, or overlaps another manual
241241
* label's rect.
242242
*
243-
* Link-line crossings are deliberately NOT a disqualifier: link lines are
244-
* thin, an author who placed a label across one accepted that, and on dense
245-
* maps treating every clipped link as a collision re-places labels that
246-
* looked fine. Link segments are still a soft penalty for auto-placed labels
247-
* (see `scoreCandidate`).
243+
* Crossing a link line does NOT, on its own, reject a manual label: link
244+
* lines are thin, an author who placed a label across one accepted that, and
245+
* on dense maps treating every clipped link as a collision re-places labels
246+
* that looked fine. Link segments are still a soft penalty for auto-placed
247+
* labels (see `scoreCandidate`).
248248
*
249249
* The label's OWN node marker — the circle centred on `label.anchor` — is
250250
* ignored: a normal label sits snugly against its own node, and counting that
@@ -274,10 +274,8 @@ export const isManualLabelKept = (
274274
if (circleRectOverlap(obstacle, rect)) {
275275
return false;
276276
}
277-
} else if (obstacle.type === 'rect') {
278-
if (rectsOverlapArea(rect, obstacle) > 0) {
279-
return false;
280-
}
277+
} else if (obstacle.type === 'rect' && rectsOverlapArea(rect, obstacle) > 0) {
278+
return false;
281279
}
282280
// Link segments are intentionally not checked — see the doc comment.
283281
}

0 commit comments

Comments
 (0)