1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-28 00:06:53 +01:00
unleash.unleash/website/docs/contributing/frontend/ADR/component-naming.md
Fredrik Strand Oseberg 50fb671b66
Docs/dev docs (#2134)
* docs: add ADRs

* docs/adrs

* fix: update developer guide

* fix: add space

* Update website/docs/contributing/backend/overview.md

Co-authored-by: Ivar Conradi Østhus <ivar@getunleash.ai>

* docs: remove auto-generated sidebar

This should've been in .gitignore, but has only been ignored to the
ignore file for the website subdirectory. (This has been fixed on main.)

* docs: delete empty file

* Revert "docs: delete empty file"

This reverts commit 2435f173ff.

* docs: add frontmatter to new dev docs

* Docs(fix): add quotes around page titles

In yaml, the colon is a special character, so we need to use quotes.

* docs: fix remaining titles

* Update website/docs/contributing/backend/overview.md

Co-authored-by: Ivar Conradi Østhus <ivar@getunleash.ai>

* fix: update empty ADR

* fix: update text to reflect postgres 12

* fix: update backend overview

* fix: remove link

* fix: add form ADR

Co-authored-by: Ivar Conradi Østhus <ivar@getunleash.ai>
Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
2022-10-19 14:32:37 +02:00

1.3 KiB

title
ADR: Component naming and file naming

Background

In the codebase, we have found a need to have a common way of naming components so that components can be (a) easily searched for, (b) easily identified as react components and (c) be descriptive in what they do in the codebase.

Decision

We have decided to use a naming convention for components that uppercases the first letter of the component. This also extends to the filename of the component. The two should always be the same:

// Do:
// MyComponent.ts

const MyComponent = () => {};

// Don't:
// someRandomName.ts

const MyComponent = () => {};

The reason for this decision is to remove mental clutter and free up capacity to easily navigate the codebase. Knowing that a component name has the same name as the filename will remove any doubts about the file contents quickly and in the same way follow the React standard of uppercase component names.

Deviations

In some instances, for simplicity we might want to create internal components or child components for a larger component. If these child components are small enough in size and it makes sense to keep them in the same file as the parent (AND they are used in no other external components) it's fine to keep in the same file as the parent component.