{
  "$type": "site.standard.document",
  "path": "/linting-in-es6/",
  "publishedAt": "2016-04-16T12:23:24.000Z",
  "site": "at://did:plc:6gssgguzeecdttuw4gpdshg2/site.standard.publication/self",
  "tags": [
    "javascript",
    "es6",
    "eslint"
  ],
  "textContent": "[Image: Screen-Shot-2016-04-16-at-8-20-11-AM.png]\n\nI've talked about linting before and it's benefits. After updating all our code to ES6 we had to update our linting rules.\n\nWe are using the AirBnB style guide, which has also been updated with some nice ES6 defaults. There was a ton of updates to make, but it's worth it to have clean consistent code.\n\nHere were our most common linting errors and why they should be corrected.\n\nTemplate Literals\n\nTemplate literals are a cleaner way to combine strings. You should never be writing 'foo' + x in ES6. Templates make string concatenation a breeze `foo${x}`. Our linting rules enforce us to use literals when concatenating strings, but also for us to not lazily use string templates when there is not any concatenation taking place. `Some string` is an error!\n\nObject Literal Shorthand\n\nThere is a lot of enhancements in ES6 to let you write shorter and more concise code. This includes object literal shorthand. How often do you see code that looks like:\n\n[Code block]\n\nShorthand makes this a bit more concise:\n\n[Code block]\n\nArrow Functions\n\nOne of the best additions to ES6 is arrow functions. Inheriting the local this of the code surrounding them make arrow functions very useful. Enforcing that we use arrow functions cleans up a ton of code.\n\nThe old:\n\n[Code block]\n\nBecomes:\n\n[Code block]\n\nOther changes\n\nWe did have a multitude of other linting changes. The rest however are cosmetic. We turned on comma dangle, added spacing around { object } brackets and enforced a line length. These changes are purely visual and just help our code look consistent.\n\nIf you are not using a linter on your Javascript code I suggest you start now. The longer you wait the more refactoring you'll have to do!\n\nRead the original post with all embeds and interactive content at https://rants.broonix.ca/linting-in-es6/",
  "title": "Linting in ES6"
}