From 8027888a81d81ce9a0a32db4a50cfe4e0eb5199e Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Sat, 19 Mar 2022 10:02:27 +0100 Subject: [PATCH] style: prefer prefixes for constants Signed-off-by: Patrik Oldsberg --- STYLE.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/STYLE.md b/STYLE.md index d74616a88c..391b31ce50 100644 --- a/STYLE.md +++ b/STYLE.md @@ -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