Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Issues
  • #1835
Closed
Open
Issue created Mar 15, 2017 by Administrator@rootContributor

Relax anti-label lint rules.

Created by: jannotti

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.

Assignee
Assign to
Time tracking