TypeScript Academy · Lesson

Prettier integration & rule conflicts

Integrate Prettier with ESLint, avoid duplicate rules, and handle conflicts between style and logic rules.

Lesson 2 of 38 steps

Prettier integration & rule conflicts is a free TypeScript Academy lesson on CoddyKit. This is lesson 2 of 3. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the TypeScript Academy learning path, and your progress syncs across the web and the CoddyKit app. The TypeScript Academy course includes 3 lessons in total.

Intro

Goal: Combine Prettier (formatting) with ESLint (logic/style) without conflict.

Install

Install Prettier and ESLint plugins/configs to integrate them smoothly.

npm install --save-dev prettier eslint-config-prettier eslint-plugin-prettier

Prettier config

Prettier has its own config file. Use it for formatting-only options (quotes, semicolons, line length).

// .prettierrc.json
{
  "semi": false,
  "singleQuote": true
}

Config integrate

Add plugin:prettier/recommended to extend ESLint. It includes eslint-config-prettier and eslint-plugin-prettier.

// .eslintrc.js
module.exports = {
  extends: [
    "plugin:@typescript-eslint/recommended",
    "plugin:prettier/recommended"
  ]
}

Conflict example

Without config, ESLint and Prettier may disagree (e.g., semicolons). Config disables conflicting ESLint rules.

// demo.ts
const msg = "hi"
console.log(msg)

// ESLint: missing semicolon
// Prettier: auto removes semicolons if disabled
// Solution: use eslint-config-prettier

Run checks

Run ESLint for logic/style, Prettier for formatting. You can also integrate both in your editor.

npx eslint "src/**/*.{ts,tsx}"
npx prettier --check "src/**/*.{ts,tsx}"

Question

Quick check: What does eslint-config-prettier do?

Recap

Recap: Install Prettier + configs, add to ESLint extends, disable conflicting rules, and run both tools for harmony.

Free to start

Learn TypeScript with an AI tutor — free

Write and run real code in your browser, get instant help from a 24/7 AI tutor, and pick up where you left off on the web or in the app.

Courses
101
Lessons
352

Frequently Asked Questions

Is the “Prettier integration & rule conflicts” lesson free?

Yes — the full text of “Prettier integration & rule conflicts” is free to read here on the web. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the TypeScript Academy course, upgrade to CoddyKit PRO. The TypeScript Academy course includes 3 lessons in total.

What will I learn in “Prettier integration & rule conflicts”?

Integrate Prettier with ESLint, avoid duplicate rules, and handle conflicts between style and logic rules. You practise TypeScript Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start TypeScript Academy?

No prior experience is required. TypeScript Academy on CoddyKit is structured for beginners through advanced learners, so you can start here or from the beginning and move at your own pace. This is lesson 2 of 3.

How long does the “Prettier integration & rule conflicts” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this TypeScript Academy lesson?

Yes. Every TypeScript Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. ESLint + @typescript-eslint
  2. Prettier integration & rule conflicts
  3. Common real-world rule sets
← Back to TypeScript Academy