style: prefer prefixes for constants

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2022-03-19 10:02:27 +01:00
parent ffaaec5950
commit 8027888a81
+9
View File
@@ -100,6 +100,15 @@ This section describes guidelines for designing public APIs. It can also be appl
}
```
1. Prefer common prefixes over suffixes when naming constants.
```ts
// May be tempting to use `GITHUB_WIDGET_LABEL` instead.
const WIDGET_LABEL_GITHUB = 'github';
const WIDGET_LABEL_GITLAB = 'gitlab';
const WIDGET_LABEL_BITBUCKET = 'bitbucket';
```
1. When a type relates directly to other symbols, use the name of those as prefix for the type.
```ts