I dislike prettier, imo it is too aggressive all around. I understand the lack of configurability is intentional (to force consistency on a macro scale) but I don’t like its style. Anyone have any good experiences with a more configurable formatter? Looking for one to adapt to existing coding style in a several years-old multi-application project.
Even I find it annoying many times. I disable it for all my personal projects. But I have found it to be very helpful for larger projects which has contributions for a large number of developers. It helps reduce unnecessary discussions around styling which people will disagree on all the time.
It's a bit annoying when you have a large project then someone introduces prettier. Suddenly every pull request has dozens of random formatting changes everywhere and it obscures the actual changes. It also completely nullifies the functionality of git blame (I know there are other ways to see the file history).
The autoformatter config file is checked in with the PR that’s runs it on the entire codebase. Everybody’s machine autoformats the same way.
Only things that are changed in the PR will be formatted along with the PR.
The separate problem I’ve found is any outstanding PRs at the time of running it on the whole codebase should merge in the commit before the format all, then the format all change, then current master. It’s made resolving the PR merge conflicts easier
The best way to introduce a formatter is with a git hook on commit/push (for JS projects see Husky), to ensure everyone is onboard and avoid exactly the formatting churn you mention.
It’s not consistent. The worst thing about “prettier” is how it constantly flip flops back and forth between a single line or multiple lines for imports, destructuring and JSX tags.
I will jump ship the second something comes along that respects line breaks.
On VSCode there is a nice recommendation system, based on file types and vox populi (so one can see if other people use it). I wish other pieces of software hard it as well. (For Sublime Text there is https://packagecontrol.io/, but it requires checking with an external website.)
...
As a side note, do you know if there is a VSCode REPL for TypeScript? There is the console, but it is static in the sense - once can run the whole file. I have a lot of experience with Jupyter Notebook for Python, and it is a kind of tool that for some prototyping (especially in numerics) makes things orders of magnitude faster to detect, and fix, errors.
17 comments
[ 3.0 ms ] story [ 84.4 ms ] threadThe autoformatter config file is checked in with the PR that’s runs it on the entire codebase. Everybody’s machine autoformats the same way.
Only things that are changed in the PR will be formatted along with the PR.
The separate problem I’ve found is any outstanding PRs at the time of running it on the whole codebase should merge in the commit before the format all, then the format all change, then current master. It’s made resolving the PR merge conflicts easier
idk what the ignore rev file does
Sorry - my question was ambiguous. That's the part that I don't understand.
Thanks LaurensBER for the ‘git blame’ solution!
https://github.com/typicode/husky
I will jump ship the second something comes along that respects line breaks.
On VSCode there is a nice recommendation system, based on file types and vox populi (so one can see if other people use it). I wish other pieces of software hard it as well. (For Sublime Text there is https://packagecontrol.io/, but it requires checking with an external website.)
...
As a side note, do you know if there is a VSCode REPL for TypeScript? There is the console, but it is static in the sense - once can run the whole file. I have a lot of experience with Jupyter Notebook for Python, and it is a kind of tool that for some prototyping (especially in numerics) makes things orders of magnitude faster to detect, and fix, errors.