Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons
  • Teach on BraveProgrammer

© 2026 BraveProgrammer. All rights reserved.

Linting & Formatting – ESLint, P | TypeScript Mastery lesson | BraveProgrammer
  1. Courses
  2. /
  3. TypeScript Mastery

Lesson 40 of 56

·Typescript

Linting & Formatting – ESLint, Prettier, and `eslint-plugin-typescript`

20 minutes

Course progress71%

Install ESLint & Prettier

npm i -D eslint prettier eslint-config-prettier eslint-plugin-prettier @typescript-eslint/parser @typescript-eslint/eslint-plugin

Init ESLint

npx eslint --init

Select TypeScript, React (if applicable), and Prettier integration.

Sample .eslintrc.json


   
    
   
    
    
    
  
   
     
     
  

{
"parser"
:
"@typescript-eslint/parser"
,
"plugins"
:
[
"@typescript-eslint"
,
"prettier"
]
,
"extends"
:
[
"eslint:recommended"
,
"plugin:@typescript-eslint/recommended"
,
"plugin:prettier/recommended"
]
,
"rules"
:
{
"@typescript-eslint/no-unused-vars"
:
"error"
,
"prettier/prettier"
:
"error"
}
}

Prettier config (.prettierrc)

{ "singleQuote": true, "trailingComma": "all" }

Add scripts to package.json:

"scripts": {
  "lint": "eslint 'src/**/*.{ts,tsx}'",
  "format": "prettier --write 'src/**/*.{ts,tsx,js,jsx,json,md}'"
}

Run npm run lint and npm run format.

Info

Enable git hooks (husky) to auto‑run lint/format on commit.
Make it stickPractice what you've learned1 quiz · 3 practical tests · Optional activities from TypeScript MasteryBrowse activities
Previous lessonMocking & Spying in JestContinue to lesson 41Build Tools – `tsc` vs. Babel vs. SWCBack to TypeScript Mastery curriculum