Skip to content

Latest commit

 

History

History
22 lines (18 loc) · 1.98 KB

CONTRIBUTING.md

File metadata and controls

22 lines (18 loc) · 1.98 KB

Contributing Guidelines

Welcome! We're very glad to receive your contribution, and you don't have to be a homo to contribute! (≧Д≦)

In order to make your pull requests merged more easily, here're a few little tips regarding the code (mostly what you'd expect from Douglas Crockford); All of the following are applicable to code specific to this project, but rules can be relaxed when it comes to code calling external libraries.

  • Always use strict TypeScript.
  • No new.
  • No this.
  • No ES6/TypeScript classes. See here for how to properly do OOP in JavaScript, or check out how object creation is done in lib/.

... Class was the most requested new feature in JavaScript, and all of the requests came from Java programmers, who have to program in JavaScript and don't want to have to learn how to do that. ... Those people will go to their graves never knowing how miserable they are.

-- Douglas Crockford

  • No prototypal inheritance. Again, see here.

  • No indexing into arrays. Yes, no array[index], because

    1. You have a plethora of utility functions to traverse arrays: forEach(), map(), filter(), reduce(), find(), etc. that makes the intention of your code way clearer.
    2. It may return undefined.
    3. It may return undefined and TypeScript does the typing wrong and they aren't fixing it anytime soon.

    If you really need to index into arrays, be sure to wrap every value with Option.of().

  • No async/await; instead, use Fluture.tryP() or .encaseP() to wrap up Promises and force yourself to handle every error explicitly.

  • No semicolon.