Skip to content
This repository was archived by the owner on Mar 5, 2021. It is now read-only.
This repository was archived by the owner on Mar 5, 2021. It is now read-only.

Use const whenever possible #14

@elisee

Description

@elisee

We've been using let for declaring variables almost everywhere. This is a good thing, as it is better-behaved than var (yay for block-scoping!).

But ES6 / TypeScript actually comes with const keyword. As a general rule, we should use it whenever possible, that is, whenever the variable identifier isn't meant to be reassigned.

Rationale: It will make variable identifiers that are meant to be reassigned easier to locate, and will reduce the likelihood of accidental reassignements.

The const declaration creates a read-only reference to a value. It does not mean the value it holds is immutable, just that the variable identifier cannot be reassigned.

Doing this in the whole codebase all at once might be a pain, so feel free to submit a pull request that just takes care of a file or two. Over time, we'll get there.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions