Closed
Description
Suggestion
This is a fun little combination of merging two PRS into main
:
- docs(eslint-plugin): enforce a heading for each rule option #8015 enforces all rule options have a heading in their docs file
- feat(eslint-plugin): [switch-exhaustiveness-check] add an option to warn against a
default
case on an already exhaustiveswitch
#7539 added a rule option without a heading (it was authored before that requirement)
Example failure from https://github.com/typescript-eslint/typescript-eslint/actions/runs/7359437354/job/20034331434?pr=8011:
Summary of all failing tests
FAIL tests/docs.test.ts (182 MB heap size)
● Validating rule docs › switch-exhaustiveness-check.md › each rule option should be mentioned in a heading
At least one header should include `allowDefaultCaseForExhaustiveSwitch`.
172 | )) {
173 | if (!headingTextAfterOptions.includes(`\`${property}\``)) {
> 174 | throw new Error(
| ^
175 | `At least one header should include \`${property}\`.`,
176 | );
177 | }