const semicolon = 'clearly terminated';const noSemicolon = 'possibly unfinished'
Some people enjoy typing out an extra character on every line.
It goes without saying you’ll also get to read slightly more.
This attribute of semicolons will help you keep code reviewers on their toes.
This change now shows as affecting two lines, when it really only affects one. I bet our reviewer didn’t see that one coming when they spent time scanning both lines for changes ;).
This change now shows as affecting two lines, when it really only affects one.
Shuffling lines is easy, especially if you use vim. If you’d like to swap the last and second last chained methods you need to manually fix the semicolon. This ensures you don’t accidentally modify your code.
// Something a civilized person might do, creating a variable.const myNumbers = [1, 2, 3][1, 2, 3].forEach() // I didn't make a variable for these.// I don't even know what they are ¯\_(ツ)_/¯.// I also don't use prettier, which would pull this line up making my mistake very obvious.
OH NO, A BUG CAUSED BY LACK OF SEMICOLONS! Surely it will take us hours to figure out what’s wrong.
Do you write code like this? If you do you’ll love semicolons.
Software developer living in Toronto 🇨🇦 (and sometimes NYC 🗽).
Focused on Node | GraphQL | React | React Native.