3 ms·
I picked up standard[1] a while back for this reason, I don't want to have to think about it. It works fine, I have no complaints (took me a while to get used t
by lemme_tell_ya 3y ago
I picked up standard[1] a while back for this reason, I don't want to have to think about it. It works fine, I have no complaints (took me a while to get used to not using semi-colons but now I prefer it) Same reason I use `cargo fmt` as well.
[1] https://standardjs.com/ https://standardjs.com/
- jeswin 3y agoIn JavaScript (and in TypeScript), not using the semi-colon is often a footgun. Here's a surprise: const a = 1 const b = 2 (a+b).toString() Calling the convention "standard" was irresponsible, and it led many people (especially beginners) to assume that it was some sort of a preferred convention. Glad I'm seeing it less these days; thanks to TypeScript, and people following Microsoft's conventions.
- WorldMaker 3y agoThere's only one "extra" rule to remember when not using semicolons: the winky frown rule. If it starts with a frown (, [, ` then it must wink: ;(, ;[, ;` It's a silly sounding rule, but that makes it easy to remember. The rest of Automatic Semicolon Insertion footguns happen to everyone whether they use semicolons or not, such as: do not add a newline after return, that makes it a return undefined. Semicolons won't help. (Typescript return type annotations will help.) Related to the topic at hand, prettier configured with `{ "semi": false }` (which I prefer to standard these days because I think prettier autoformatting is, uh, prettier) in my experience catches most winky frown violations for you and auto-fixes them.
- rlt 3y agoThe hubris of naming it “standard” when it is not is a bit of a turn off.
- OccamsMirror 3y agoFake it 'til you make it.
- theonething 3y agoMaybe the authors' meant "a" instead of "the".
- adiabatty 3y agoThat's what they fall back to when pressed.
- xenophonf 3y agoI switched to Python Black and isort for the exact same reason. It just takes all of the thinking out of it. Even better, these tools mean I don't have to teach (and police) code style. I let a pre-commit hook handle that.
- shpx 3y agoI prefer https://github.com/asottile/reorder-python-imports https://github.com/asottile/reorder-python-imports over isort because isort has over 100 configuration options.
- xenophonf 3y agoThe whole point of using opinionated code formatters is to offload the mental effort of forming (and enforcing) opinions to a third party, so I very purposefully rely on isort's and black's defaults.