Book Image

Mastering Web Application Development with Express

By : Alexandru Vladutu
Book Image

Mastering Web Application Development with Express

By: Alexandru Vladutu

Overview of this book

Table of Contents (18 chapters)
Mastering Web Application Development with Express
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Code linting


So far, we have learned about complexity and code-coverage tools, but there are some other static-analysis tools we can use to lint our code based on different rules:

JSLint is highly opinionated when it comes to the rules, while JSHint is more flexible. ESLint is the newest of the three and has support for pluggable rules.

Note

To find out more about the differences between JSHint and ESLint, read the blog post at http://www.nczonline.net/blog/2013/07/16/introducing-eslint/.

For our example, we will use ESLint using the following command:

$ npm i eslint ––save-dev

Before we run the eslint command-line tool, we should create two files inside our root: .eslintignore and eslint.json. The first one indicates what files should be ignored:

node_modules/*
test/*
coverage/*

The second one is used for overriding the default configuration of eslint:

{
  ...