← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/eslint-declare-vars into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/eslint-declare-vars into lp:launchpad with lp:~cjwatson/launchpad/eslint-remove-unused-vars as a prerequisite.

Commit message:
Add lots of missing variable declarations spotted by ESLint.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/eslint-declare-vars/+merge/327900
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/eslint-declare-vars into lp:launchpad.
=== modified file 'lib/lp/app/javascript/calendar.js'
--- lib/lp/app/javascript/calendar.js	2013-04-22 06:20:18 +0000
+++ lib/lp/app/javascript/calendar.js	2017-07-21 17:49:13 +0000
@@ -22,7 +22,7 @@
  * @param num {Number} the number to convert and possibly pad.
  */
 var pad_with_zero = function(num) {
-    num_as_string = String(num);
+    var num_as_string = String(num);
     if (num_as_string.length === 1) {
         num_as_string = "0" + num_as_string;
     }
@@ -110,6 +110,8 @@
         width: '300px',
         date: initial_value}).render();
 
+    var time_selector_node;
+
     if (include_time) {
         time_selector_node = create_time_selector_node(initial_value);
         containing_div_node.appendChild(time_selector_node);
@@ -127,9 +129,9 @@
     calendar.on("selectionChange", function(e) {
         var newDate = Y.Date.format(e.newSelection[0]);
         if (include_time) {
-            hours = pad_with_zero(
+            var hours = pad_with_zero(
                 time_selector_node.one('.hours').get('value'));
-            minutes = pad_with_zero(
+            var minutes = pad_with_zero(
                 time_selector_node.one('.minutes').get('value'));
             newDate += " " + hours + ":" + minutes;
         }

=== modified file 'lib/lp/app/javascript/choiceedit/choiceedit.js'
--- lib/lp/app/javascript/choiceedit/choiceedit.js	2017-07-21 17:49:13 +0000
+++ lib/lp/app/javascript/choiceedit/choiceedit.js	2017-07-21 17:49:13 +0000
@@ -579,7 +579,7 @@
         var client_width = document.body.clientWidth;
         var offset_width = boundingBox.get('offsetWidth');
         var selectedListItem = boundingBox.one('span.current');
-        valueX = this._mouseX - (boundingBox.get('offsetWidth') / 2);
+        var valueX = this._mouseX - (boundingBox.get('offsetWidth') / 2);
         var valueY;
         if (Y.Lang.isValue(selectedListItem)) {
             valueY = (this._mouseY -

=== modified file 'lib/lp/app/javascript/client.js'
--- lib/lp/app/javascript/client.js	2017-07-21 17:49:13 +0000
+++ lib/lp/app/javascript/client.js	2017-07-21 17:49:13 +0000
@@ -265,7 +265,7 @@
      * @return {String} URL
      */
     module.get_view_url = function(entry, view_name, namespace, query){
-        entry_url = Y.lp.get_url_path(entry.get('web_link'));
+        var entry_url = Y.lp.get_url_path(entry.get('web_link'));
         var querystring = Y.QueryString.stringify(query);
         if (querystring !== '') {
             querystring = '?' + querystring;
@@ -1016,7 +1016,7 @@
         },
 
         get_oops_id: function(response) {
-            var oops_re = /code class\="oopsid">(OOPS-[^<]*)/;
+            var oops_re = /code class="oopsid">(OOPS-[^<]*)/;
             var result = response.responseText.match(oops_re);
             if (result === null) {
                 return null;

=== modified file 'lib/lp/app/javascript/comment.js'
--- lib/lp/app/javascript/comment.js	2014-05-28 20:38:48 +0000
+++ lib/lp/app/javascript/comment.js	2017-07-21 17:49:13 +0000
@@ -54,7 +54,7 @@
         var that = this;
         var comment_number = parseInt(
                 link.get('id').replace('mark-spam-', ''), 10);
-        parameters = {
+        var parameters = {
             visible: visible,
             comment_number: comment_number
             };
@@ -408,7 +408,8 @@
      * @param callback On success, call this with the HTML of the comment.
      */
     get_comment_HTML: function(comment_entry, callback) {
-        fragment_url = 'comments/' + comment_entry.get('id') + '/+fragment';
+        var fragment_url = 'comments/' + comment_entry.get('id') +
+                           '/+fragment';
         Y.io(fragment_url, {
             on: {
                 success: function(id, response){

=== modified file 'lib/lp/app/javascript/inlinehelp/tests/test_inlinehelp.js'
--- lib/lp/app/javascript/inlinehelp/tests/test_inlinehelp.js	2017-07-21 17:49:13 +0000
+++ lib/lp/app/javascript/inlinehelp/tests/test_inlinehelp.js	2017-07-21 17:49:13 +0000
@@ -109,7 +109,7 @@
                 var target_link = e.target;
 
                 // init the overlay and show it
-                overlay = new Y.lp.app.inlinehelp.InlineHelpOverlay({
+                var overlay = new Y.lp.app.inlinehelp.InlineHelpOverlay({
                     'contentUrl': target_link.get('href')
                 });
                 overlay.render();

=== modified file 'lib/lp/app/javascript/lp.js'
--- lib/lp/app/javascript/lp.js	2012-05-17 20:38:13 +0000
+++ lib/lp/app/javascript/lp.js	2017-07-21 17:49:13 +0000
@@ -77,7 +77,7 @@
      * Return the path portion of the specified URL.
      */
     Y.lp.get_url_path = function(url) {
-        pathname = get_hyperlink(url).get('pathname');
+        var pathname = get_hyperlink(url).get('pathname');
         if (!pathname || pathname[0] !== '/') {
             // Ensure the leading slash often dropped by msie.
             pathname = '/' + pathname;

=== modified file 'lib/lp/app/javascript/ordering/tests/test_orderby_widget.js'
--- lib/lp/app/javascript/ordering/tests/test_orderby_widget.js	2013-03-20 03:41:40 +0000
+++ lib/lp/app/javascript/ordering/tests/test_orderby_widget.js	2017-07-21 17:49:13 +0000
@@ -368,7 +368,7 @@
             };
             this.orderby.updateVisibility(visibility_rules);
             Y.each(this.orderby.get('li_nodes'), function(node) {
-                sort_name = node.get('id').replace('sort-', '');
+                var sort_name = node.get('id').replace('sort-', '');
                 if (visibility_rules[sort_name] === true) {
                     Assert.isFalse(node._isHidden());
                 } else {

=== modified file 'lib/lp/app/javascript/picker/tests/test_picker.js'
--- lib/lp/app/javascript/picker/tests/test_picker.js	2017-07-21 17:49:13 +0000
+++ lib/lp/app/javascript/picker/tests/test_picker.js	2017-07-21 17:49:13 +0000
@@ -768,7 +768,7 @@
         },
 
         test_save_does_not_clear_widget_when_clear_on_save_is_false: function () {
-            picker = new Y.lp.ui.picker.Picker({clear_on_save: false});
+            var picker = new Y.lp.ui.picker.Picker({clear_on_save: false});
             picker.render();
 
             picker._search_input.set('value', 'foo');
@@ -789,7 +789,7 @@
         },
 
         test_cancel_event_clears_widget_when_clear_on_cancel_true: function () {
-            picker = new Y.lp.ui.picker.Picker({clear_on_cancel: true});
+            var picker = new Y.lp.ui.picker.Picker({clear_on_cancel: true});
             picker.render();
 
             picker._search_input.set('value', 'foo');

=== modified file 'lib/lp/app/javascript/subscribers/subscribers_list.js'
--- lib/lp/app/javascript/subscribers/subscribers_list.js	2017-07-20 13:29:41 +0000
+++ lib/lp/app/javascript/subscribers/subscribers_list.js	2017-07-21 17:49:13 +0000
@@ -523,6 +523,7 @@
         } else {
             loader.subscribers_list.stopActivity();
         }
+        var error_msg;
         if (response.status === 400 && response.responseText !== undefined) {
             error_msg = response.responseText;
         } else {

=== modified file 'lib/lp/app/javascript/tests/test_expander.js'
--- lib/lp/app/javascript/tests/test_expander.js	2017-07-21 17:49:13 +0000
+++ lib/lp/app/javascript/tests/test_expander.js	2017-07-21 17:49:13 +0000
@@ -209,7 +209,7 @@
                 wrap_has_run = true;
             };
 
-            root = this.makeExpanderHooks();
+            var root = this.makeExpanderHooks();
             var expander = new module.Expander(
                 root.one('.icon'), root.one('.content'));
             expander.wrapNodeWithLink = fake_wrapNodeWithLink;

=== modified file 'lib/lp/app/javascript/tests/test_listing_navigator.js'
--- lib/lp/app/javascript/tests/test_listing_navigator.js	2017-07-21 17:49:13 +0000
+++ lib/lp/app/javascript/tests/test_listing_navigator.js	2017-07-21 17:49:13 +0000
@@ -30,7 +30,7 @@
             target = Y.Node.create('<div "id=#client-listing"></div>');
             target_parent.appendChild(target);
         }
-        lp_cache = {
+        var lp_cache = {
             context: {
                 resource_type_link: 'http://foo_type',
                 web_link: 'http://foo/bar'
@@ -250,8 +250,8 @@
          * Return a ListingNavigator ordered by 'intensity'
          */
         get_intensity_listing: function() {
-            mock_io = new Y.lp.testing.mockio.MockIo();
-            lp_cache = {
+            var mock_io = new Y.lp.testing.mockio.MockIo();
+            var lp_cache = {
                 context: {
                     resource_type_link: 'http://foo_type',
                     web_link: 'http://foo/bar'

=== modified file 'lib/lp/app/javascript/tests/test_longpoll.js'
--- lib/lp/app/javascript/tests/test_longpoll.js	2017-07-21 17:49:13 +0000
+++ lib/lp/app/javascript/tests/test_longpoll.js	2017-07-21 17:49:13 +0000
@@ -216,7 +216,7 @@
             var manager = longpoll.getLongPollManager();
             // Monkeypatch io to simulate a request timeout.
             manager._io = function(uri, config) {
-                response = {status: error_code};
+                var response = {status: error_code};
                 config.on.failure(4, response);
             };
 

=== modified file 'lib/lp/app/javascript/tests/test_lp_client.js'
--- lib/lp/app/javascript/tests/test_lp_client.js	2015-10-22 00:15:41 +0000
+++ lib/lp/app/javascript/tests/test_lp_client.js	2017-07-21 17:49:13 +0000
@@ -110,18 +110,18 @@
               "/api/devel/has/slash/field");
         },
         test_view_url: function() {
-            entry_repr = {web_link: 'http://example.com/context'};
+            var entry_repr = {web_link: 'http://example.com/context'};
             var context = new Y.lp.client.Entry(null, entry_repr, null);
-            expected = '/context/+myview/++mynamespace++';
-            actual = Y.lp.client.get_view_url(
+            var expected = '/context/+myview/++mynamespace++';
+            var actual = Y.lp.client.get_view_url(
                 context, '+myview', 'mynamespace');
             Assert.areEqual(expected, actual);
         },
         test_get_form_url: function() {
-            entry_repr = {web_link: 'http://example.com/context'};
+            var entry_repr = {web_link: 'http://example.com/context'};
             var context = new Y.lp.client.Entry(null, entry_repr, null);
-            expected = '/context/+myview/++form++';
-            actual = Y.lp.client.get_form_url(context, '+myview');
+            var expected = '/context/+myview/++form++';
+            var actual = Y.lp.client.get_form_url(context, '+myview');
             Assert.areEqual(expected, actual);
         },
         test_load_model: function(){

=== modified file 'lib/lp/blueprints/javascript/workitems.js'
--- lib/lp/blueprints/javascript/workitems.js	2012-06-13 14:34:14 +0000
+++ lib/lp/blueprints/javascript/workitems.js	2017-07-21 17:49:13 +0000
@@ -78,7 +78,7 @@
 
         // For each milestone, store an array containing the expander
         // object and the default state for it
-        default_expanded = widget_body.hasClass('default-expanded');
+        var default_expanded = widget_body.hasClass('default-expanded');
         expanders[index].push(new Array(expander, default_expanded));
     }
     namespace._add_expanders = add_expanders;

=== modified file 'lib/lp/bugs/javascript/buglisting_utils.js'
--- lib/lp/bugs/javascript/buglisting_utils.js	2013-03-20 03:41:40 +0000
+++ lib/lp/bugs/javascript/buglisting_utils.js	2017-07-21 17:49:13 +0000
@@ -277,7 +277,7 @@
         _extraRenderUI: function() {
             var form_content = this.buildFormContent();
             var on_submit_callback = Y.bind(this.handleOverlaySubmit, this);
-            util_overlay = new Y.lp.ui.FormOverlay({
+            var util_overlay = new Y.lp.ui.FormOverlay({
                 align: 'left',
                 headerContent: '<h2>Visible information</h2>',
                 centered: true,

=== modified file 'lib/lp/bugs/javascript/bugtask_index.js'
--- lib/lp/bugs/javascript/bugtask_index.js	2017-07-21 17:49:13 +0000
+++ lib/lp/bugs/javascript/bugtask_index.js	2017-07-21 17:49:13 +0000
@@ -164,7 +164,7 @@
     };
 
     // Call linkBranch() on the bug.
-    config = {
+    var config = {
         on: {
             success: function(bug_branch_entry) {
                 link_branch_link.toggleClass(
@@ -771,8 +771,8 @@
         // Do not show the team selection, if a user is not a member
         // of any team,
         if (conf.hide_assignee_team_selection) {
-            content_box = assignee_picker.get('contentBox');
-            search_box = content_box.one('.yui3-picker-search-box');
+            var content_box = assignee_picker.get('contentBox');
+            var search_box = content_box.one('.yui3-picker-search-box');
             search_box.setStyle('display', 'none');
             var info = Y.Node.create('<p style="padding-top: 1em;"></p>')
                 .set('text', 'You may only assign yourself because you are ' +
@@ -1021,7 +1021,7 @@
                     duration: namespace.ANIM_DURATION});
                 success_anim.run();
             }
-            batch_url_div = Y.one('#next-batch-url');
+            var batch_url_div = Y.one('#next-batch-url');
             if (Y.Lang.isValue(batch_url_div)) {
                 batched_comments_url = batch_url_div.get(
                     'innerHTML');

=== modified file 'lib/lp/bugs/javascript/subscription.js'
--- lib/lp/bugs/javascript/subscription.js	2013-04-09 05:05:39 +0000
+++ lib/lp/bugs/javascript/subscription.js	2017-07-21 17:49:13 +0000
@@ -352,7 +352,7 @@
  * ObjectLink class to unify link elements for better consistency.
  * Needed because some objects expose `title`, others expose `display_name`.
  */
-ObjectLink = function(self, title, url) {
+var ObjectLink = function(self, title, url) {
     return {
         self: self,
         title: title,
@@ -847,11 +847,12 @@
         }
     }
     var replacements = {}; 
-    for (var property in subscription.vars) {
+    var property;
+    for (property in subscription.vars) {
         replacements[property] = var_replacer(
             undefined, subscription.vars[property]);
     }
-    for (var property in additional_vars) {
+    for (property in additional_vars) {
         replacements[property] = var_replacer(
             property, additional_vars[property]);
     }

=== modified file 'lib/lp/bugs/javascript/tests/test_bug_subscription_portlet.js'
--- lib/lp/bugs/javascript/tests/test_bug_subscription_portlet.js	2013-03-20 03:41:40 +0000
+++ lib/lp/bugs/javascript/tests/test_bug_subscription_portlet.js	2017-07-21 17:49:13 +0000
@@ -380,10 +380,13 @@
             Y.Assert.areEqual('Change your mail subscription for this bug',
                               overlay.one('h2').get('text'));
             // We show the Discussion status.
-            var status = overlay.one('.subscription-status');
-            Y.Assert.isFalse(overlay.one('span.Discussion').hasClass('hidden'));
-            Y.Assert.isTrue(overlay.one('span.Details').hasClass('hidden'));
-            Y.Assert.isTrue(overlay.one('span.Lifecycle').hasClass('hidden'));
+            var status_node = overlay.one('.subscription-status');
+            Y.Assert.isFalse(status_node.one(
+                'span.Discussion').hasClass('hidden'));
+            Y.Assert.isTrue(status_node.one(
+                'span.Details').hasClass('hidden'));
+            Y.Assert.isTrue(status_node.one(
+                'span.Lifecycle').hasClass('hidden'));
             // The action links are visible except for Discussion.
             var action_links = overlay.one('.subscription-actions');
             Y.Assert.isTrue(action_links.one('.Discussion a').hasClass('hidden'));
@@ -402,10 +405,13 @@
             this.link().simulate('click');
             var overlay = Y.one('.pretty-overlay-window');
             // We show the Lifecycle status.
-            var status = overlay.one('.subscription-status');
-            Y.Assert.isTrue(overlay.one('span.Discussion').hasClass('hidden'));
-            Y.Assert.isFalse(overlay.one('span.Details').hasClass('hidden'));
-            Y.Assert.isTrue(overlay.one('span.Lifecycle').hasClass('hidden'));
+            var status_node = overlay.one('.subscription-status');
+            Y.Assert.isTrue(status_node.one(
+                'span.Discussion').hasClass('hidden'));
+            Y.Assert.isFalse(status_node.one(
+                'span.Details').hasClass('hidden'));
+            Y.Assert.isTrue(status_node.one(
+                'span.Lifecycle').hasClass('hidden'));
             // The action links are visible except for Lifecycle.
             var action_links = overlay.one('.subscription-actions');
             Y.Assert.isFalse(action_links.one(
@@ -425,10 +431,13 @@
             this.link().simulate('click');
             var overlay = Y.one('.pretty-overlay-window');
             // We show the Lifecycle status.
-            var status = overlay.one('.subscription-status');
-            Y.Assert.isTrue(overlay.one('span.Discussion').hasClass('hidden'));
-            Y.Assert.isTrue(overlay.one('span.Details').hasClass('hidden'));
-            Y.Assert.isFalse(overlay.one('span.Lifecycle').hasClass('hidden'));
+            var status_node = overlay.one('.subscription-status');
+            Y.Assert.isTrue(status_node.one(
+                'span.Discussion').hasClass('hidden'));
+            Y.Assert.isTrue(status_node.one(
+                'span.Details').hasClass('hidden'));
+            Y.Assert.isFalse(status_node.one(
+                'span.Lifecycle').hasClass('hidden'));
             // The action links are visible except for Lifecycle.
             var action_links = overlay.one('.subscription-actions');
             Y.Assert.isFalse(action_links.one(

=== modified file 'lib/lp/bugs/javascript/tests/test_official_bug_tags.js'
--- lib/lp/bugs/javascript/tests/test_official_bug_tags.js	2017-07-21 17:49:13 +0000
+++ lib/lp/bugs/javascript/tests/test_official_bug_tags.js	2017-07-21 17:49:13 +0000
@@ -27,8 +27,8 @@
         test_setup_bug_tags_table: function() {
             // The bug tags table is visible and the html form is not.
             module.setup_official_bug_tag_management();
-            html_form = Y.one('[name=launchpadform]');
-            tags_table = Y.one('#layout-table');
+            var html_form = Y.one('[name=launchpadform]');
+            var tags_table = Y.one('#layout-table');
             Y.Assert.areEqual('none', html_form.getStyle('display'));
             Y.Assert.areEqual('block', tags_table.getStyle('display'));
         },

=== modified file 'lib/lp/bugs/javascript/tests/test_pre_search.js'
--- lib/lp/bugs/javascript/tests/test_pre_search.js	2017-07-21 17:49:13 +0000
+++ lib/lp/bugs/javascript/tests/test_pre_search.js	2017-07-21 17:49:13 +0000
@@ -34,7 +34,7 @@
          * A loading message is added to the footer slot.
          */
         test_loading_message: function() {
-            picker = new FauxPicker();
+            var picker = new FauxPicker();
             module._do_pre_search(picker, 'BUG-ID');
             ArrayAssert.contains(
                 'set footer_slot = Loading suggestions...',
@@ -47,7 +47,7 @@
          * value.
          */
         test_min_search_length: function() {
-            picker = new FauxPicker();
+            var picker = new FauxPicker();
             module._do_pre_search(picker, 'BUG-ID');
             ArrayAssert.contains(
                 'get min_search_chars',
@@ -62,7 +62,7 @@
          * disbled so the user can enter a search.
          */
         test_disable_search_mode: function() {
-            picker = new FauxPicker();
+            var picker = new FauxPicker();
             module._do_pre_search(picker, 'BUG-ID');
             ArrayAssert.contains(
                 'fire search with BUG-ID',

=== modified file 'lib/lp/bugs/javascript/tests/test_subscription.js'
--- lib/lp/bugs/javascript/tests/test_subscription.js	2017-07-21 17:49:13 +0000
+++ lib/lp/bugs/javascript/tests/test_subscription.js	2017-07-21 17:49:13 +0000
@@ -299,7 +299,7 @@
             Y.Assert.areEqual(1, subs.length);
             // And there is a 'teams' variable containing all the team objects.
             var teams_found = [];
-            for (index = 0; index < subs[0].vars.teams.length; index++) {
+            for (var index = 0; index < subs[0].vars.teams.length; index++) {
                 teams_found.push(subs[0].vars.teams[index].title);
             }
             Y.ArrayAssert.itemsAreEqual(['team 1', 'team 2'], teams_found);
@@ -823,7 +823,7 @@
             Y.Assert.areEqual(1, subs.length);
             // And there is a 'teams' variable containing all the team objects.
             var teams_found = [];
-            for (index = 0; index < subs[0].vars.teams.length; index++) {
+            for (var index = 0; index < subs[0].vars.teams.length; index++) {
                 teams_found.push(subs[0].vars.teams[index].title);
             }
             Y.ArrayAssert.itemsAreEqual(['team 1', 'team 2'], teams_found);
@@ -889,7 +889,7 @@
             Y.Assert.areEqual(1, subs.length);
             // And there is a 'teams' variable containing all the team objects.
             var teams_found = [];
-            for (index = 0; index < subs[0].vars.teams.length; index++) {
+            for (var index = 0; index < subs[0].vars.teams.length; index++) {
                 teams_found.push(subs[0].vars.teams[index].title);
             }
             Y.ArrayAssert.itemsAreEqual(['team 1', 'team 2'], teams_found);
@@ -970,7 +970,8 @@
             };
             info.count = info.direct.count + info.from_duplicates.count;
 
-            direct_info = module._get_direct_subscription_information(info);
+            var direct_info = module._get_direct_subscription_information(
+                info);
             Y.Assert.areEqual(
                 module._reasons.NOT_SUBSCRIBED,
                 direct_info.reason);
@@ -993,7 +994,8 @@
             info.count = info.direct.count + info.from_duplicates.count;
             window.LP.cache.subscription_info.push(true);
 
-            direct_info = module._get_direct_subscription_information(info);
+            var direct_info = module._get_direct_subscription_information(
+                info);
             Y.Assert.areSame(
                 module._reasons.NOT_PERSONALLY_SUBSCRIBED,
                 direct_info.reason);
@@ -1015,7 +1017,8 @@
                 from_duplicates: _constructCategory(['dupe'])
             };
             info.count = info.direct.count + info.from_duplicates.count;
-            direct_info = module._get_direct_subscription_information(info);
+            var direct_info = module._get_direct_subscription_information(
+                info);
             Y.Assert.areSame(
                 module._reasons.NOT_PERSONALLY_SUBSCRIBED,
                 direct_info.reason);
@@ -1036,7 +1039,8 @@
                 muted: true
             };
             info.count = info.direct.count;
-            direct_info = module._get_direct_subscription_information(info);
+            var direct_info = module._get_direct_subscription_information(
+                info);
             Y.Assert.areSame(
                 module._reasons.MUTED_SUBSCRIPTION,
                 direct_info.reason);

=== modified file 'lib/lp/code/javascript/branch.subscription.js'
--- lib/lp/code/javascript/branch.subscription.js	2013-03-20 03:41:40 +0000
+++ lib/lp/code/javascript/branch.subscription.js	2017-07-21 17:49:13 +0000
@@ -128,7 +128,7 @@
                 var review_level_update = review_level.options[
                     review_level.selectedIndex].text;
 
-                config = {
+                var config = {
                     on: {
                         success: function(updated_entry) {
                             Y.fire('branch:subscriber-list-stale');

=== modified file 'lib/lp/code/javascript/branchmergeproposal.inlinecomments.js'
--- lib/lp/code/javascript/branchmergeproposal.inlinecomments.js	2017-07-21 11:01:00 +0000
+++ lib/lp/code/javascript/branchmergeproposal.inlinecomments.js	2017-07-21 17:49:13 +0000
@@ -161,6 +161,7 @@
         comment_date;
 
     if (comments_tr === null) {
+        var colspan;
         if (Y.all('table.ssdiff').size() > 0) {
             colspan = 4;
         } else {
@@ -174,7 +175,7 @@
         Y.one('#diff-line-' + comment.line_number)
             .insert(comments_tr, 'after');
     }
-    comments_div = comments_tr.one('div');
+    var comments_div = comments_tr.one('div');
 
     var newrow = Y.Node.create(
         '<div class="boardComment">' +

=== modified file 'lib/lp/code/javascript/branchmergeproposal.status.js'
--- lib/lp/code/javascript/branchmergeproposal.status.js	2013-03-20 22:32:47 +0000
+++ lib/lp/code/javascript/branchmergeproposal.status.js	2017-07-21 17:49:13 +0000
@@ -28,7 +28,7 @@
             Y.lp.app.errors.display_error(null, err);
         };
         status_choice_edit.on('save', function(e) {
-            config = {
+            var config = {
                 on: {
                     success: function(entry) {
                         var cb = status_choice_edit.get('contentBox');
@@ -51,7 +51,7 @@
                 }
             };
             status_content.one('img').set('src', '/@@/spinner');
-            lp_client = new Y.lp.client.Launchpad();
+            var lp_client = new Y.lp.client.Launchpad();
             lp_client.named_post(
                 LP.cache.context.self_link, 'setStatus', config);
 
@@ -74,7 +74,7 @@
  */
 function update_summary() {
     var existing_summary = Y.one('#proposal-summary tbody');
-    SUMMARY_SNIPPET = '+pagelet-summary';
+    var SUMMARY_SNIPPET = '+pagelet-summary';
     Y.io(SUMMARY_SNIPPET, {
             on: {
                 success: function(id, response) {
@@ -86,10 +86,12 @@
                     var old_pos = 1;
                     var new_size = new_rows.size();
                     var old_size = old_rows.size();
+                    var new_row;
+                    var old_row;
 
                     while (new_pos < new_size && old_pos < old_size) {
-                        var new_row = new_rows.item(new_pos);
-                        var old_row = old_rows.item(old_pos);
+                        new_row = new_rows.item(new_pos);
+                        old_row = old_rows.item(old_pos);
                         var new_id = new_row.get('id');
                         var old_id = old_row.get('id');
                         if (new_id == old_id) {
@@ -113,12 +115,12 @@
                     }
                     // Remove all left over old rows, and add all left over new rows.
                     while (old_pos < old_size) {
-                        var old_row = old_rows.item(old_pos);
+                        old_row = old_rows.item(old_pos);
                         ++old_pos;
                         old_row.remove();
                     }
                     while (new_pos < new_size) {
-                        var new_row = new_rows.item(new_pos);
+                        new_row = new_rows.item(new_pos);
                         ++new_pos;
                         if (new_row.get('id') != 'summary-row-b-diff') {
                             existing_summary.append(new_row);

=== modified file 'lib/lp/code/javascript/requestbuild_overlay.js'
--- lib/lp/code/javascript/requestbuild_overlay.js	2012-09-10 21:02:05 +0000
+++ lib/lp/code/javascript/requestbuild_overlay.js	2017-07-21 17:49:13 +0000
@@ -52,7 +52,7 @@
 namespace.hookUpDailyBuildsSchedule = function() {
     var logged_in = LP.links.me !== undefined;
     if (logged_in) {
-        build_now_link = Y.one('#request-daily-build');
+        var build_now_link = Y.one('#request-daily-build');
         if( build_now_link !== null ) {
           build_now_link.removeClass('hidden');
           Y.lp.code.requestbuild_overlay.connect_requestdailybuild();
@@ -316,17 +316,14 @@
             success: request_build_response_handler.getSuccessHandler(
                 function(handler, id, response) {
                 var errors = [],
-                    error_header = null,
-                    error_header_text = "",
-                    build_info, build_html, error_info,
-                    nr_new, info_header, field_name;
+                    field_name;
                 // The content type is used to tell a fully successful
                 // request from a partially successful one. Successful
                 // responses simply return the HTML snippet for the builds
                 // table. If this ever causes problems, the view should
                 // be changed to always return JSON and to provide an
                 // attribute that identifies the type of response.
-                content_type = response.getResponseHeader('Content-type');
+                var content_type = response.getResponseHeader('Content-type');
                 if( content_type !== 'application/json' ) {
                     // We got the HTML for the builds back, we're done.
                     request_build_overlay.hide();
@@ -340,16 +337,16 @@
                     // supports displaying errors so we will construct
                     // our own HTML where the informational text will be
                     // appropriately displayed.
-                    build_info = Y.JSON.parse(response.responseText);
+                    var build_info = Y.JSON.parse(response.responseText);
 
                     // The result of rendering the +builds view
-                    build_html = build_info.builds;
+                    var build_html = build_info.builds;
                     // Any builds already pending (informational only)
-                    pending_build_info = build_info.already_pending;
+                    var pending_build_info = build_info.already_pending;
                     // Other more critical errors
-                    error_info = build_info.errors;
+                    var error_info = build_info.errors;
 
-                    info_header = get_info_header(
+                    var info_header = get_info_header(
                         get_new_builds_message(
                             build_html, current_builds),
                             pending_build_info);
@@ -359,7 +356,7 @@
                             errors.push(error_info[field_name]);
                         }
                     }
-                    error_container = Y.Node.create('<div></div>');
+                    var error_container = Y.Node.create('<div></div>');
                     if (info_header !== null) {
                         error_container.append(info_header);
                         if (errors.length > 0) {
@@ -514,7 +511,7 @@
             success:
                 function(build_info) {
                     var distro_nodes,
-                        size, build_record, distro_name, archive_token;
+                        size, build_record, distro_name, archive_token, i;
                     // We save the inner html of each distro series checkbox
                     // so we can restore it when required.
                     distro_nodes = get_distroseries_nodes();

=== modified file 'lib/lp/code/javascript/tests/test_requestbuild_overlay.js'
--- lib/lp/code/javascript/tests/test_requestbuild_overlay.js	2013-03-20 03:41:40 +0000
+++ lib/lp/code/javascript/tests/test_requestbuild_overlay.js	2017-07-21 17:49:13 +0000
@@ -16,7 +16,7 @@
         LP.cache.context = {
             web_link: "http://code.launchpad.dev/~foobar/myrecipe"};
         // Prepare testbed.
-        fixture = Y.one("#testbed");
+        var fixture = Y.one("#testbed");
         var template = Y.one('#build-schedule-template').getContent();
         var test_node = Y.Node.create(template);
         fixture.append(test_node);
@@ -110,7 +110,7 @@
             web_link: "http://code.launchpad.dev/~foobar/myrecipe";,
             self_link: "http://api.launchpad.dev/devel/~foobar/myrecipe"};
         // Prepare testbed.
-        fixture = Y.one("#testbed");
+        var fixture = Y.one("#testbed");
         var template = Y.one('#build-schedule-template').getContent();
         var test_node = Y.Node.create(template);
         fixture.append(test_node);
@@ -235,7 +235,7 @@
     name: "lp.code.requestbuild_overlay.buildschedule",
 
     setUp: function() {
-        fixture = Y.one("#testbed");
+        var fixture = Y.one("#testbed");
         var template = Y.one('#build-schedule-template').getContent();
         var test_node = Y.Node.create(template);
         fixture.append(test_node);

=== modified file 'lib/lp/registry/javascript/distroseries/tests/test_widgets.js'
--- lib/lp/registry/javascript/distroseries/tests/test_widgets.js	2012-10-26 10:00:20 +0000
+++ lib/lp/registry/javascript/distroseries/tests/test_widgets.js	2017-07-21 17:49:13 +0000
@@ -243,7 +243,7 @@
 
         test_populate_archindep_tags: function() {
             this.setup_widget_client();
-            distroseries = {api_uri: "ubuntu/hoary", value: "3"};
+            var distroseries = {api_uri: "ubuntu/hoary", value: "3"};
             this.widget._populate_archindep_tags(distroseries);
             Assert.areEqual("i386", this.widget._archindep_tags["3"]);
         },

=== modified file 'lib/lp/registry/javascript/distroseriesdifferences_details.js'
--- lib/lp/registry/javascript/distroseriesdifferences_details.js	2017-07-21 17:49:13 +0000
+++ lib/lp/registry/javascript/distroseriesdifferences_details.js	2017-07-21 17:49:13 +0000
@@ -58,9 +58,9 @@
         this._toggle.toggleClass('treeCollapsed').toggleClass('treeExpanded');
 
         // Only insert if there isn't already a container row there.
-        var detail_row = this._row.next();
-        if (detail_row === null ||
-            !detail_row.hasClass('diff-extra')) {
+        var details_row = this._row.next();
+        if (details_row === null ||
+            !details_row.hasClass('diff-extra')) {
             details_row = Y.Node.create([
                 '<table><tr class="diff-extra hidden ',
                 parsed.source_name + '">',
@@ -719,7 +719,7 @@
              }
             else if (state === 'COMPLETED') {
                 set_package_diff_status(container, 'COMPLETED');
-                url_uri = [
+                var url_uri = [
                     dsd_link,
                     parent ? 'parent_package_diff_url' : 'package_diff_url'
                     ].join('/');
@@ -898,6 +898,7 @@
     var nb_inputs = all_inputs.size();
     var summary = Y.Node.create('<div><ul></ul></div>'),
         summary_ul = summary.one('ul');
+    var i;
     for (i=0; i < Math.min(namespace.MAX_PACKAGES, nb_inputs) ; i++) {
         var input = all_inputs.shift();
         var tr = input.ancestor('tr');

=== modified file 'lib/lp/registry/javascript/milestonetable.js'
--- lib/lp/registry/javascript/milestonetable.js	2013-04-09 05:05:39 +0000
+++ lib/lp/registry/javascript/milestonetable.js	2017-07-21 17:49:13 +0000
@@ -27,7 +27,7 @@
 
     module._ensure_table_is_seen = function(tbody) {
         // Remove the 'hidden' class from the table to ensure it is visible.
-        table = tbody.ancestor();
+        var table = tbody.ancestor();
         table.removeClass('hidden');
         };
 

=== modified file 'lib/lp/registry/javascript/structural-subscription.js'
--- lib/lp/registry/javascript/structural-subscription.js	2017-07-21 17:49:13 +0000
+++ lib/lp/registry/javascript/structural-subscription.js	2017-07-21 17:49:13 +0000
@@ -1055,8 +1055,7 @@
  * Overlay must not have a recipient picker, but a simple recipient label.
  */
 function set_recipient_label(content_node, filter_info) {
-    var recipient_label = content_node.one('input[name="recipient"] + span'),
-        teams = LP.cache.administratedTeams;
+    var recipient_label = content_node.one('input[name="recipient"] + span');
     if (filter_info !== undefined && filter_info.subscriber_is_team) {
         var team = get_team(filter_info.subscriber_link);
         recipient_label.set('text', team.title);
@@ -1509,6 +1508,7 @@
                      .set('href', subscription_data.target_url)
                      .set('text', subscription_data.target_title));
 
+    var j;
     for (j=0; j<subscription_data.filters.length; j++) {
         var filter_info = subscription_data.filters[j];
         var filter = filter_info.filter;

=== modified file 'lib/lp/registry/javascript/team.js'
--- lib/lp/registry/javascript/team.js	2014-01-08 07:33:18 +0000
+++ lib/lp/registry/javascript/team.js	2017-07-21 17:49:13 +0000
@@ -37,7 +37,7 @@
         addmember_link.removeClass('hidden');
         spinner.addClass('hidden');
     };
-    lp_client = new Y.lp.client.Launchpad();
+    var lp_client = new Y.lp.client.Launchpad();
 
     var error_handler = new Y.lp.client.ErrorHandler();
     error_handler.clearProgressUI = disable_spinner;
@@ -45,7 +45,7 @@
         Y.lp.app.errors.display_error(addmember_link, error_msg);
     };
 
-    addmember_config = {
+    var addmember_config = {
         on: {
             success: function(change_and_status) {
                 var did_status_change = change_and_status[0];
@@ -98,16 +98,16 @@
                         count = parseInt(count, 10) + 1;
                         count_elem.set('innerHTML', count);
                     }
-                    person_repr = Y.Node.create(
+                    var person_repr = Y.Node.create(
                         '<li>' + person_html + '</li>');
                     members_section.removeClass('hidden');
                     members_ul.insertBefore(person_repr, first_node);
-                    anim = Y.lp.anim.green_flash({node: person_repr});
+                    var anim = Y.lp.anim.green_flash({node: person_repr});
                     anim.run();
                     disable_spinner();
                 };
 
-                xhtml_person_config = {
+                var xhtml_person_config = {
                     on: {
                         success: xhtml_person_handler,
                         failure: error_handler.getFailureHandler()

=== modified file 'lib/lp/registry/javascript/team_mailinglists.js'
--- lib/lp/registry/javascript/team_mailinglists.js	2013-03-20 22:32:47 +0000
+++ lib/lp/registry/javascript/team_mailinglists.js	2017-07-21 17:49:13 +0000
@@ -106,7 +106,7 @@
         // sophisticated model creation will be needed for threaded by
         // subject.
         var i;
-        filter_func = function(item) {
+        var filter_func = function(item) {
             var nested_ids = messages[i].nested_messages;
             var index = Y.Array.indexOf(nested_ids, item.message_id);
             return (index !== -1);
@@ -132,7 +132,8 @@
                     // Create a new array of the nested messages from the ids
                     // provided by the current message's `nested_messages`
                     // parameter.
-                    nested_messages = Y.Array.filter(messages, filter_func);
+                    var nested_messages = Y.Array.filter(
+                        messages, filter_func);
                     this._create_mustache_model(
                         nested_messages,
                         mustache_model,

=== modified file 'lib/lp/registry/javascript/tests/test_distroseriesdifferences_details.js'
--- lib/lp/registry/javascript/tests/test_distroseriesdifferences_details.js	2017-07-21 17:49:13 +0000
+++ lib/lp/registry/javascript/tests/test_distroseriesdifferences_details.js	2017-07-21 17:49:13 +0000
@@ -166,7 +166,7 @@
         test_add_msg_node: function() {
             var msg_txt = 'Exemple text';
             var msg_node = Y.Node.create(msg_txt);
-            placeholder = Y.one('#placeholder');
+            var placeholder = Y.one('#placeholder');
             module.add_msg_node(placeholder, msg_node);
             Y.Assert.areEqual(
                 placeholder.one('.package-diff-placeholder').get('innerHTML'),
@@ -669,7 +669,7 @@
             };
             // The event comment_added will be fired.
             var event_fired = false;
-            event_handler = function(e) {
+            var event_handler = function(e) {
                 event_fired = true;
                 Y.ObjectAssert.areEqual(comment_entry, e.details[0]);
             };
@@ -746,7 +746,7 @@
             };
             // The event comment_added will be fired.
             var event_fired = false;
-            event_handler = function(e) {
+            var event_handler = function(e) {
                 event_fired = true;
                 Y.ObjectAssert.areEqual(comment_entry, e.details[0]);
             };
@@ -795,11 +795,11 @@
         setUp: function() {
             Y.one("#placeholder").append(Y.Node.create(whole_table));
             var first_poll = true;
-            pending_voc = [
+            var pending_voc = [
                 {"token": "PENDING", "selected": true, "title": "Pending"},
                 {"token": "COMPLETED", "title": "Completed"},
                 {"token": "FAILED", "title": "Failed"}];
-            completed_voc = [
+            var completed_voc = [
                 {"token": "PENDING", "title": "Pending"},
                 {"token": "COMPLETED", "selected": true, "title": "Completed"},
                 {"token": "FAILED", "title": "Failed"}];
@@ -908,7 +908,7 @@
 
         create_rows: function(missing_packages) {
             var placeholder = Y.one("#placeholder");
-            rows_data = [
+            var rows_data = [
                 ['evolution', '2.0.9-1', '2.0.8-4', missing_packages],
                 ['package', '2.0', '1.0', missing_packages],
                 ['package2', '4.0.4', '0.0.2', missing_packages],

=== modified file 'lib/lp/registry/javascript/tests/test_structural_subscription.js'
--- lib/lp/registry/javascript/tests/test_structural_subscription.js	2017-07-21 17:49:13 +0000
+++ lib/lp/registry/javascript/tests/test_structural_subscription.js	2017-07-21 17:49:13 +0000
@@ -626,9 +626,9 @@
             module.setup(this.configuration);
             module._show_add_overlay(this.configuration);
             // After the setup the overlay should be in the DOM.
-            overlay = Y.one('#accordion-overlay');
+            var overlay = Y.one('#accordion-overlay');
             Assert.isNotNull(overlay);
-            submit_button = Y.one('.yui3-lazr-formoverlay-actions button');
+            var submit_button = Y.one('.yui3-lazr-formoverlay-actions button');
             submit_button.simulate('click');
 
             var error_box = Y.one('.yui3-lazr-formoverlay-errors');
@@ -645,9 +645,9 @@
             module.setup(this.configuration);
             module._show_add_overlay(this.configuration);
             // After the setup the overlay should be in the DOM.
-            overlay = Y.one('#accordion-overlay');
+            var overlay = Y.one('#accordion-overlay');
             Assert.isNotNull(overlay);
-            submit_button = Y.one('.yui3-lazr-formoverlay-actions button');
+            var submit_button = Y.one('.yui3-lazr-formoverlay-actions button');
             submit_button.simulate('click');
             // We are now looking at the state after the named post has been
             // called, but before it has returned with a failure.
@@ -675,9 +675,9 @@
             module.setup(this.configuration);
             module._show_add_overlay(this.configuration);
             // After the setup the overlay should be in the DOM.
-            overlay = Y.one('#accordion-overlay');
+            var overlay = Y.one('#accordion-overlay');
             Assert.isNotNull(overlay);
-            submit_button = Y.one('.yui3-lazr-formoverlay-actions button');
+            var submit_button = Y.one('.yui3-lazr-formoverlay-actions button');
             submit_button.simulate('click');
 
             // Put this stubbed function back.
@@ -1507,7 +1507,7 @@
             var called_method = false;
 
             // Keep the old module's _show_add_overlay, so we can override.
-            old_show_add_overlay = module._show_add_overlay;
+            var old_show_add_overlay = module._show_add_overlay;
             var test = this;
             module._show_add_overlay = function(config) {
                 module._show_add_overlay = old_show_add_overlay;

=== modified file 'lib/lp/registry/javascript/tests/timeline.js'
--- lib/lp/registry/javascript/tests/timeline.js	2013-03-20 03:41:40 +0000
+++ lib/lp/registry/javascript/tests/timeline.js	2017-07-21 17:49:13 +0000
@@ -267,7 +267,7 @@
     name: 'utils',
 
     test_isCanvasSupported: function() {
-        supported = Y.lp.registry.timeline.isCanvasSupported();
+        var supported = Y.lp.registry.timeline.isCanvasSupported();
         Assert.isTrue(supported);
         }
     }));

=== modified file 'lib/lp/registry/javascript/timeline.js'
--- lib/lp/registry/javascript/timeline.js	2017-07-21 17:49:13 +0000
+++ lib/lp/registry/javascript/timeline.js	2017-07-21 17:49:13 +0000
@@ -67,7 +67,7 @@
  * @class Position
  * @constructor
  */
-Position = function(x, y) {
+var Position = function(x, y) {
     this.x = x;
     this.y = y;
 };
@@ -86,7 +86,7 @@
  * @class SeriesLine
  * @constructor
  */
-SeriesLine = function(timeline_graph, series, start) {
+var SeriesLine = function(timeline_graph, series, start) {
     this.timeline_graph = timeline_graph;
     this.series = series;
     this.start = start;
@@ -296,7 +296,7 @@
  * @class ProjectLine
  * @constructor
  */
-ProjectLine = function(timeline_graph, timeline) {
+var ProjectLine = function(timeline_graph, timeline) {
     if (timeline.length === 0) {
         throw new Error("The timeline array is empty.");
     }

=== modified file 'lib/lp/services/webhooks/javascript/deliveries.js'
--- lib/lp/services/webhooks/javascript/deliveries.js	2015-10-20 06:47:41 +0000
+++ lib/lp/services/webhooks/javascript/deliveries.js	2017-07-21 17:49:13 +0000
@@ -177,7 +177,7 @@
             '<td>{{event_type}}</td>',
             '<td>{{status}}</td>',
             '</tr>'].join(' ');
-        context = {
+        var context = {
             sprite: this._pick_sprite(delivery),
             date: Y.lp.app.date.approximatedate(Y.lp.app.date.parse_date(
                 delivery.resource.get("date_created"))),

=== modified file 'lib/lp/snappy/javascript/tests/test_snap.edit.js'
--- lib/lp/snappy/javascript/tests/test_snap.edit.js	2016-06-20 21:17:58 +0000
+++ lib/lp/snappy/javascript/tests/test_snap.edit.js	2017-07-21 17:49:13 +0000
@@ -85,6 +85,7 @@
                 'auto_build_pocket'
                 ];
             var field;
+            var i;
             module.setup();
             for (i = 0; i < fields.length; i++) {
                 field = Y.DOM.byId('field.' + fields[i]);

=== modified file 'lib/lp/snappy/javascript/tests/test_snap.update_build_statuses.js'
--- lib/lp/snappy/javascript/tests/test_snap.update_build_statuses.js	2016-05-14 00:25:07 +0000
+++ lib/lp/snappy/javascript/tests/test_snap.update_build_statuses.js	2017-07-21 17:49:13 +0000
@@ -22,7 +22,7 @@
         test_dom_updater_plugin_attached: function() {
             Y.Assert.isUndefined(this.table._plugins.updater);
             module.setup(this.table);
-            updater = Y.lp.soyuz.dynamic_dom_updater.DynamicDomUpdater;
+            var updater = Y.lp.soyuz.dynamic_dom_updater.DynamicDomUpdater;
             Y.Assert.areEqual(updater, this.table._plugins.updater);
             // Unplug plugin to prevent DOM autorefresh during testing.
             // DOM autorefresh should be tested in DynamicDomUpdater testsuite.
@@ -33,7 +33,7 @@
         test_parameter_evaluator: function() {
             // parameterEvaluator should return an object with the ids of
             // builds in pending states.
-            params = module.parameterEvaluator(this.table);
+            var params = module.parameterEvaluator(this.table);
             Y.lp.testing.assert.assert_equal_structure(
                 {snap_build_ids: ["1"]}, params);
         },
@@ -42,7 +42,7 @@
             // parameterEvaluator should return empty if no builds remaining
             // in pending states.
             this.td_status.setAttribute("class", "build_status FULLYBUILT");
-            params = module.parameterEvaluator(this.table);
+            var params = module.parameterEvaluator(this.table);
             Y.Assert.isNull(params);
             // reset td class to the original value
             this.td_status.setAttribute("class", this.td_status_class);
@@ -54,7 +54,7 @@
             // stopUpdatesCheck should return true if no pending builds exist.
             this.td_status.setAttribute("class", "build_status FULLYBUILT");
             Y.Assert.isTrue(module.stopUpdatesCheck(this.table));
-            for (i = 0; i < module.pending_states.length; i++) {
+            for (var i = 0; i < module.pending_states.length; i++) {
                 this.td_status.setAttribute(
                     "class", "build_status " + module.pending_states[i]);
                 Y.Assert.isFalse(module.stopUpdatesCheck(this.table));
@@ -65,14 +65,16 @@
 
         test_update_build_status_dom: function() {
             var original_a_href = this.td_status_a.get("href");
-            data = {"1": {
+            var data = {
+                "1": {
                     "status": "BUILDING",
                     "build_log_url": null,
                     "when_complete_estimate": true,
                     "buildstate": "Currently building",
                     "build_log_size": null,
                     "when_complete": "in 1 minute"
-                }};
+                }
+            };
             module.domUpdate(this.table, data);
             Y.Assert.areEqual(
                 "build_status BUILDING", this.td_status.getAttribute("class"));
@@ -87,14 +89,16 @@
         },
 
         test_update_build_date_dom: function() {
-            data = {"1": {
+            var data = {
+                "1": {
                     "status": "NEEDSBUILD",
                     "build_log_url": "/+build/1/+files/build1.txt.gz",
                     "when_complete_estimate": true,
                     "buildstate": "Needs building",
                     "build_log_size": 12345,
                     "when_complete": "in 30 seconds"
-                }};
+                }
+            };
             module.domUpdate(this.table, data);
             Y.Assert.areEqual(
                 "in 30 seconds (estimated) buildlog (12345 bytes)",

=== modified file 'lib/lp/soyuz/javascript/lp_dynamic_dom_updater.js'
--- lib/lp/soyuz/javascript/lp_dynamic_dom_updater.js	2012-07-20 16:04:49 +0000
+++ lib/lp/soyuz/javascript/lp_dynamic_dom_updater.js	2017-07-21 17:49:13 +0000
@@ -99,7 +99,7 @@
      * @extends DomUpdater
      * @constructor
      */
-    DynamicDomUpdater = function(config) {
+    var DynamicDomUpdater = function(config) {
         DynamicDomUpdater.superclass.constructor.apply(this, arguments);
     };
     DynamicDomUpdater.NAME = 'dynamicdomupdater';

=== modified file 'lib/lp/soyuz/javascript/update_archive_build_statuses.js'
--- lib/lp/soyuz/javascript/update_archive_build_statuses.js	2011-10-27 11:36:13 +0000
+++ lib/lp/soyuz/javascript/update_archive_build_statuses.js	2017-07-21 17:49:13 +0000
@@ -173,6 +173,7 @@
                 // If the length of the builds has changed, then assume
                 // the ui has changed, otherwise we don't update them.
                 var current_build_links = td_elem.getElementsByTagName('a');
+                var num_current_links;
                 if (current_build_links === null) {
                     num_current_links = 0;
                 } else {

=== modified file 'lib/lp/translations/javascript/importqueue.js'
--- lib/lp/translations/javascript/importqueue.js	2012-09-05 23:06:42 +0000
+++ lib/lp/translations/javascript/importqueue.js	2017-07-21 17:49:13 +0000
@@ -49,7 +49,7 @@
         '<div class="new show-output">' +
         compose_button(shown) +
         '</div>';
-    new_button = button_field.create(text);
+    var new_button = button_field.create(text);
     button_field.replaceChild(new_button, button);
     new_button.on('click', (shown ? hide_output : show_output));
     return button_field.get('parentNode');
@@ -132,7 +132,7 @@
         var value_box = content_box.one('.value');
         var new_status = status_choice.get('value');
         value_box.setContent(new_status);
-        config = {
+        var config = {
             on: {
                 success: function(entry) {
                     Y.Array.each(conf.items, function(item) {
@@ -149,7 +149,7 @@
             }
         };
         Y.log(config);
-        lp_client = new Y.lp.client.Launchpad();
+        var lp_client = new Y.lp.client.Launchpad();
         var entry_uri = '+imports/' + entry_id;
         lp_client.named_post(entry_uri, 'setStatus', config);
     });

=== modified file 'lib/lp/translations/javascript/pofile.js'
--- lib/lp/translations/javascript/pofile.js	2014-01-30 15:04:06 +0000
+++ lib/lp/translations/javascript/pofile.js	2017-07-21 17:49:13 +0000
@@ -34,7 +34,7 @@
  * for dismission.
  */
 var setupSuggestionDismissal = function(e) {
-    all_dismiss_boxes = Y.all('.dismiss_action');
+    var all_dismiss_boxes = Y.all('.dismiss_action');
     if (all_dismiss_boxes !== null) {
         all_dismiss_boxes.each(function(checkbox) {
             var classbase = checkbox.get('id');
@@ -136,7 +136,8 @@
 };
 
 var setWorkingMode = function (mode) {
-    if(mode === WORKING_MODE_TRANSLATOR) {
+    var text;
+    if (mode === WORKING_MODE_TRANSLATOR) {
         text = 'Translator&nbsp;mode';
     } else {
         text = 'Reviewer&nbsp;mode';

=== modified file 'lib/lp/translations/javascript/sourcepackage_sharing_details.js'
--- lib/lp/translations/javascript/sourcepackage_sharing_details.js	2017-07-21 17:49:13 +0000
+++ lib/lp/translations/javascript/sourcepackage_sharing_details.js	2017-07-21 17:49:13 +0000
@@ -179,10 +179,11 @@
     var key;
     for (key in form_data){
         if (form_data.hasOwnProperty(key)){
-            encoded_key = encodeURIComponent(key);
-            values = form_data[key];
+            var encoded_key = encodeURIComponent(key);
+            var values = form_data[key];
+            var i;
             for (i=0; i < values.length; i++){
-                form_entry = (
+                var form_entry = (
                     encoded_key + '=' + encodeURIComponent(values[i]));
                 form_data_entries.push(form_entry);
             }
@@ -278,6 +279,7 @@
     var i;
     // Each callback is bound to the next, so we use reverse order.
     for(i = arguments.length-1; i >= 0; i--){
+        var callback;
         if (i === arguments.length - 1) {
             callback = arguments[i];
         }
@@ -410,7 +412,7 @@
         this.get('tsconfig').get('autoimport').set('complete', complete);
     },
     set_translations_usage: function(usage) {
-        complete = (
+        var complete = (
             usage === namespace.usage.launchpad ||
             usage === namespace.usage.external);
         var usage_check = this.get('tsconfig').get('translations_usage');
@@ -577,14 +579,14 @@
     var import_overlay = create_form_overlay(
         '<h2>Import settings<h2>', function(form_data) {
         Y.log(form_data['field.translations_autoimport_mode']);
-        mode = enum_title(
+        var mode = enum_title(
             form_data, 'field.translations_autoimport_mode',
             namespace.autoimport_modes);
         var product_series = sharing_controller.get('productseries');
         product_series.set('translations_autoimport_mode', mode);
         var autoimport_check = sharing_controller.get(
             'tsconfig').get('autoimport');
-        handler = new IOHandler(sharing_controller, autoimport_check);
+        var handler = new IOHandler(sharing_controller, autoimport_check);
         function update_controller() {
             sharing_controller.set_autoimport_mode(mode);
             handler.show_success();

=== modified file 'lib/lp/translations/javascript/tests/test_importqueue.js'
--- lib/lp/translations/javascript/tests/test_importqueue.js	2012-10-26 10:00:20 +0000
+++ lib/lp/translations/javascript/tests/test_importqueue.js	2017-07-21 17:49:13 +0000
@@ -40,7 +40,7 @@
     name: 'importqueue macros',
 
     setUp: function() {
-        fixture = Y.one("#fixture");
+        var fixture = Y.one("#fixture");
         var template = Y.one('#import-queue-listing').getContent();
         var test_node = Y.Node.create(template);
         fixture.append(test_node);
@@ -57,7 +57,7 @@
             Y.one('#import-queue-submit').hasClass('hidden'));
         Y.Assert.isTrue(
             Y.one('.status-select').hasClass('hidden'));
-        status_choice = Y.one('.status-choice');
+        var status_choice = Y.one('.status-choice');
         Y.Assert.isFalse(status_choice.hasClass('hidden'));
     }
 }));

=== modified file 'lib/lp/translations/javascript/tests/test_poexport.js'
--- lib/lp/translations/javascript/tests/test_poexport.js	2012-10-26 10:00:20 +0000
+++ lib/lp/translations/javascript/tests/test_poexport.js	2017-07-21 17:49:13 +0000
@@ -11,7 +11,7 @@
         name: 'PO export',
 
         setUp: function() {
-            fixture = Y.one("#fixture");
+            var fixture = Y.one("#fixture");
             var template = Y.one('#pofile-export').getContent();
             var test_node = Y.Node.create(template);
             fixture.append(test_node);
@@ -25,13 +25,13 @@
             // The change handler was not added if the checbox does not exist.
             var pochanged = Y.one('#div_pochanged');
             pochanged.get('parentNode').removeChild(pochanged);
-            handler_added = namespace.initialize_pofile_export_page();
+            var handler_added = namespace.initialize_pofile_export_page();
             Y.Assert.isFalse(handler_added);
         },
 
         test_initialize_pofile_export_page_with_pochanged_default_po: function() {
             // The checkbox is enabled when PO is selected.
-            handler_added = namespace.initialize_pofile_export_page();
+            var handler_added = namespace.initialize_pofile_export_page();
             Y.Assert.isTrue(handler_added);
             Y.Assert.isTrue(
                 Y.one('#po-format-only').hasClass('hidden'));
@@ -43,7 +43,7 @@
 
         test_initialize_pofile_export_page_with_pochanged_mo_selected: function() {
             // The checkbox is disabled when MO is selected.
-            handler_added = namespace.initialize_pofile_export_page();
+            var handler_added = namespace.initialize_pofile_export_page();
             Y.Assert.isTrue(handler_added);
             var formatlist = Y.one('#div_format select');
             formatlist.set('selectedIndex', 1);

=== modified file 'lib/lp/translations/javascript/tests/test_sourcepackage_sharing_details.js'
--- lib/lp/translations/javascript/tests/test_sourcepackage_sharing_details.js	2012-10-26 10:00:20 +0000
+++ lib/lp/translations/javascript/tests/test_sourcepackage_sharing_details.js	2017-07-21 17:49:13 +0000
@@ -145,8 +145,8 @@
                         '<p><a href="http://fake";>fake</a></p>');
                     }
             };
-            unlink_overlay = import_overlay;
-            usage_overlay = import_overlay;
+            var unlink_overlay = import_overlay;
+            var usage_overlay = import_overlay;
             ctrl.configure(
                 model, {}, unlink_overlay, import_overlay, usage_overlay);
             var tsconfig = ctrl.get('tsconfig');
@@ -202,8 +202,8 @@
                         '<p><a href="http://fake";>fake</a></p>');
                     }
             };
-            unlink_overlay = import_overlay;
-            usage_overlay = import_overlay;
+            var unlink_overlay = import_overlay;
+            var usage_overlay = import_overlay;
             ctrl.configure(
                 null_model, {}, unlink_overlay, import_overlay,
                 usage_overlay);
@@ -394,9 +394,9 @@
             var check = controller.get('tsconfig').get('branch');
             check.set('pending', true);
             controller.update_check(check);
-            spinner = Y.one(controller.spinner_selector(check));
+            var spinner = Y.one(controller.spinner_selector(check));
             Y.Assert.isFalse(spinner.hasClass('hidden'));
-            io_handler = new IOHandler(controller, check);
+            var io_handler = new IOHandler(controller, check);
             io_handler.show_success();
             Y.Assert.isFalse(check.get('pending'));
             Y.Assert.isTrue(spinner.hasClass('hidden'));


Follow ups