aboutsummaryrefslogtreecommitdiff
path: root/style.txt
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2016-01-06 15:10:47 +0100
committerFlorian Dold <florian.dold@gmail.com>2016-01-06 15:10:47 +0100
commit2f8aa00595ab40292019ca739041296c84703899 (patch)
tree13b5fd746964cf458617a264c46e3e89b4ec2c4e /style.txt
parent7b2c566cad36a00bbbcf0beb05731020787b08e0 (diff)
downloadwallet-core-2f8aa00595ab40292019ca739041296c84703899.tar.xz
style guide
Diffstat (limited to 'style.txt')
-rw-r--r--style.txt13
1 files changed, 11 insertions, 2 deletions
diff --git a/style.txt b/style.txt
index b4cb5f66d..5fc830cc6 100644
--- a/style.txt
+++ b/style.txt
@@ -17,8 +17,8 @@ Basics:
JavaScript version:
-Stick with ES6 features. Do not rely on any vendor-specific extensions (such
-as Firefox often offers). ES6 features not yet supported by major browsers are
+Stick to ES6 features. Do not rely on any vendor-specific extensions (such as
+Firefox often offers). ES6 features not yet supported by major browsers are
okay as long as there is a well-supported and reasonable polyfill (such as
babel) available.
@@ -33,6 +33,15 @@ APIs:
- Prefer 'Promise' to one-shot continuations whenever possible.
- Prefer handlebars templates to poking around in the DOM.
+
+Dependency Injection (DI):
+DI is a useful pattern when components need to be replaced by mocks or have
+multiple co-existing implementations. But DI also makes code overly generic,
+bureaucratic and less readble. Only use DI if there is a definite need for it,
+do not use it by default. Inject individual dependencies via class
+constructors and avoid service locators.
+
+
Misc:
- Do not use ES6 template strings for constructing HTML,
use TSX/JSX literals instead.