Leprechaun avatar

Using Prettier to Make Development Less Cringeworthy

leprechaun

Published: 30 Aug 2022 › Updated: 30 Aug 2022Using Prettier to Make Development Less Cringeworthy

Using Prettier to Make Development Less Cringeworthy

After convincing good-karma@good-karma that prettier was a good idea, I find that trying to merge in new changes from Ecency code base into my forked version got me into a very large number of conflicts. I have revised my ideas on the matter.

Whereas you can set prettier to remove semicolons whenever possible, you cannot set it to add semicolons. You can set it to change quotes to single-quote but not the other way around. Does it add semicolons by default?

Now prose may be wrapped in all kinds of different ways. I'd use single quotes rather than double quotes. Now if you force the changes, no matter what rules you choose roughly 100 000 lines of code get changed when calling prettier.

Use tabsIndent sizeArrow parensBracket spacingChange Count
False2alwaysno112 986
True2alwaysno97 310
True4alwaysno100 992
True2avoidno97 298
True2avoidno97 298
True2avoidyes97 135

I have come to the conclusion that Ecency-vision, the source code of Ecency, shouldn't use prettier by running it on all changed files. However, by leveraging another program to run prettier on only new lines, overtime it could unburden the developer from coding convention concerns without causing conflicts on existing forks.

I think semicolons should always be at the end of the line. If you add a line after a line that doesn't have one, you then must add the semicolon. Now you have changed one line as well as added. I used to think one should reformat these to some standard, and although it might help down the road, present forks will have too many conflicts to justify the problems that will be caused as a result. As of now, I'd only automatically format new lines if I could do so in a time efficient way. Rather than reindent when you put something in a try/catch block, use half an indent value.

Single quotes and backquotes only need one keystroke without a shift-key. That's why I like to use that when I code. I don't really care if a program changes it to double quote for me after the fact.

cimg7131_rotation_adjusted_600x499.png

Leave Using Prettier to Make Development Less Cringeworthy to:

Written by

An Economist, a Coder and a Carbonist. Author of https://Steemfiles.com, Author of https://ProofofBrain.blog Carbonist community admin (https://www.proofofbrain.blog/created/hive-139995). Discord: leprechaun#2185 Email: theleprechaun2022@steemfiles.com Lover of freedom

Read more #development posts


Best Posts From Leprechaun

We have not curated any of leprechaun's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From Leprechaun