# Prettier Configuration — ESLint + Prettier

Source: https://www.geekswithgeeks.com/en/eslint-prettier/eslint-prettier-04

> Set up Prettier formatting options.

## Prettier basics

Prettier is opinionated—it enforces a consistent style. Configure it with .prettierrc to set line width, quotes, semicolons, and tabs.

## Sample .prettierrc

This configuration enforces 2-space indentation and trailing commas.

```json
{
  "printWidth": 80,
  "tabWidth": 2,
  "useTabs": false,
  "semi": true,
  "singleQuote": true,
  "trailingComma": "es5"
}
```

Output:

```
Prettier config ready: 2-space indent, 80-char lines, single quotes
```

## Avoid config drift

Commit .prettierrc to version control so all team members use identical formatting rules.

Quick check

**Quiz:** What does 'printWidth' control in Prettier?

- [x] Maximum line length before wrapping.
- [ ] Number of spaces per indent.
- [ ] Quote style.

*Answer:* Maximum line length before wrapping.. 'printWidth' sets the character limit per line (default 80). Longer lines wrap automatically.
