Skip to content

Latest commit

 

History

History
38 lines (27 loc) · 1.1 KB

File metadata and controls

38 lines (27 loc) · 1.1 KB

@peggyjs/no-unused-rules

Labels may not be used without either an action or a semantic predicate to reference them.

  • ⭐️ This rule is included in plugin:@peggyjs/recommended preset.
  • ✒️ This rule will fix all errors it finds.

📖 Rule Details

Labels should not be used unless there is an action or semantic predicate that uses the label. This lint rule checks that there is an action or semantic predicate at the correct level that might use the label, then relies on eslint's no-unused-vars rule to check that the label is used inside the action or predicate.

👎 Examples of incorrect code for this rule:

// eslint @peggyjs/no-unused-labels

foo = n:"1"
bar = (n:"1") { return n; }
bar = (n:"1") &{ return n === "1"; }

👍 Examples of correct code for this rule:

// eslint @peggyjs/no-unused-rules

bar = n:"1" { return n; }
bar = n:"1" &{ return n === "1"; }

🔎 Implementation