Coding Standards
Spaghetti belongs on plates, not in our codebase. WIP.
Preface
There's no one perfect solution. Every decision is always a trade-off.
Solutions tend to create new problems, and the best solution is the one that solves the most pressing problems while creating the least amount of new ones.
In case we haven't already mentioned it, make sure to rebase onto main
before continuing work.
We're huge on clean code. Code will be read more than it is written. Thankfully you don't have to memorize all of the conventions, as most of them have been automated by ESLint.
If you have the ESLint extension in your IDE, you will immediately see some annoying red and yellow squigglies underneath your code. Thankfully, most of these squigglies can be made to go away using the format command in your IDE, or by running pnpm lint:fix
in your terminal.
Refactoring
Refactoring
is a misleading term, as the factoring
part needs to happen first.
Let's say we have:
We can make it easier to read by factoring out the x
:
This is great, and we can go even further:
Now compare the two equations, which one is easier to understand?
Now take this concept and apply it to code. You'll find that the parallels are uncanny.