aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-12-18 22:46:21 +0800
committerFabio Berger <me@fabioberger.com>2018-12-18 22:46:21 +0800
commit7664f6a4fdb2ad31f56c5fb59e4bbc84454ec635 (patch)
tree9787910e0d503f3c72313a937942b2c32c693f51
parent44d9cc53b87c5a19586c05030292b5b21351dc74 (diff)
downloaddexon-sol-tools-7664f6a4fdb2ad31f56c5fb59e4bbc84454ec635.tar
dexon-sol-tools-7664f6a4fdb2ad31f56c5fb59e4bbc84454ec635.tar.gz
dexon-sol-tools-7664f6a4fdb2ad31f56c5fb59e4bbc84454ec635.tar.bz2
dexon-sol-tools-7664f6a4fdb2ad31f56c5fb59e4bbc84454ec635.tar.lz
dexon-sol-tools-7664f6a4fdb2ad31f56c5fb59e4bbc84454ec635.tar.xz
dexon-sol-tools-7664f6a4fdb2ad31f56c5fb59e4bbc84454ec635.tar.zst
dexon-sol-tools-7664f6a4fdb2ad31f56c5fb59e4bbc84454ec635.zip
Add unenforced coding rules to CONTRIBUTING.md
-rw-r--r--CONTRIBUTING.md15
1 files changed, 14 insertions, 1 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 1fea8f501..3e709b36f 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -79,7 +79,20 @@ If using the Atom text editor, we recommend you install the following packages:
* VSCode: [prettier-vscode](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
* Atom: [prettier-atom](https://atom.io/packages/prettier-atom)
-## Fix `submit-coverage` CI failure
+## Unenforced coding conventions
+
+A few of our coding conventions are not yet enforced by the linter/auto-formatter. Be careful to follow these conventions in your PR's.
+
+1. Unused anonymous function parameters should be named with an underscore + number (e.g \_1, \_2, etc...)
+1. There should be a new-line between methods in a class and between test cases.
+1. If a string literal has the same value in two or more places, it should be a single constant referenced in both places.
+1. Do not import from a project's `index.ts` (e.g import { Token } from '../src';). Always import from the source file itself.
+1. Generic error variables should be named `err` instead of `e` or `error`.
+1. If you _must_ cast a variable to any - try to type it back as fast as possible. (e.g., `const cw = ((zeroEx as any)._contractWrappers as ContractWrappers);`). This ensures subsequent code is type-safe.
+1. Our enum conventions coincide with the recommended Typescript conventions, using capitalized keys, and all-caps snake-case values. Eg `GetStats = 'GET_STATS'`
+1. All public, exported methods/functions/classes must have associated Javadoc-style comments.
+
+### Fix `submit-coverage` CI failure
If you simply fork the repo and then create a PR from it, your PR will fail the `submit-coverage` check on CI. This is because the 0x CircleCI configuration sets the `COVERALLS_REPO_TOKEN` environment variable to the token for `0xProject/0x-monorepo`, but when running the check against your fork the token needs to match your repo's name `your-username/0x-monorepo`.