Linting
Why linting?
Linting is the process of running a program that will analyse code for potential errors.
Linting will run through your source code to find
formatting discrepancy
non-adherence to coding standards and conventions
pinpointing possible logical errors in your program
Linting will help you to catch bugs and to enforce your styling code guidelines in the project.
Linting is the process of checking the source code for Programmatic as well as Stylistic errors. This is most helpful in identifying some common and uncommon mistakes that are made during coding.
ALint
or aLinter
is a program that supports linting (verifying code quality). They are available for most languages like JavaScript, CSS, HTML, Python, etc..
Some of the useful linters are JSLint,CSSLint,JSHint,Pylint
There are couple of available/useful linters that can be used to perform linting with node,js
Eslint:
While ESLint is designed to be run on the command line, it’s possible to use ESLint programmatically through the Node.js API. The purpose of the Node.js API is to allow plugin and tool authors to use the ESLint functionality directly, without going through the command line interface.
Installing ESLint
You can install ESLint globally by running the command
npm install -g eslint
Next you need to configure your eslint with running a setup that creates eslint configuration file running the following command:
eslint --init