javascript switch break unreachable code detected

Viewed 8655

I have the following code

   switch (attr.templateType) {

      case 'text': return tpl_default; break;
      case 'currency': return tpl_currency; break;
      case 'percentage': return tpl_percentage; break;
      case 'latlong': return tpl_latlong; break;
      case 'tel': return tpl_phone; break;
      case 'number': return tpl_number; break;
      case 'address': return tpl_address; break;
      case 'date': return tpl_date; break;
      case 'permissions': return tpl_permissions; break;
      case 'pagination': return tpl_pagination; break;
      case 'time': return tpl_time; break;
      case 'notEmpty': return tpl_notEmpty; break;

      default: return tpl_default; break;
    }

and JavaScript lint tells me "unreachable code detected" for ALL the breaks. If i take out the breaks, lint has no errors.

does anyone know why? The code works and with out any errors.

2 Answers
Related