-
- Notifications
You must be signed in to change notification settings - Fork 27.2k
Closed
Description
Description
Lint rules complain about this:
outer: for (const row of rows) { for (const elt of row) { if (elt === 0) break outer; // compute on elt } }which is the most succinct way to stop processing the current row and all following rows, once a zero is encountered anywhere.
They complain in two ways, first no-restricted-syntax complains about any label of any kind. Then no-labels complains twice, first about the label again, and second about the break statement with a label.
Expected behavior
No complaints. I'd probably be ok with a complaint about this:
label: { var a = f(); if (something()) break label; //etc }as that's weird (but apparently legal). However labels are needed on looping constructs for exactly the purpose outlined here.
Actual behavior
Three lint complaints.