Patterns: Anti-Patterns
Known anti-patterns to flag during review. Fix when encountered in touched files. Load via the
patterns-reviewcontext group.
-
Reducer style inconsistency. Most slices use immutable spread (
return { ...state, ... }); a few use Immer mutation (state.field = value). Both are valid in RTK but should be consistent per slice. -
Oversized
liveChatSlice. Mixes connection state, conversations, messages, filters, sound preferences, and UI state. Candidate for splitting along those concerns. -
Direct
storeimport outside React context. Some actions files callstore.dispatch()/store.getState()directly. Use thunk arguments ((dispatch, getState) => ...) instead. -
Debug strings in production code. Error messages or console logs with placeholder text (e.g.,
'translate poopi') left in committed code. -
Route duplication. Routes appearing twice in
computedRoutesinRoot.jsx. -
Hooks returning JSX. Hooks like
useTableFilterIconreturning rendered elements. Hooks should return data or functions; the caller renders. -
No screen-level code splitting. Screens are eagerly imported; only a few heavy panels use
React.lazy. New heavy screens should be lazy-loaded. -
Inline static styles. Use utility classes or component
.lessrules for static values. Seestyling.mdCategory C for the rule (same value on 3+ elements → CSS class) and Category D for hardcoded colors → tokens.
Current inventory of inline-style and classnames violations is tracked in the hbf-console style migration task.