DEV Community

ax
ax

Posted on

Quick start with ESLint

What is ESLint?
ESLint is a popular EcmaScript Linting tool, used to find and fix problems in your Javascript code.

What can ESLint find and fix?
Missing semicolon, unused variables declared, no return type for functions, no default while writing switch cases, improper indentation i.e. stylistic errors etc. These can result in bugs or bad coding style. Some of these can be automatically fixed or a warning is thrown to the developer when we use ESLint.

How does ESLint work?
ESLint uses Espree for Javascript parsing. It uses an AST to evaluate patterns in code. It does all this before runtime.. meaning, without running your Javascript code it will find the bugs, syntax and stylistic errors.

Pre-requisites:
NodeJs (^12.22.0, ^14.17.0, or >=16.0.0)

Install:

npm init @eslint/config

#or

pnpm create @eslint/config 
Enter fullscreen mode Exit fullscreen mode

Prompted Questions..

answer the prompted questions.. and you are done!!

Top comments (0)