This rule requires adding a new set of rules, tslint-etc.
no-unused-declaration used to be available in tslint:recommended but was
deprecated when --noUnusedVariables was added to typescript. The problem
with using TypeScript's --noUnusedVariables is that it turns unused
declarations into an error and prevents compilation, which isn't fun
when you're just prototyping things.
The no-misleading-array-reverse rule prevents using .sort() and
.reverse() in chains because this make these calls look like they return
a new sorted/reversed slice. But the truth is, these functions modify
the array in place and return that same array, which could cause quite a
lot of confusion if you don't expect that.
This rule enforces using `x as y` instead of `<y>x` in order to cast
elements. This makes things easier to read and protects against
conflicts with tsx.
The forin rule forbids using the `for (let key in object)` syntax. This
is because iterating with `for in` also iterates over keys obtained from
prototypal inheritance. This is most of the time wrong and using `for
(let key of Object.keys(object)` protects against that.
This rule requires that all single line comments must start with a
space, i.e. `//hello` is forbidden and `// hello` is allowed.
This made me discover a few pre-processor macro in files that aren't
taken into account by the macro-preprocessor and so I've decided to
remove these directives.
Note that this rule must stay disabled for excmds.ts as it would break
our preprocessor macros.
Tslint and sonarts are pretty cool linters/static analyzers. Currently,
we ask them to ignore any of the rules that Tridactyl might not respect.
This enables progressively re-enabling rules and submitting small,
reviewable PRs that fix things.