Lesson 2 / 25

Installation & Project Setup

Set up ESLint and Prettier in your project.

Getting started

Start by installing both tools via npm. ESLint provides the foundation for linting, while Prettier handles formatting separately.

Try installation

Install both tools and initialize ESLint configuration.

npm install --save-dev eslint prettier
npm init @eslint/config@latest

Output:

✔ How would you like to use ESLint?
✔ What type of modules does your project use?
✔ Which framework does your project use?
✔ Does your project use TypeScript?
✔ Where does your code run?
✔ What format do you prefer for your config file?
Successfully created .eslintrc.json

Common setup issue

Don't skip the configuration step. Run npm init @eslint/config to answer setup questions and generate .eslintrc.json automatically.

Quick check

Quick check: What does `npm init @eslint/config` do?

  • Installs ESLint and creates .eslintrc.json with your preferences.
  • Only installs ESLint.
  • Deletes existing configurations.
Answer

Installs ESLint and creates .eslintrc.json with your preferences. — The config command creates a tailored .eslintrc.json based on your project type and preferences.