Closed Bug 1250205 Opened 8 years ago Closed 8 years ago

Fix eslint warnings in devtools/client/inspector/markup/markup.js

Categories

(DevTools :: Inspector, defect, P1)

defect

Tracking

(firefox47 fixed)

RESOLVED FIXED
Firefox 47
Tracking Status
firefox47 --- fixed

People

(Reporter: pbro, Assigned: pbro)

References

Details

Attachments

(1 file)

667:15  warning  "prev" is already declared in the upper scope       no-shadow
   680:15  warning  "next" is already declared in the upper scope       no-shadow
   958:25  warning  "added" is already declared in the upper scope      no-shadow
  1504:1   warning  Line 1504 exceeds the maximum line length of 80     max-len
  1519:13  warning  "container" is already declared in the upper scope  no-shadow
  2870:14  warning  "val" is already declared in the upper scope        no-shadow
  2910:17  warning  "name" is already declared in the upper scope       no-shadow

These seem to confuse people when looking at logs.
I think we should, anyway, change all warnings to errors and get rid of them all (see bug 1246904).
But in the meantime, let's use this bug to get rid of the warnings.
Assignee: nobody → pbrosset
Status: NEW → ASSIGNED
Priority: -- → P1
So, ESLint no-shadow rule complains about this:

switch (something) {
  case "foo":
    let a = 1;
    break;
  case "bar":
    let a = 2;
    break;
}

The second 'a' variable is reported as already declared in the upper scope. This is a bit weird, but I guess I can simply declare a single variable outside of the switch.
Attachment #8722092 - Flags: review?(mratcliffe) → review+
Comment on attachment 8722092 [details]
MozReview Request: Bug 1250205 - Clean remaining eslint warnings in devtools/client/inspector/markup/markup.js; r=miker

https://reviewboard.mozilla.org/r/35861/#review32591

(In reply to Patrick Brosset [:pbrosset] [:pbro] from comment #1)
> So, ESLint no-shadow rule complains about this:
> 
> switch (something) {
>   case "foo":
>     let a = 1;
>     break;
>   case "bar":
>     let a = 2;
>     break;
> }
> 
> The second 'a' variable is reported as already declared in the upper scope.
> This is a bit weird, but I guess I can simply declare a single variable
> outside of the switch.

Yup, the scope in a switch is the space between one curly brace and another but people tend to think that each case has it's own scope.

Anyhow, an easy r+
Keywords: checkin-needed
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/cad377e8dffc
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 47
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: