hbf-console Gotchas
Package-specific pitfalls and non-obvious patterns. Loaded automatically by workflow commands.
Coding Style Conventions
- No inline styles when a CSS utility class exists: Use
className="mb-2"notstyle={{ marginBottom: 8 }}. Spacing utilities generated via LESS mixin (.generate-spacing(18),@spacer: 4px) insrc/styles/less/abstracts/utils.less. Available:.m-N,.mt-N,.mb-N,.ml-N,.mr-N,.mx-N,.my-N,.p-N,.pt-N,.pb-N,.pl-N,.pr-N,.px-N,.py-Nfor N=0-18. Font sizes:.fs-xs(10px),.fs-sm(12px),.fs-base(14px),.fs-lg(16px),.fs-xl+. Inline styles OK only for positional properties (left, right, top, bottom, maxHeight, maxWidth) without utility equivalents. - Prefer Ant Design layout components over raw
<div>: Use<Space>,<Row>,<Col>for layout.<Text>/<Typography.Paragraph>for text.<Text type="secondary">for hint color instead of inlinecolor: 'rgba(0,0,0,0.45)'. - Use
Form initialValuesinstead ofuseEffect+form.setFieldsValue(): When the Form renders after a loading gate (e.g.,if (isLoading) return <Card loading />), data is available at render time. - Extract repeated ternaries into named constants: e.g.,
const isVertical = graphDirection === GRAPH_LAYOUTS.VERTICAL. - Early return for loading states: Use
if (isLoading) return <Skeleton active />;before the main return. All React hooks must be called before the early return. for...ofis correct when early-returning from the enclosing function:forEachcallbacks can'treturnfrom the outer function. Use.filter().forEach()chain style for simple iteration without early return.
flowGraph.js Serialization
- New node types with custom data fields MUST have cases in BOTH switch statements:
chaptersourceToFlowGraph(backend to frontend, ~line 470) andflowGraphToChaptersource(frontend to backend, ~line 866) insrc/utils/transform/flowGraph.js. Without both, node config fields are silently dropped on save/load.
CI/CD
- No build/deploy step in
.github/workflows/: Only SonarQube. Deployed externally (mechanism unknown). Release automation must account for this.
Pre-commit Hooks
- Worktrees need a one-time
husky install: After creating a worktree and symlinkingnode_modulesfrom the main checkout, the.husky/_/husky.shshim does not exist in the worktree. Runninggit commitfails with.husky/pre-commit: cannot open .husky/_/husky.sh. Fix: run./node_modules/.bin/husky installonce inside the worktree to create the shim. The fix persists for the worktree's lifetime. - Pre-commit hook is heavy (~60s): Runs
yarn lint --max-warnings 0ANDyarn test --watchAll=false(full Jest suite, currently 30 suites / 60 tests on utility helpers) AND commitlint. Plan for it when committing — it's not a fast hook. Don't bypass with--no-verify; investigate hook failures instead.