Core Concepts · Quick recall Q&A
1 min readRapid overview
Quick recall Q&A
1. What's the difference between ESLint and Prettier?
ESLint: Catches code quality issues, potential bugs, enforces best practices Prettier: Focuses purely on code formatting (whitespace, line breaks, quotes)
Use both together: ESLint for quality, Prettier for formatting, with eslint-config-prettier to avoid conflicts.
2. How do you handle legacy code that violates rules?
- Use
/ eslint-disable rule-name /for specific files - Add to
.eslintignoretemporarily - Use
--max-warningsto allow gradual fixes - Set rules to
warninitially, thenerrorafter cleanup
3. What's the flat config and why was it introduced?
Flat config (ESLint 9+) replaces .eslintrc:
- Simpler, JavaScript-based configuration
- Better IDE support with explicit imports
- Clearer config merging and precedence
- No more cascading config confusion
4. How do you enforce ESLint in CI/CD?
# GitHub Actions
- name: Lint
run: npm run lint -- --max-warnings 0
Use --max-warnings 0 to fail on any warnings, preventing gradual degradation.