Oct 6, 2017
Linting is an essential part of development. It helps you keep a consistent level of quality and rules to stick to.
However there’s one rule that until recently I turned off. Comma-dangle.
Comma-dangle states whether the last item in a object should have a trailing comma. I used to think this was pretty useless and liked how it was without the comma. But a work mate recently brought up a good point.
Git diffs…
Say you have an object without a trailing comma on the last item…
If I then go and add a new item to the end of that object, my git diff will look like so:
Notice how it says that last has changed? Because we’ve added a comma on the end… a bit annoying. If we used trailing commas:
Git Diff will now not complain about last as we haven’t needed to update that line, we just added final onto the end.
This seems like a small win, but when you have to review tens/hundreds of lines of code, every little thing you don’t have to double check is definitely a win!
I am open to both contract and freelance developer projects and would love to hear what your ideas are.
Feel free to drop me an email and I'll let you know how I can help you!
mail@benstokoe.co.uk