Commit graph

13 commits

Author SHA1 Message Date
Simon Marchi
bed8853f45 tslint: Enable typedef-whitespace 2018-07-18 11:26:32 -04:00
Simon Marchi
6e6899a231 tslint: Enable variable-name 2018-07-18 11:25:41 -04:00
Simon Marchi
7c76de4536 tslint: Enable whitespace 2018-07-18 11:23:30 -04:00
Simon Marchi
ec95d4a433 tslint: Enable one-line
I'm not sure what is your preference here, but I've seen both styles:

  } else {

and

  {
  else {

I think it would be nice to have a consistent style, and the former is
more common.
2018-07-18 11:18:55 -04:00
Simon Marchi
9a942c5047 tslint: Enable eofline 2018-07-18 11:16:58 -04:00
Simon Marchi
dd24a05670 tslint: Enable whitespace 2018-07-18 11:16:22 -04:00
Simon Marchi
f6f071ccb8 tslint: Enable semicolon
Not really necessary, but it's nice if code is consistently formatted.
2018-07-18 11:14:39 -04:00
Simon Marchi
37570139e3 tslint: Enable indent
The project seems to use tabs, so we can enable the tslint rule for it.
2018-07-18 11:02:55 -04:00
Simon Marchi
186115cf7a tslint: Enable prefer-for-of
This is not a big deal, but I think it makes the code a bit nicer.
2018-07-18 11:02:49 -04:00
Simon Marchi
e0ed9f71b8 tslint: Enable no-var-requires
Rationale from the rule's page:

AMD-style require([]) and CommonJS-style require("") statements are
environment-specific and more difficult to statically analyze.

ES2015-style imports are part of the JavaScript language specfication
and recommended as the path going forward. TypeScript will compile them
to environment-specific forms as needed.
2018-07-18 10:52:48 -04:00
Simon Marchi
b4d539258e tslint: Extend tslint:recommended
Rather than take a whitelist approach to the rules, I think it would be
better to start with some goal (for example, the tslint:recommended set
of rules) and disable those that we don't follow.  This way, it's easy
to see which ones we could potentially enable.

This doesn't mean that we have to follow all of them.  If there are
rules that we don't want, we can move them to a "Rules from
tslint:recommended that we don't want" section.
2018-07-17 18:48:38 -04:00
Simon Marchi
d0dc094f4e tslint: Enable no-null-keyword
I find this rule quite useful so that we use undefined all the time.
The rationale on the rule's documentation page is quite clear:

https://palantir.github.io/tslint/rules/no-null-keyword/
2018-07-17 18:48:05 -04:00
Simon Marchi
1244e4133c Enable tslint with basic rules
Add tslint as a plugin to tsc, so that they will show up in vscode or
whatever editor people use.  I only enabled two basic rules that I think
are very useful, prefer-const and no-var-keyword.  Violations of these
rules were fixed with "tslint -p . --fix".  There was one unused
variable (in the isExpandable) function that I removed by hand.
2018-07-17 18:19:37 -04:00