Enforce stricter file-level closures in JavaScript code.

Review Request #9188 - Created Sept. 8, 2017 and updated

Christian Hammond
Djblets
release-0.10.x
e02ea71...
djblets

With the move to ES6, we've been using { ... } around files that need
to define local variables and assuming Babel would do the right thing.

It doesn't.

Each resulting variable defined on a file level ran the risk of being
redefined by another file, and this would break all sorts of things in
confusing ways when that variable is accessed by any other code. The fix
to this is to go back to wrapping files with (function() { ... })(),
which is the only way to guarantee safety.

All files using simple braces around the file contents to enforce scope
have been updated. All future files will need to use the old form to
ensure safe scoping rules.

Unit tests pass.

Checks run (2 succeeded)
flake8 passed.
JSHint passed.
David Trowbridge
  1. Ship It!
  2. 
      
Loading...