Set up a code formatter #834
Labels
discussion
This issue is opinion based
low priority
No hurry, this can wait.
refactor
Rewrite code without changing it's behavior
In my opinion, there are too many extra whitespaces and long lines in our code.
Maybe we should set up a code formatter like Prettier.
Prettier also integrates well with eslint: https://prettier.io/docs/en/install.html#eslint-and-other-linters
It can take over some of it's rules and do it better.
Prettier has a configuration option, that does not match any eslint rules.
printWidth
Specify the line length that the printer will wrap on.
With eslint we used 100 for max-len, but unlike in eslint this option is not a hard limit. Prettier might make a bit longer lines than this.
In my opinion, we should go with the default value, which is 80.
trailingComma
Currently, we are using no commas.
Because of this when we append a new property to a multi-line structure, a line change will occur in the upper line.
This makes the git changelog bloated.
We are probably not using trailing commas because the JSON format does not support it, however, JSON was designed for data transfer and code.
Currently, we are using no commas, but I think we should switch to "es5" to avoid line changes.
The text was updated successfully, but these errors were encountered: