Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Improving your code with Linter tools

Improving your code with Linter tools

Bruno Genaro

March 20, 2015
Tweet

More Decks by Bruno Genaro

Other Decks in Technology

Transcript

  1. What  is  a  Linter  tool? • Analyses  your  code  

    • Checks  poten?al  errors   • Bad  habits       • Best  prac?ces     • Consistency  mistakes
  2. Why  should  we  use? • Be  familiar  with  best  prac?ces

      • Create  our  own  best  prac?ces  and  paBerns   • Consistent  code  across  mul?ple  applica?ons   • Maintainable  code  /  Easy  debug
  3. Let’s  talk  about  JavaScript • JSLint  (Douglas  Crockford  -­‐  JavaScript:

     The  Good   Parts)   • JSHint  (The  famous  one)   • JSCS   • ESLint  (The  preBy  younger  guy,  good  to  write  ES6)
  4. JSHint • Helps  you  to  write  more  reliable  and  consistent

     JavaScript   code.     • Checks  your  code  for  a  number  of  common  errors   • Never  forget  a  semicolon  anymore!!!   • Customizable  configura?on  using  .jshintrc  file   • hBp://jshint.com/docs/op?ons/
  5. Good  .jshintrc  examples: • Airbnb:  hBps://github.com/airbnb/javascript/blob/ master/linters/jshintrc   • HTML5

     Boilerplate:  hBps://github.com/h5bp/ html5boilerplate.com/blob/master/.jshintrc   • Yeoman  Ember.js  Generator:  hBps://github.com/ yeoman/generator-­‐ember/blob/master/.jshintrc   • Bootstrap:  hBps://github.com/twbs/bootstrap/blob/ master/js/.jshintrc