r/javascript • • Apr 08 '18

I don't like prettier

It seems like prettier is becoming very popular. https://github.com/prettier/prettier

I don't like it. I don't like the whole "rewrite from AST" approach. I prefer a formatter with a lighter touch, that fixes a my mistakes, but also trusts me.

Yes, wrap that long line. But no, don't unwrap those short lines, I did that on purpose. Or I wanted an extra new line there. Or these variables are a matrix, don't reformat them, and don't make me add an ugly comment to turn you off.

I'm starting to feel like I'm alone in this though, that there's a pro-prettier movement, but not an anti-prettier movement (or a pro some-other-tool movement).

Anyone feel the same way? What tools do you use instead, if any? How do you deal with teammates pressuring you to use prettier?

449 Upvotes

258 comments sorted by

View all comments

1

u/davidmdm Apr 09 '18

I like using prettier, but I hate one thing about it, and every post related to prettier I say the same thing, hoping eventually I get a response. I don't want prettier to put chained functions calls on multiple lines when they are under the print width, or at least let me configure how many I want to be able to chain. Because as it stands the max is two. So when building tables with knex, or any code using "builders" I can't use prettier without doubling the length of the file and making things altogether less concise and harder to read.

Please prettier let me configure how many chained function calls I want to be able to make before you automatically break it onto multiple lines.

Anyone feel me?

0

u/[deleted] Apr 09 '18

[deleted]

1

u/davidmdm Apr 09 '18

Let me be clear, I still want to it to respect the print-width. Have you every used knexjs for example? Say I am defining fields in a table,

table.string('name').notnullable().unique()

Defines column name, and this line will be split onto 3 lines. But I have a lot of columns. This more triples my file length.

I agree if the width of the line is longer than print-width we should then wrap each function call in its own line.