swrlab/swr-prettier-config

feat: Enforce semicolons;

Closed this issue · 7 comments

At the moment the semi option is set to false which removes all semicolons.

If this is not explicitly desired I would suggest to revert it to the previous option ("semi": true).

Why could this be a good idea?

  • we used this option before, so updates in any project would lead to a reformatting of the entire codebase.
  • "semi": true is the prettier default
  • TypeScript uses semicolons as well
  • when not using semicolons JS adds these with the ASI algorithm (which one could skip)

this new setting conforms to my personal preference, although it requires a slowly change of the whole codebase. @frytg might share his personal preferences too, so we can discuss if we keep this settings in the future or not...

I would go even further and suggest to change following settings: trailingComma: 'none'.
Removing trailing commas would increase the consistency compared with JSON-format.

The trailing commas are considered a good practice (from ECMA point and also from prettier) to reduce possible mistakes and to enable faster changes: https://time2hack.com/are-you-using-trailing-commas-in-your-javascript/

frytg commented

So let's keep trailing commas but kill semicolons?

👍

For trailing-commas I would suggest to use the "es5" option (the default in prettier), which permits trailing commas everywhere, where it would be valid in ES5 too, but would not force trailing commas for function parameters list e.g.

I would give the last word to @rafaelmaeuer

okay so the benefits of trailing commas are predominantly cleaner diffs in git and easier code-manipulations (e.g. line duplication). Although these are minor advantages I can agree with the compromise of keeping them while killing semis.

frytg commented

👍🏽