ESLint
Home Free Resources What is ESLint?
{""}
()
{}
[]

Hello, I'm ESLint!

I help programmers write clean, happy code. Let's learn together!

What is ESLint Anyway?

I'm a Code Checker!

Think of me like a teacher for computer code. When programmers write code, I check it to make sure it looks nice and works properly - just like how your teacher checks your homework!

// ESLint would check this code
function sayHello() {
  console.log("Hello, world!")  // Missing semicolon!
}
ESLint would tell the programmer to add a semicolon at the end!

I Make Code Look Nice!

I help make sure all code looks the same - like when your teacher wants everyone's paper to have the same margin or handwriting style. This makes it easier for programmers to read each other's work!

Before ESLint:

function add(a,b){
return a + b
}

After ESLint:

function add(a, b) {
  return a + b;
}

I Catch Mistakes!

Sometimes programmers make little mistakes that cause big problems. I spot those mistakes early, like finding a missing piece in your puzzle before you spend hours looking for it!

// Oops, a mistake here!
if (userIsHappy)
console.log("Smile!")
console.log("Always runs!")
ESLint would warn that the second line might not do what the programmer expects!

How Do Programmers Use Me?

1. They Add Me

Programmers add ESLint to their coding projects, like adding a spell checker to a word game.

2. They Set Rules

They choose special rules for me to follow, like deciding what makes a good drawing in art class.

3. I Check Their Code

When they write code, I check it right away and point out anything that needs fixing!

What Does This Look Like?

# Programmers type this to add me to their project
npm install eslint --save-dev

# Then they set me up
npx eslint --init

# Then they check their code!
npx eslint their-cool-file.js

This is like magic commands programmers type to make me work!

Test Your ESLint Knowledge!

Think you've learned what ESLint does? Try this fun quiz!

1. What is ESLint mainly used for?

2. How does ESLint help programmers?

3. What would ESLint say about this code?

function greet(name)
{
console.log("Hello" + name)
}

Want to Learn More?

For grown-ups who want to use ESLint, here are some helpful resources: