Validator needs to account for variable declarations that shadow globals.

RESOLVED FIXED

Status

addons.mozilla.org Graveyard
Add-on Validation
RESOLVED FIXED
6 years ago
2 years ago

People

(Reporter: kmag, Assigned: basta)

Tracking

Details

(Whiteboard: [ReviewTeam])

The validator currently generates quite a lot of warnings for global overwrites for variables which shadow globals, like top or content. When these are declared via var or let for an inner scope, they should not generate warnings for global overwrites.
Reclassifying editor bugs and changing to a new whiteboard flag. Spam, spam, spam, spam...
Whiteboard: [required amo-editors] → [ReviewTeam]
(Assignee)

Updated

5 years ago
Assignee: nobody → mattbasta
(Assignee)

Updated

5 years ago
Duplicate of this bug: 782164
(Assignee)

Updated

5 years ago
Blocks: 695233
(Assignee)

Comment 3

5 years ago
Is this still a problem? The following code generates no messages:

    var foo = function() {
        let eval = "foo";
        var String = "bar";
    }
The problem is things like:

let top = 12;
for each (let foo in bar)
   top += foo;

which generate global overwrite warnings.
(Assignee)

Comment 5

5 years ago
Ah, nevermind. It's an assignment thing, not a declaration thing.
(Assignee)

Comment 6

5 years ago
This should be mostly fixed. The behavior of `let` and `var` in the global scope is still going to be a little wonky for reasons that are difficult to articulate, but the number of overwrite messages should be very significantly decreased.

https://github.com/mozilla/amo-validator/commit/127c6894109de59e2a4b80c05e88774c2a4c786e
https://github.com/mozilla/amo-validator/commit/0a8344b0f16e185cfd791f4a3558c22b72f20380
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Awesome. I don't really care about the global scope. People who attempt to shadow globals there are probably doing something wrong anyway.
Product: addons.mozilla.org → addons.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.