noDuplicateCase
Это содержимое пока не доступно на вашем языке.
Summary
Section titled “Summary”- Rule available since: 
v1.0.0 - Diagnostic Category: 
lint/suspicious/noDuplicateCase - This rule is recommended, which means is enabled by default.
 - This rule doesn’t have a fix.
 - The default severity of this rule is error.
 - Sources:
- Same as 
no-duplicate-case 
 - Same as 
 
How to configure
Section titled “How to configure”{  "linter": {    "rules": {      "suspicious": {        "noDuplicateCase": "error"      }    }  }}Description
Section titled “Description”Disallow duplicate case labels.
If a switch statement has duplicate test expressions in case clauses, it is likely that a programmer copied a case clause but forgot to change the test expression.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”switch (a) {    case 1:        break;    case 1:        break;    default:        break;}code-block.js:4:10 lint/suspicious/noDuplicateCase ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  ✖ Duplicate case label.
  
    2 │     case 1:
    3 │         break;
  > 4 │     case 1:
      │          ^
    5 │         break;
    6 │     default:
  
  ℹ The first similar label is here:
  
    1 │ switch (a) {
  > 2 │     case 1:
      │          ^
    3 │         break;
    4 │     case 1:
  
switch (a) {    case one:        break;    case one:        break;    default:        break;}code-block.js:4:10 lint/suspicious/noDuplicateCase ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  ✖ Duplicate case label.
  
    2 │     case one:
    3 │         break;
  > 4 │     case one:
      │          ^^^
    5 │         break;
    6 │     default:
  
  ℹ The first similar label is here:
  
    1 │ switch (a) {
  > 2 │     case one:
      │          ^^^
    3 │         break;
    4 │     case one:
  
switch (a) {    case "1":        break;    case "1":        break;    default:        break;}code-block.js:4:10 lint/suspicious/noDuplicateCase ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  ✖ Duplicate case label.
  
    2 │     case “1”:
    3 │         break;
  > 4 │     case “1”:
      │          ^^^
    5 │         break;
    6 │     default:
  
  ℹ The first similar label is here:
  
    1 │ switch (a) {
  > 2 │     case “1”:
      │          ^^^
    3 │         break;
    4 │     case “1”:
  
switch (a) {    case 1:        break;    case 2:        break;    default:        break;}switch (a) {    case one:        break;    case two:        break;    default:        break;}switch (a) {    case "1":        break;    case "2":        break;    default:        break;}Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.