Linting, Formatting and CI Gates — Concept Check
Questions on Linting, Formatting and CI Gates. ESLint catches bugs, Prettier ends formatting arguments, and CI is what makes either of them matter. A rule nobody enforces is a suggestion.
Questions in this quiz
8 questions on Linting, Formatting and CI Gates — Concept Check. Work through them here, then start the quiz to answer them and see your score.
1.A developer notices that their code review comments often focus on code style rather than design. What tool configuration can help reduce these style-related comments?
- AUse ESLint alone to handle both style and correctness
- BRely on manual code reviews to enforce style guidelines
- CIntegrate Prettier and ESLint with CI to enforce style and correctness
- DUse Prettier alone to enforce both style and correctness
2.A team wants to ensure that no new 'any' types are introduced in their TypeScript codebase. What strategy should they use?
- ADisable the rule and rely on code reviews
- BEnable '@typescript-eslint/no-explicit-any' as 'error' immediately
- CEnable '@typescript-eslint/no-explicit-any' as 'warn' and track the count
- DEnable the rule only in CI without tracking counts
3.A developer configures ESLint with the rule '@typescript-eslint/no-floating-promises'. What is the main benefit of this rule?
- AIt allows promises to be used without await
- BIt ensures all promises are awaited, preventing silent errors
- CIt enforces consistent promise syntax
- DIt formats promise chains for readability
4.During a code review, a developer argues that Prettier can enforce code correctness. Why is this incorrect?
- APrettier can only enforce correctness in CI
- BPrettier enforces both style and correctness
- CPrettier checks for syntax errors but not logic errors
- DPrettier only formats code and does not check for correctness
5.A team is implementing a CI pipeline and wants to ensure code consistency. Which step is crucial to enforce linting rules?
- ARun tests to ensure code functionality
- BRun ESLint with --max-warnings=0 to fail on warnings
- CUse git hooks to enforce rules locally
- DRun Prettier to format code
6.A developer notices that after enabling format on save in their editor, their code style is consistent. What tool is likely responsible for this?
- APrettier, configured to format on save
- BESLint, configured to lint on save
- CManual code reviews for style
- DGit hooks, configured to enforce style
7.A team finds that their CI builds fail due to linting errors that were not caught locally. What might be the cause?
- ATests are not run locally
- BThe CI pipeline is misconfigured
- CPrettier is not integrated with CI
- DLocal linting is not enforced or configured
8.Why is it important to format the entire codebase in a single commit before enforcing Prettier in CI?
- ATo make code reviews easier
- BTo prevent any future formatting errors
- CTo create a single diff that can be ignored in blame
- DTo ensure all code is correct