Skip to content
This repository has been archived by the owner on Jun 3, 2022. It is now read-only.

Latest commit

 

History

History
60 lines (36 loc) · 2.08 KB

CONTRIBUTING.md

File metadata and controls

60 lines (36 loc) · 2.08 KB

DeFi Whale Contributing Guide

All features must be unit tested with accepted coverage. (Target 100%)

Each package or functionality must be accompanied by full coverage testing.

Due to Javascript type coercion, all test assertions must use strict equality checking.

-   expect(1).toBe('1')
-   expect(1).toEqual('1')
+   expect(1).toStrictEqual(1)

TODO comments

TODO comments should usually include the author's github username in parentheses. Example:

// TODO(fuxingloh): Add tests.

Code of conduct

Please follow the guidelines outlined at https://github.com/JellyfishSDK/.github/blob/main/CODE_OF_CONDUCT.md

Explicit over implicit

Each package, feature, code and decision should be explicit and well documented over implicitly guessing.

TypeScript

TypeScript must be used for all code written in this project.

Heavily adapted from deno style guide.

Minimize dependencies (target zero)

Do not depend on external code. (never if possible)

Use underscores or periods, not dashes in filenames.

Example: Use foo.bar.ts instead of foo-bar.ts.

Exported functions: max 2 args, put the rest into an options object.

Use JSDoc for exported symbols.

Top level functions should not use arrow syntax.

constants.ts not allowed

It's an anti-pattern for scaling code, it gives a false impression of separation of concern. All it does is create a mass of code concentration within project that were better separated.

An analogy for this problem is file organization in projects. Many of us have come to agree that organizing files by file type (e.g. splitting everything into html, js and css folders) don't really scale. The code related to a feature will be forced to be split between three folders, just for a false impression of "separation of concerns". The key here is that "concerns" is not defined by file type. Instead, most of us opt to organize files by feature or responsibility. vuejs/rfcs#55 (comment)