Heracles.ts icon indicating copy to clipboard operation
Heracles.ts copied to clipboard

Get rid of prettier

Open alien-mcl opened this issue 8 years ago • 4 comments

... or at least reconfigure it. I try to embrace my own code reformatted by this component and I find it difficult. My IDE's defaults shows a break line at 120 chars long line, but prettier mostly uses half of it. I know that someone may need to print it with a legacy 80 chars long needle printer on a toilette paper or just switched from COBOL console, but these setting makes my Full HD 31 inch monitor pretty useless. I don't know what readability preferences were used by creators, but when I try to write my code to be fluent-like where each line tries to be a sentence, it's a mess at the end. It's my personal opinion, but please try to write/read some code reformatted with these settings before using it. For me, it's pain in the ... you know where.

alien-mcl avatar Nov 04 '17 22:11 alien-mcl

Prettier's default is 80 chars but it can be changed, see https://github.com/prettier/prettier#print-width. Is that the only issue you have with it? If not, what else bothers you? Some examples of formatting before and after might be useful.

lanthaler avatar Nov 05 '17 10:11 lanthaler

Well, there are a few issues:

https://github.com/HydraCG/Heracles.ts/blob/master/src/DataModel/JsonLd/JsonLdHypermediaProcessor.ts#L147 All arguments are neither in separate lines nor in a single one. I'd expected some consistency, either all arguments should span a separate line, or all should be side by side in single one (if still within the line length limit)

https://github.com/HydraCG/Heracles.ts/blob/master/src/DataModel/JsonLd/JsonLdHypermediaProcessor.ts#L155 Why simple arrow functions should have braces around argument? The less non-alphanumeric chars the better.

I know that there are some of my personal preferences talking now, but generally I prefer to read code as english-like sentences and having every single word in a separate line is far from readable. Yes, I can see the tokens and names and all, but these are out of context built by the line(s) above.

alien-mcl avatar Nov 05 '17 19:11 alien-mcl

https://github.com/HydraCG/Heracles.ts/blob/master/src/DataModel/JsonLd/JsonLdHypermediaProcessor.ts#L147 All arguments are neither in separate lines nor in a single one. I'd expected some consistency, either all arguments should span a separate line, or all should be side by side in single one (if still within the line length limit)

I agree. This seems to be a Prettier bug.

https://github.com/HydraCG/Heracles.ts/blob/master/src/DataModel/JsonLd/JsonLdHypermediaProcessor.ts#L155 Why simple arrow functions should have braces around argument? The less non-alphanumeric chars the better.

Looks like you discovered the most discussed Prettier issue.

As said before, if this annoys you too much let's just disable it for now. I like having consistently formatted code but it shouldn't get in the way of getting work done. We can always reformat the code later if we want to.

lanthaler avatar Nov 06 '17 19:11 lanthaler

I'll try to stick with it a little longer - yesterday I was really frustrated, but it was yesterday - I'll try to ignore it for a while and save/format once done.

alien-mcl avatar Nov 06 '17 21:11 alien-mcl