Re:After 3 Months of JavaScript Linting, It's Pretty Much Al...
by emmab on Thursday August 03, 2017 @02:34PM
(#14922364)
I'm happy to have a standard formatter because it saves me time.
I write my code ignoring indentation and whitespace, then autoformat it moments later.
There's some stuff I have to do myself still, like ordering methods, adding empty lines for readability, and line-breaking string literals and comments.
Re:After 3 Months of JavaScript Linting, It's Pretty Much Al...
by choward on Thursday August 03, 2017 @12:37PM
(#14921092)
I agree. You're a software engineer, not an artist.
Re:After 3 Months of JavaScript Linting, It's Pretty Much Al...
by klibertp on Thursday August 03, 2017 @02:17PM
(#14922192)
Actually, you're both. You're an engineer when you hand your code to the computer to execute. But you are an artist when writing code for others to read. It's not a coincidence that a lot of advice for beginning authors (of novels) is quite similar to advice on writing readable code.
Re:After 3 Months of JavaScript Linting, It's Pretty Much Al...
by slacka on Thursday August 03, 2017 @12:28PM
(#14921013)
Yes, just a kid crying about having to follow style guidelines. If manually running his team's tool is really wasting as much time as he claims, they should switch to a tooling that automatically corrects style. I use tabs, but the policy is spaces. When I commit a change, my my tabs are automatically controverted to spaces. Zero time lost and no one fights about tabs vs spaces.
Re:After 3 Months of JavaScript Linting, It's Pretty Much Al...
by dang on Thursday August 03, 2017 @02:39PM
(#14922427)
> Yes, just a kid crying about
This breaks the HN guidelines against calling names in arguments, so please don't do that. Your comment would be just fine without the first sentence.
Re:After 3 Months of JavaScript Linting, It's Pretty Much Al...
by nulagrithom on Thursday August 03, 2017 @02:16PM
(#14922181)
Just a thought -- it would be neat to see a project that would allow you to check the code out again with your tabs instead of the committed spaces. More of a style translator than an enforcer.
Re:After 3 Months of JavaScript Linting, It's Pretty Much Al...
by xaedes on Friday August 04, 2017 @02:47AM
(#14926826)
It should be relatively easy to set up with git hooks:
Take one of the many Git Hooked Autoformaters: For example: https://github.com/michalrus/git-hooks-code-autoformat
Then add similar hooks for pulling on "post-merge" and "post-rewrite". There is no hook for "pull" per se, but either a merge or commit rewrite (rebase) happens after pull that changes code. So you should be good with those both hooks
Ugh. Come on.
I used to indent with 4 spaces. I lead a team where in the early days I added linting and had to decide one rules. Some of these I felt fine about - semicolons, for instance. But others the team had a fairly unanimous feeling about, 2 spaces being one of them. So I set the linter to 2 spaces, and now that's what I use for everything. I like it.
If we didn't have linting to standardise this and other rules across the codebase, it'd be a mess. It's one thing to be able to identify who's written a thing, but it should be a subtlety in amongst consistency. Not a glaring stylistic mis-match.
https://github.com/prettier/prettier looks promising, on this topic.
Edit: a rebuttal https://news.ycombinator.com/item?id=14921580