aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabio B <kandinsky454@protonmail.ch>2018-12-20 01:29:02 +0800
committerGitHub <noreply@github.com>2018-12-20 01:29:02 +0800
commit6e4cb0246ccd46e69feea5a4324f3a5307df9c3f (patch)
tree068c88f7d578b67ed845e0e0298b0f5dc9c2b6cc
parentb3978b641c12c7bfe9bab1d561384eeaace25321 (diff)
parent94dc272335214edfefa2d926c7cf4e434ff02f5b (diff)
downloaddexon-sol-tools-6e4cb0246ccd46e69feea5a4324f3a5307df9c3f.tar
dexon-sol-tools-6e4cb0246ccd46e69feea5a4324f3a5307df9c3f.tar.gz
dexon-sol-tools-6e4cb0246ccd46e69feea5a4324f3a5307df9c3f.tar.bz2
dexon-sol-tools-6e4cb0246ccd46e69feea5a4324f3a5307df9c3f.tar.lz
dexon-sol-tools-6e4cb0246ccd46e69feea5a4324f3a5307df9c3f.tar.xz
dexon-sol-tools-6e4cb0246ccd46e69feea5a4324f3a5307df9c3f.tar.zst
dexon-sol-tools-6e4cb0246ccd46e69feea5a4324f3a5307df9c3f.zip
Merge pull request #1453 from 0xProject/addUnenforcedConventions
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`.