33 questions from the ESLint and Prettier: Code Quality and Formatting course, each with the correct answer and an explanation. Try to answer before you open the answer.
Module 10: Final Review & Mastery
21. What's a best practice for team adoption?
- Enforce all rules as errors immediately.
- Disable most rules.
- Start with warn, gradually move to error as team adapts.
- Skip CI checks
Show answer
Answer: Start with warn, gradually move to error as team adapts.
Gradual enforcement reduces resistance and allows the team to adjust their workflow progressively.
Lesson: Best Practices & Anti-patterns
22. Should you use example configs as-is?
- Yes, always copy them exactly
- No, adapt them to your project
- Only on Fridays
- It never matters
Show answer
Answer: No, adapt them to your project
Examples are starting points. Your team's standards and project-specific needs should drive configuration choices.
Lesson: Real-world Project Examples
23. Which config entry should come last so it can turn off formatting rules?
- A plugin
- js.configs.recommended
- eslint-config-prettier
- ignores
Show answer
Answer: eslint-config-prettier
Prettier must be last in extends so it takes precedence and resolves any conflicts with ESLint's formatting rules.
Lesson: Interview Questions & Cheat Sheet
24. If a rule isn't applying, what should you check first?
- Restart the editor only
- Delete the config and start over
- Use npx eslint --print-config on the file
- Uninstall ESLint
Show answer
Answer: Use npx eslint --print-config on the file
--print-config shows the effective configuration ESLint is using, revealing if a rule is active or disabled.
Lesson: Troubleshooting & Common Gotchas
25. What is a good next step in mastering code quality?
- Stop using linters
- Use defaults for everything forever
- Ignore CI
- Apply ESLint and Prettier to your next project
Show answer
Answer: Apply ESLint and Prettier to your next project
The best way to master these tools is to use them. Start with a simple setup and refine it over time based on your team's needs.
Lesson: Summary & Next Steps
26. What is ESLint's main job?
- Compile code
- Deploy apps
- Find problems and enforce code-quality rules
- Minify CSS
Show answer
Answer: Find problems and enforce code-quality rules
Prettier handles formatting.
Lesson: Summary & Next Steps
27. What does Prettier do?
- Finds undefined variables
- Runs tests
- Bundles files
- Formats code consistently
Show answer
Answer: Formats code consistently
It rewrites code to one consistent style.
Lesson: Summary & Next Steps
28. Which file holds ESLint 9's default configuration?
- eslint.config.js
- package-lock.json
- .eslintrc.json
- .prettierrc
Show answer
Answer: eslint.config.js
Flat config is the default since ESLint 9.
Lesson: Summary & Next Steps
29. Where should eslint-config-prettier go in your config?
- First
- Last
- It does not matter
- In .gitignore
Show answer
Answer: Last
Later entries override earlier formatting rules.
Lesson: Summary & Next Steps
30. What does severity 'error' do?
- Only warns
- Disables the rule
- Fails the lint run
- Fixes the code
Show answer
Answer: Fails the lint run
Errors cause a non-zero exit code.
Lesson: Summary & Next Steps
31. What does lint-staged do?
- Lints the whole repo
- Stages files automatically
- Installs Husky
- Runs linters on staged files only
Show answer
Answer: Runs linters on staged files only
It keeps pre-commit hooks fast.
Lesson: Summary & Next Steps
32. Why run lint and format checks in CI?
- To block problem code from merging
- To make builds slower
- To delete files
- To rename branches
Show answer
Answer: To block problem code from merging
CI enforces rules for everyone.
Lesson: Summary & Next Steps
33. How should a team adopt new rules?
- Enable all as errors at once
- Start with warn and tighten gradually
- Disable lint
- Skip CI
Show answer
Answer: Start with warn and tighten gradually
Gradual rollout reduces friction.
Lesson: Summary & Next Steps