The state of JavaScript Linting - English version

Michael Kühnel
Michael KühnelFrontend Developer um Micromata GmbH
The state of
JavaScript Linting
JS Syntax Checking and Validation
Michael Kühnel
- Doing web stuff since Netscape 4.7
- Frontend Developer at Micromata
- Twitter: @mkuehnel
- Website: www.michael-kuehnel.de
History
The (subjectively) »most important« Tools:
- JSLint (Release 2002)*
- JSHint (Initial release 2010)
- ESLint (Initial release 2013)
*JSLint only made it into this list for historical reasons.
Common facts
or what is this linting thing all about …
1. Same purpose - Quality
inspection
Syntax Checker and Validator (JavaScript und JSON)
Quality inspection
Syntax errors which will occur in the browser e.g.
- trailing comma in object literals
- Missing or unnecessary semicolons
- Lack of closing brackets
- Any kind of typing errors
Quality inspection
Prevention of logical errors / structural problems ➡️
Increment of maintainability e.g.
- Detection of unreachable code
- Globale variables by accident
- Unused parameters
- etc.
Quality inspection
Forcing adherence to coding conventions e.g.
- Indentation
- InitialCaps for constructors
- Use of eval()
- etc.
2. Same functionality
A. Finds errors
B. Describes the problem
C. Pointing to the position in code (line number)
3. Same language – same
environments
- Written in JavaScript:
- Browser
- node.js / Rhino
- JS based build tools (Grunt, gulp etc.)
- Editor Plugins
4. Doesn’t guarantee error-
free code
But reduce the potential sources of error by usage in
a convenient place within your Workflow:
- Everytime you save a file
- as pre-commit hook
- within the build Process
There is no error-free code
btw. 😎
Additional recommendations to ensure code quality
within your team:
- Unit-Tests
- Functional Tests
- Code Reviews
JSLint
(will hurt your feelings)
Initial release 2002
JSLint
- Author: JavaScript Guru Douglas Crockford
(»Inventor of JSON«, Developer of JSMin)
- Quote from Crockford: »JavaScript is a sloppy
language, but inside it there is an elegant, better
language.«
- Intention: Enforcing the »Good Parts« of JavaScript
- http://jslint.com
JSHint
(The »Gentler« JavaScript
Code Quality Tool)
Initial release 2010
JSHint
- Author: Anton Kovalyov
- Intention: A more flexible linting tool
- http://jshint.com
Main differences to JSLint:
- Community Driven (133 contributors)
- Test coverage of the source code (Unit-Tests)
- Less opinionated (http://anton.kovalyov.net/p/why-jshint)
- More Options (configurable)
- Support for ECMAScript 6
- Configuration via JavaScript comments or text files
(Recommendation .jshintrc ➡️ Team standard + »inheritance«)
JSHint ≠ JSLint
- Enforcing Options
- e.g. 'maxparams' lets you set the max number of formal
parameters allowed per function.
- Relaxing Options
- e.g. 'loopfunc' - suppresses warnings about functions inside of
loops.
- Environment options - pre-defined global variables for specific
environments
- e.g. 'jquery' - suppresses warnings about the usage of '$' und
'jQuery'.
JSHint - Options
Available as:
- Plugin for almost every editor/IDE
- Task for Grunt/gulp
- etc. See http://jshint.com/install
- Just for a quick test if it suits your needs: on the
website of JSHint
JSHint for all of you
Plans for the next major release (3.0)
- Remove all style-related options and warnings.
- If it makes sense they should be moved into
optional plugins.
- Build a foundation for plugins
See http://www.jshint.com/blog/jshint-3-plans/
JSHint - The future
JSHint - The future
- Strengthens »new« linting tools like:
- node-jscs (JavaScript Code Style checker)
- https://twitter.com/mikesherov/status/
419596672520318976
- https://github.com/mdevils/node-jscs
- ESLint
- http://eslint.org
ESLint

(The pluggable linting utility
for JavaScript)
Initial release 2013
ESLint
- Creator: Nicholas C. Zakas
- Intention:
- More flexible/ pluggable linting tool.
- Initially compatible to JSHint - in terms of
available options
- http://eslint.org
ESLint ≠ JSHint
Main differences to JSHint:
- API for plugging in your own rules
- Every rule is a plugin (even the default rules)
- Every rule can be able to be turned off or on!
- More rules than JSHint
- Ever rule can be set to be a warning or error individually
- Config files in JSON Format or YAML
- »More beautiful« linting reports in your terminal 😘
ESLint - Options
- Environments
- (browser/node/amd/mocha).
- An environment defines both global variables that are
predefined as well as which rules should be on or off by default.
- Globals
- Defining own globals so that ESLint will not warn about their
usage.
- Rules
- Activating rules and define the error-level individually.
ESLint - Overview of the
rules
1. Possible Errors:
- e.g. 'no-dupe-keys' – disallow duplicate keys when creating object literals
2. Best Practices:
- They either prescribe a better way of doing something or help you avoid
footguns.
- e.g. 'wrap-iife' – require immediate function invocation to be wrapped in
parentheses.
3. Strict Mode:
- These rules relate to using strict mode (ECMAScript5).
- e.g. 'no-extra-strict' – disallow unnecessary use of "use strict"; when already in
strict mode.
ESLint - Overview of the
rules
4. Variables:
- These rules have to do with variable declarations
- e.g. 'no-shadow' - disallow declaration of variables already declared in the
outer scope.
5. Node.js:
- These rules are specific to JavaScript running on Node.js
- e.g. 'no-process-exit' - disallow process.exit()
6. Stylistic Issues:
- These rules are purely matters of style and are quite subjective
- e.g. 'no-new-object' - disallow use of the Object constructor
Conclusion
ESLint – The way to go 🔥 – despite the early version (0.4.2)
- Huge set of rules with the most flexible configuration
- future-proof in terms of »style related warnings«
- Pluggability (e.g. company-specific rules to enforce coding
guidelines)
- Probably gathering the most contributors in the near future.
- The eco-system is ready: Even available as module for less know
JS build tools like Broccoli. Siehe http://eslint.org/docs/
integrations
Questions?!
Twitter: @mkuehnel
E-Mail: mail@michael-kuehnel.de
💭
Links I
- JavaScript: The Good Parts:
- http://www.amazon.de/JavaScript-Parts-Working-
Shallow-Grain/dp/0596517742
- JSLint:
- http://jslint.com
- https://github.com/douglascrockford/JSLint
Links II
- JSHint
- http://anton.kovalyov.net/p/why-jshint
- http://jshint.com
- http://jshint.com/docs/options
- https://github.com/jshint/jshint
- http://jshint.com/install
- https://github.com/sindresorhus/jshint-stylish
- https://twitter.com/jshint
Links III
- ESLint
- http://eslint.org
- https://github.com/eslint/eslint
- https://twitter.com/geteslint
- http://eslint.org/docs/configuring
- http://eslint.org/docs/rules/
- http://eslint.org/docs/integrations
Links IV
- CoffeeScript
- http://www.coffeelint.org
1 von 33

Recomendados

20151117 es lint von
20151117 es lint20151117 es lint
20151117 es lintNakajima Shigeru
614 views15 Folien
Test your Javascript! v1.1 von
Test your Javascript! v1.1Test your Javascript! v1.1
Test your Javascript! v1.1Eric Wendelin
10.7K views33 Folien
A walkthrough of JavaScript ES6 features von
A walkthrough of JavaScript ES6 featuresA walkthrough of JavaScript ES6 features
A walkthrough of JavaScript ES6 featuresMichal Juhas
794 views13 Folien
Test-Driven JavaScript Development (JavaZone 2010) von
Test-Driven JavaScript Development (JavaZone 2010)Test-Driven JavaScript Development (JavaZone 2010)
Test-Driven JavaScript Development (JavaZone 2010)Christian Johansen
6K views111 Folien
JavaScript + Jenkins = Winning! von
JavaScript + Jenkins = Winning!JavaScript + Jenkins = Winning!
JavaScript + Jenkins = Winning!Eric Wendelin
41.5K views55 Folien
Efficient JavaScript Unit Testing, May 2012 von
Efficient JavaScript Unit Testing, May 2012Efficient JavaScript Unit Testing, May 2012
Efficient JavaScript Unit Testing, May 2012Hazem Saleh
10.1K views50 Folien

Más contenido relacionado

Was ist angesagt?

WebdriverIO: the Swiss Army Knife of testing von
WebdriverIO: the Swiss Army Knife of testingWebdriverIO: the Swiss Army Knife of testing
WebdriverIO: the Swiss Army Knife of testingDaniel Chivescu
973 views29 Folien
Webdriver io presentation von
Webdriver io presentationWebdriver io presentation
Webdriver io presentationJoão Nabais
1.8K views14 Folien
Javascript Security - Three main methods of defending your MEAN stack von
Javascript Security - Three main methods of defending your MEAN stackJavascript Security - Three main methods of defending your MEAN stack
Javascript Security - Three main methods of defending your MEAN stackRan Bar-Zik
2K views22 Folien
PHP Frameworks, or how I learnt to stop worrying and love the code von
PHP Frameworks, or how I learnt to stop worrying and love the codePHP Frameworks, or how I learnt to stop worrying and love the code
PHP Frameworks, or how I learnt to stop worrying and love the codeMichal Juhas
1.6K views63 Folien
Breaking AngularJS Javascript sandbox von
Breaking AngularJS Javascript sandboxBreaking AngularJS Javascript sandbox
Breaking AngularJS Javascript sandboxMathias Karlsson
2.2K views6 Folien
Modern UI Development With Node.js von
Modern UI Development With Node.jsModern UI Development With Node.js
Modern UI Development With Node.jsRyan Anklam
79.8K views122 Folien

Was ist angesagt?(20)

WebdriverIO: the Swiss Army Knife of testing von Daniel Chivescu
WebdriverIO: the Swiss Army Knife of testingWebdriverIO: the Swiss Army Knife of testing
WebdriverIO: the Swiss Army Knife of testing
Daniel Chivescu973 views
Webdriver io presentation von João Nabais
Webdriver io presentationWebdriver io presentation
Webdriver io presentation
João Nabais1.8K views
Javascript Security - Three main methods of defending your MEAN stack von Ran Bar-Zik
Javascript Security - Three main methods of defending your MEAN stackJavascript Security - Three main methods of defending your MEAN stack
Javascript Security - Three main methods of defending your MEAN stack
Ran Bar-Zik2K views
PHP Frameworks, or how I learnt to stop worrying and love the code von Michal Juhas
PHP Frameworks, or how I learnt to stop worrying and love the codePHP Frameworks, or how I learnt to stop worrying and love the code
PHP Frameworks, or how I learnt to stop worrying and love the code
Michal Juhas1.6K views
Breaking AngularJS Javascript sandbox von Mathias Karlsson
Breaking AngularJS Javascript sandboxBreaking AngularJS Javascript sandbox
Breaking AngularJS Javascript sandbox
Mathias Karlsson2.2K views
Modern UI Development With Node.js von Ryan Anklam
Modern UI Development With Node.jsModern UI Development With Node.js
Modern UI Development With Node.js
Ryan Anklam79.8K views
Frontend automation and stability von Máté Nádasdi
Frontend automation and stabilityFrontend automation and stability
Frontend automation and stability
Máté Nádasdi2.3K views
Ruxmon feb 2013 what happened to rails von snyff
Ruxmon feb 2013   what happened to railsRuxmon feb 2013   what happened to rails
Ruxmon feb 2013 what happened to rails
snyff944 views
Server-side template injection- Slides von Amit Dubey
Server-side template injection- Slides Server-side template injection- Slides
Server-side template injection- Slides
Amit Dubey5.4K views
5 sample questions about Single Thread Model (Cx 310 083) von Maarten Storm
5 sample questions about Single Thread Model (Cx 310 083)5 sample questions about Single Thread Model (Cx 310 083)
5 sample questions about Single Thread Model (Cx 310 083)
Maarten Storm816 views
Cypress first impressions von Hans Emmel
Cypress first impressionsCypress first impressions
Cypress first impressions
Hans Emmel220 views
Nightwatch JS for End to End Tests von Sriram Angajala
Nightwatch JS for End to End TestsNightwatch JS for End to End Tests
Nightwatch JS for End to End Tests
Sriram Angajala691 views
libinjection: from SQLi to XSS  by Nick Galbreath von CODE BLUE
libinjection: from SQLi to XSS  by Nick Galbreathlibinjection: from SQLi to XSS  by Nick Galbreath
libinjection: from SQLi to XSS  by Nick Galbreath
CODE BLUE6.8K views
Breaking The Framework's Core #PHPKonf 2016 von Mehmet Ince
Breaking The Framework's Core #PHPKonf 2016Breaking The Framework's Core #PHPKonf 2016
Breaking The Framework's Core #PHPKonf 2016
Mehmet Ince1.7K views
One step in the future: CSS variables von Giacomo Zinetti
One step in the future: CSS variablesOne step in the future: CSS variables
One step in the future: CSS variables
Giacomo Zinetti1.5K views

Similar a The state of JavaScript Linting - English version

The Java alternative to Javascript von
The Java alternative to JavascriptThe Java alternative to Javascript
The Java alternative to JavascriptManuel Carrasco Moñino
2.7K views81 Folien
Gallio Crafting A Toolchain von
Gallio Crafting A ToolchainGallio Crafting A Toolchain
Gallio Crafting A ToolchainConSanFrancisco123
859 views40 Folien
Spring IO 2015 Spock Workshop von
Spring IO 2015 Spock WorkshopSpring IO 2015 Spock Workshop
Spring IO 2015 Spock WorkshopFernando Redondo Ramírez
1.3K views47 Folien
Sandboxing JS and HTML. A lession Learned von
Sandboxing JS and HTML. A lession LearnedSandboxing JS and HTML. A lession Learned
Sandboxing JS and HTML. A lession LearnedMinded Security
1.9K views36 Folien
OWASP SF - Reviewing Modern JavaScript Applications von
OWASP SF - Reviewing Modern JavaScript ApplicationsOWASP SF - Reviewing Modern JavaScript Applications
OWASP SF - Reviewing Modern JavaScript ApplicationsLewis Ardern
5.2K views44 Folien
ESIGate dev meeting #4 21-11-2013 von
ESIGate dev meeting #4 21-11-2013ESIGate dev meeting #4 21-11-2013
ESIGate dev meeting #4 21-11-2013François-Xavier Bonnet
2.5K views18 Folien

Similar a The state of JavaScript Linting - English version(20)

Sandboxing JS and HTML. A lession Learned von Minded Security
Sandboxing JS and HTML. A lession LearnedSandboxing JS and HTML. A lession Learned
Sandboxing JS and HTML. A lession Learned
Minded Security1.9K views
OWASP SF - Reviewing Modern JavaScript Applications von Lewis Ardern
OWASP SF - Reviewing Modern JavaScript ApplicationsOWASP SF - Reviewing Modern JavaScript Applications
OWASP SF - Reviewing Modern JavaScript Applications
Lewis Ardern5.2K views
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f... von JSFestUA
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
JSFestUA238 views
The Diabolical Developer's Guide to Surviving Java 9 von jClarity
The Diabolical Developer's Guide to Surviving Java 9The Diabolical Developer's Guide to Surviving Java 9
The Diabolical Developer's Guide to Surviving Java 9
jClarity855 views
Статический анализ кода в контексте SSDL von Positive Hack Days
Статический анализ кода в контексте SSDLСтатический анализ кода в контексте SSDL
Статический анализ кода в контексте SSDL
Positive Hack Days1.6K views
Gatling - Stress test tool von Knoldus Inc.
Gatling - Stress test toolGatling - Stress test tool
Gatling - Stress test tool
Knoldus Inc.22.4K views
Expanding XPages with Bootstrap Plugins for Ultimate Usability von Teamstudio
Expanding XPages with Bootstrap Plugins for Ultimate UsabilityExpanding XPages with Bootstrap Plugins for Ultimate Usability
Expanding XPages with Bootstrap Plugins for Ultimate Usability
Teamstudio2.7K views
React & Redux JS von Hamed Farag
React & Redux JS React & Redux JS
React & Redux JS
Hamed Farag732 views

Último

PRODUCT LISTING.pptx von
PRODUCT LISTING.pptxPRODUCT LISTING.pptx
PRODUCT LISTING.pptxangelicacueva6
14 views1 Folie
Business Analyst Series 2023 - Week 3 Session 5 von
Business Analyst Series 2023 -  Week 3 Session 5Business Analyst Series 2023 -  Week 3 Session 5
Business Analyst Series 2023 - Week 3 Session 5DianaGray10
248 views20 Folien
Voice Logger - Telephony Integration Solution at Aegis von
Voice Logger - Telephony Integration Solution at AegisVoice Logger - Telephony Integration Solution at Aegis
Voice Logger - Telephony Integration Solution at AegisNirmal Sharma
39 views1 Folie
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive von
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLiveAutomating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLiveNetwork Automation Forum
31 views35 Folien
Design Driven Network Assurance von
Design Driven Network AssuranceDesign Driven Network Assurance
Design Driven Network AssuranceNetwork Automation Forum
15 views42 Folien
Unit 1_Lecture 2_Physical Design of IoT.pdf von
Unit 1_Lecture 2_Physical Design of IoT.pdfUnit 1_Lecture 2_Physical Design of IoT.pdf
Unit 1_Lecture 2_Physical Design of IoT.pdfStephenTec
12 views36 Folien

Último(20)

Business Analyst Series 2023 - Week 3 Session 5 von DianaGray10
Business Analyst Series 2023 -  Week 3 Session 5Business Analyst Series 2023 -  Week 3 Session 5
Business Analyst Series 2023 - Week 3 Session 5
DianaGray10248 views
Voice Logger - Telephony Integration Solution at Aegis von Nirmal Sharma
Voice Logger - Telephony Integration Solution at AegisVoice Logger - Telephony Integration Solution at Aegis
Voice Logger - Telephony Integration Solution at Aegis
Nirmal Sharma39 views
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive von Network Automation Forum
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLiveAutomating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Unit 1_Lecture 2_Physical Design of IoT.pdf von StephenTec
Unit 1_Lecture 2_Physical Design of IoT.pdfUnit 1_Lecture 2_Physical Design of IoT.pdf
Unit 1_Lecture 2_Physical Design of IoT.pdf
StephenTec12 views
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas... von Bernd Ruecker
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
Bernd Ruecker37 views
The details of description: Techniques, tips, and tangents on alternative tex... von BookNet Canada
The details of description: Techniques, tips, and tangents on alternative tex...The details of description: Techniques, tips, and tangents on alternative tex...
The details of description: Techniques, tips, and tangents on alternative tex...
BookNet Canada127 views
Igniting Next Level Productivity with AI-Infused Data Integration Workflows von Safe Software
Igniting Next Level Productivity with AI-Infused Data Integration Workflows Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Safe Software263 views
TouchLog: Finger Micro Gesture Recognition Using Photo-Reflective Sensors von sugiuralab
TouchLog: Finger Micro Gesture Recognition  Using Photo-Reflective SensorsTouchLog: Finger Micro Gesture Recognition  Using Photo-Reflective Sensors
TouchLog: Finger Micro Gesture Recognition Using Photo-Reflective Sensors
sugiuralab19 views
STKI Israeli Market Study 2023 corrected forecast 2023_24 v3.pdf von Dr. Jimmy Schwarzkopf
STKI Israeli Market Study 2023   corrected forecast 2023_24 v3.pdfSTKI Israeli Market Study 2023   corrected forecast 2023_24 v3.pdf
STKI Israeli Market Study 2023 corrected forecast 2023_24 v3.pdf
Empathic Computing: Delivering the Potential of the Metaverse von Mark Billinghurst
Empathic Computing: Delivering  the Potential of the MetaverseEmpathic Computing: Delivering  the Potential of the Metaverse
Empathic Computing: Delivering the Potential of the Metaverse
Mark Billinghurst478 views

The state of JavaScript Linting - English version

  • 1. The state of JavaScript Linting JS Syntax Checking and Validation
  • 2. Michael Kühnel - Doing web stuff since Netscape 4.7 - Frontend Developer at Micromata - Twitter: @mkuehnel - Website: www.michael-kuehnel.de
  • 3. History The (subjectively) »most important« Tools: - JSLint (Release 2002)* - JSHint (Initial release 2010) - ESLint (Initial release 2013) *JSLint only made it into this list for historical reasons.
  • 4. Common facts or what is this linting thing all about …
  • 5. 1. Same purpose - Quality inspection Syntax Checker and Validator (JavaScript und JSON)
  • 6. Quality inspection Syntax errors which will occur in the browser e.g. - trailing comma in object literals - Missing or unnecessary semicolons - Lack of closing brackets - Any kind of typing errors
  • 7. Quality inspection Prevention of logical errors / structural problems ➡️ Increment of maintainability e.g. - Detection of unreachable code - Globale variables by accident - Unused parameters - etc.
  • 8. Quality inspection Forcing adherence to coding conventions e.g. - Indentation - InitialCaps for constructors - Use of eval() - etc.
  • 9. 2. Same functionality A. Finds errors B. Describes the problem C. Pointing to the position in code (line number)
  • 10. 3. Same language – same environments - Written in JavaScript: - Browser - node.js / Rhino - JS based build tools (Grunt, gulp etc.) - Editor Plugins
  • 11. 4. Doesn’t guarantee error- free code But reduce the potential sources of error by usage in a convenient place within your Workflow: - Everytime you save a file - as pre-commit hook - within the build Process
  • 12. There is no error-free code btw. 😎 Additional recommendations to ensure code quality within your team: - Unit-Tests - Functional Tests - Code Reviews
  • 13. JSLint (will hurt your feelings) Initial release 2002
  • 14. JSLint - Author: JavaScript Guru Douglas Crockford (»Inventor of JSON«, Developer of JSMin) - Quote from Crockford: »JavaScript is a sloppy language, but inside it there is an elegant, better language.« - Intention: Enforcing the »Good Parts« of JavaScript - http://jslint.com
  • 15. JSHint (The »Gentler« JavaScript Code Quality Tool) Initial release 2010
  • 16. JSHint - Author: Anton Kovalyov - Intention: A more flexible linting tool - http://jshint.com
  • 17. Main differences to JSLint: - Community Driven (133 contributors) - Test coverage of the source code (Unit-Tests) - Less opinionated (http://anton.kovalyov.net/p/why-jshint) - More Options (configurable) - Support for ECMAScript 6 - Configuration via JavaScript comments or text files (Recommendation .jshintrc ➡️ Team standard + »inheritance«) JSHint ≠ JSLint
  • 18. - Enforcing Options - e.g. 'maxparams' lets you set the max number of formal parameters allowed per function. - Relaxing Options - e.g. 'loopfunc' - suppresses warnings about functions inside of loops. - Environment options - pre-defined global variables for specific environments - e.g. 'jquery' - suppresses warnings about the usage of '$' und 'jQuery'. JSHint - Options
  • 19. Available as: - Plugin for almost every editor/IDE - Task for Grunt/gulp - etc. See http://jshint.com/install - Just for a quick test if it suits your needs: on the website of JSHint JSHint for all of you
  • 20. Plans for the next major release (3.0) - Remove all style-related options and warnings. - If it makes sense they should be moved into optional plugins. - Build a foundation for plugins See http://www.jshint.com/blog/jshint-3-plans/ JSHint - The future
  • 21. JSHint - The future - Strengthens »new« linting tools like: - node-jscs (JavaScript Code Style checker) - https://twitter.com/mikesherov/status/ 419596672520318976 - https://github.com/mdevils/node-jscs - ESLint - http://eslint.org
  • 22. ESLint
 (The pluggable linting utility for JavaScript) Initial release 2013
  • 23. ESLint - Creator: Nicholas C. Zakas - Intention: - More flexible/ pluggable linting tool. - Initially compatible to JSHint - in terms of available options - http://eslint.org
  • 24. ESLint ≠ JSHint Main differences to JSHint: - API for plugging in your own rules - Every rule is a plugin (even the default rules) - Every rule can be able to be turned off or on! - More rules than JSHint - Ever rule can be set to be a warning or error individually - Config files in JSON Format or YAML - »More beautiful« linting reports in your terminal 😘
  • 25. ESLint - Options - Environments - (browser/node/amd/mocha). - An environment defines both global variables that are predefined as well as which rules should be on or off by default. - Globals - Defining own globals so that ESLint will not warn about their usage. - Rules - Activating rules and define the error-level individually.
  • 26. ESLint - Overview of the rules 1. Possible Errors: - e.g. 'no-dupe-keys' – disallow duplicate keys when creating object literals 2. Best Practices: - They either prescribe a better way of doing something or help you avoid footguns. - e.g. 'wrap-iife' – require immediate function invocation to be wrapped in parentheses. 3. Strict Mode: - These rules relate to using strict mode (ECMAScript5). - e.g. 'no-extra-strict' – disallow unnecessary use of "use strict"; when already in strict mode.
  • 27. ESLint - Overview of the rules 4. Variables: - These rules have to do with variable declarations - e.g. 'no-shadow' - disallow declaration of variables already declared in the outer scope. 5. Node.js: - These rules are specific to JavaScript running on Node.js - e.g. 'no-process-exit' - disallow process.exit() 6. Stylistic Issues: - These rules are purely matters of style and are quite subjective - e.g. 'no-new-object' - disallow use of the Object constructor
  • 28. Conclusion ESLint – The way to go 🔥 – despite the early version (0.4.2) - Huge set of rules with the most flexible configuration - future-proof in terms of »style related warnings« - Pluggability (e.g. company-specific rules to enforce coding guidelines) - Probably gathering the most contributors in the near future. - The eco-system is ready: Even available as module for less know JS build tools like Broccoli. Siehe http://eslint.org/docs/ integrations
  • 30. Links I - JavaScript: The Good Parts: - http://www.amazon.de/JavaScript-Parts-Working- Shallow-Grain/dp/0596517742 - JSLint: - http://jslint.com - https://github.com/douglascrockford/JSLint
  • 31. Links II - JSHint - http://anton.kovalyov.net/p/why-jshint - http://jshint.com - http://jshint.com/docs/options - https://github.com/jshint/jshint - http://jshint.com/install - https://github.com/sindresorhus/jshint-stylish - https://twitter.com/jshint
  • 32. Links III - ESLint - http://eslint.org - https://github.com/eslint/eslint - https://twitter.com/geteslint - http://eslint.org/docs/configuring - http://eslint.org/docs/rules/ - http://eslint.org/docs/integrations
  • 33. Links IV - CoffeeScript - http://www.coffeelint.org