clean-code
Task
Begin first by identifying any violations of the checklist items. Then, refactor the code to address these issues.
Full Documentation
Checklist
-
Use meaningful names – variable and function names should clearly communicate what the code does. Avoid abbreviations or cryptic identifiers; clear naming makes the code self‑documenting. Boolean variables should be named to imply true/false (e.g. isVisible, hasItems). Don't add unecessary prefixes or suffixes - e.g do not add 'Ref' to a useRef variable.
-
Be consistent – use the same vocabulary for the same type of entity (e.g. always call the current player position playerPos instead of mixing currentPos, position, and pos).
-
Write small, pure functions – each function should have a single responsibility. Break complex logic into smaller helpers rather than nesting conditionals.