Choose semantic, non-redundant names that clearly express intent and context. Remove unnecessary prefixes when the context is already clear, use semantic design tokens instead of hardcoded values, and prefer precise type definitions over generic ones.
Key practices:
quickJumperInputWidth
instead of paginationQuickJumperInputWidth
when the context (pagination) is already established8px
with semantic tokens like token.marginXS
'timePicker' | 'datePicker'
instead of generic string
typesExample:
// ❌ Redundant prefix and hardcoded value
const paginationQuickJumperInputWidth = '8px';
// ✅ Semantic naming
const quickJumperInputWidth = token.marginXS;
// ❌ Unnecessary type alias
type UseOrientation = (orientation?: Orientation) => [Orientation, boolean];
const useOrientation: UseOrientation = (orientation) => { ... };
// ✅ Direct export with clear signature
export default function useOrientation(orientation?: Orientation): [Orientation, boolean] { ... }
Enter the URL of a public GitHub repository