mirror of
https://github.com/Unleash/unleash.git
synced 2024-10-18 20:09:08 +02:00
ad7c139992
This PR puts our contributing guidelines in the sidebar of the unleash documentation. Currently there was no way of navigating to them easily, which made our contribution guides and ADRs less useful. This PR adds them to the sidebar as their own category, and adds an ADR for domain centric language. Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
857 B
857 B
title |
---|
ADR: Preferred function type |
Background
In the codebase, we have found a need to standardise function types in order to keep the codebase recognizible across different sections, and to encourage / discourage certain patterns.
Decision
We have decided to use arrow functions across the board in the project. Both for helper functions and for react components.
// Do:
const myFunction = () => {};
const MyComponent = () => {};
// Don't:
function myFunction() {}
function MyComponent() {}
The reason for this decision is to remove mental clutter and free up capacity to easily navigate the codebase. In addition, using arrow functions allows you to avoid the complexity of losing the scope of this
for nested functions, and keeps this
stable without any huge drawbacks. Losing hoisting is an acceptable compromise.