Reason:
“Extensions” in the configuration file:“ eslint:recommended Property enables this rule
This rule prevents lexical declarations (let, const, function, and class) from appearing in case or default clauses. The reason is that the lexical declaration is visible throughout the switch statement block, but it is initialized only when it runs to the case statement it defines