Project Conventions
This document outlines basic code styling conventions to be followed by all developers of this project.
Naming
- We will use the standard naming conventions for React projects
- Uppercase names are reserved only for the export function in the component.
- Also, the export function’s name should match the file name.
- Lowercase names are used for functions and variables within the function component.
-
All uppercase names (NUMBERS, STRING) are used for constant values and are defined outside the scope of the
function component
-
Try to use longer and more descriptive names to enhance readability of code. Try to avoid variables like:
const (t, setT) = useState([]);
and instead use:
const (screenPositions, setScreenPositions) = useState([]);
-
Avoid leaving numbers in formulas (avoid creating Magic numbers); it makes it hard to read and understand code.
Instead of:
var speed = currentPosition * 0.678;
Do this:
var speedCoefficient = 0.678;
var speed = currentPosition * speedCoefficient;
Code Style
All code pushed to the main branch will be linted via ESLint - ESLint follows the JavaScript Standard Style which
can be found here.