jackbsteinberg / get-originals-rewriter

BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Distinguishing globals from non-globals with the same name #12

Closed fergald closed 5 years ago

fergald commented 5 years ago

We should either be able to distingiush them or be able to enforce in e.g. eslint that we cannot shadow globals with locals of the same name.

domenic commented 5 years ago

This should mostly be implemented. What remains is to add tests that contain cases like this (where something shadows the global) and ensure that it doesn't get rewritten. Such tests cases need to cover all possible combinations of { namespace function, static method, method, getter, setter, constructor } x { JS, web } x { directly on object, on prototype }.

I'll rename the issue to focus on tests.

fergald commented 5 years ago

Maybe I'm missing something but isConsoleCallExpression just looks at the name and so clean-console.js looks to me like it would fail such a test right now.

domenic commented 5 years ago

Yeah, I think the console transform probably wouldn't pass such a test, that's true. The others would.

jackbsteinberg commented 5 years ago

I think this is resolved, including the console issue, via #60 and #67 so I'm going to close this for now