launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #27323
[Merge] ~cjwatson/launchpad:eslint-no-undef into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:eslint-no-undef into launchpad:master.
Commit message:
Fix various no-undef errors from eslint
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/406457
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:eslint-no-undef into launchpad:master.
diff --git a/lib/lp/app/javascript/autocomplete.js b/lib/lp/app/javascript/autocomplete.js
index 44b7c00..b808eba 100644
--- a/lib/lp/app/javascript/autocomplete.js
+++ b/lib/lp/app/javascript/autocomplete.js
@@ -70,7 +70,7 @@ YUI.add('lp.app.autocomplete', function (Y) {
repo_node.updated = function () {
var uri = namespace.getRepositoryCompletionURI(this);
- path_node = namespace.getPathNode(this);
+ var path_node = namespace.getPathNode(this);
path_node.ac.set("source", uri);
}
// ideally this should take node to rebind `this` in the function
diff --git a/lib/lp/app/tour/launchpad-tour.js b/lib/lp/app/tour/launchpad-tour.js
index 923e5eb..9f1693e 100644
--- a/lib/lp/app/tour/launchpad-tour.js
+++ b/lib/lp/app/tour/launchpad-tour.js
@@ -2,7 +2,7 @@
var dropDownTimeOut = 0;
-dropDownBg = new Image();
+var dropDownBg = new Image();
dropDownBg.src="images/bg-dropdown.png";
$(document).ready(function(){
@@ -25,4 +25,4 @@ function dropDownOut() {
function dropDownIn() {
clearTimeout(dropDownTimeOut);
$("#navigation-drop-down").addClass("menu");
-}
\ No newline at end of file
+}
diff --git a/lib/lp/bugs/javascript/buglisting.js b/lib/lp/bugs/javascript/buglisting.js
index eba9f40..daf0d71 100644
--- a/lib/lp/bugs/javascript/buglisting.js
+++ b/lib/lp/bugs/javascript/buglisting.js
@@ -324,9 +324,8 @@ YUI.add('lp.bugs.buglisting', function (Y) {
// The advanced search page contains sort options that have
// no related data fields we can display. If a user has selected
// such a sort order, this sort option should always be visible.
- var check_visibility =
- field_visibility['show_' + this.get('active_sort_key')];
- if (check_visibility === undefined) {
+ var active_sort_key = this.get('active_sort_key');
+ if (field_visibility['show_' + active_sort_key] === undefined) {
that.orderby.always_display.push(active_sort_key);
}
diff --git a/lib/lp/bugs/javascript/official_bug_tags.js b/lib/lp/bugs/javascript/official_bug_tags.js
index c5c8107..092bad4 100644
--- a/lib/lp/bugs/javascript/official_bug_tags.js
+++ b/lib/lp/bugs/javascript/official_bug_tags.js
@@ -7,23 +7,12 @@
* @submodule official_bug_tags
*/
+/* global official_bug_tags, used_bug_tags, valid_name_pattern */
+
YUI.add('lp.bugs.official_bug_tags', function(Y) {
var namespace = Y.namespace('lp.bugs.official_bug_tags');
-/*
- * official_tags and other_tags hold the lists of tags currently in use.
- */
-var official_tags;
-var other_tags;
-
-/*
- * Regular expression object for validating new tags. Initialized from a JSON
- * representation of the regular expression used in the server code, embedded
- * in the page.
- */
-var valid_name_re = new RegExp(valid_name_pattern);
-
/**
* Filter an array using a predicate function.
*
@@ -203,11 +192,11 @@ var render_tag_lists = function() {
official_tags_ul.set('innerHTML', '');
other_tags_ul.set('innerHTML', '');
- Y.each(official_tags, function(item) {
+ Y.each(namespace.official_tags, function(item) {
official_tags_ul.appendChild(make_tag_li(item));
});
- Y.each(other_tags, function(item) {
+ Y.each(namespace.other_tags, function(item) {
other_tags_ul.appendChild(make_tag_li(item));
});
};
@@ -222,7 +211,7 @@ var render_tag_lists = function() {
*/
var save_tags = function() {
var tags = [];
- Y.each(official_tags, function(item) {
+ Y.each(namespace.official_tags, function(item) {
tags.push(item.tag);
});
Y.one('#field-official_bug_tags').set('value', tags.join(' '));
@@ -296,33 +285,34 @@ var get_updated_tags = function(from_tags_ul, from_tags, to_tags) {
var on_new_tag_add = function() {
var new_tag = Y.Lang.trim(Y.one('#new-tag-text').get('value'));
var new_tag_already_official = false;
- Y.each(official_tags, function(item) {
+ Y.each(namespace.official_tags, function(item) {
new_tag_already_official = (
new_tag_already_official || (item.tag === new_tag));
});
var new_tag_already_used = false;
- Y.each(other_tags, function(item) {
+ Y.each(namespace.other_tags, function(item) {
new_tag_already_used = (
new_tag_already_used || (item.tag === new_tag));
});
if (new_tag_already_used) {
- Y.each(other_tags, function(item) {
+ Y.each(namespace.other_tags, function(item) {
if (item.tag === new_tag) {
- official_tags.push(item);
+ namespace.official_tags.push(item);
}
});
- other_tags = filter_array(other_tags, function(item) {
- return item.tag !== new_tag;
- });
+ namespace.other_tags =
+ filter_array(namespace.other_tags, function(item) {
+ return item.tag !== new_tag;
+ });
}
if (!new_tag_already_official && !new_tag_already_used) {
- if (valid_name_re.test(new_tag)) {
+ if (namespace.valid_name_re.test(new_tag)) {
var count = used_bug_tags[new_tag];
if (count === null) {
count = 0;
}
- official_tags.push({tag: new_tag, count: 0});
- sort_tags(official_tags);
+ namespace.official_tags.push({tag: new_tag, count: 0});
+ sort_tags(namespace.official_tags);
Y.one('#new-tag-text').set('value', '');
Y.one('#new-tag-add').set('disabled', true);
Y.one('#save-button').set('disabled', false);
@@ -371,8 +361,13 @@ var display_error = function() {
* @method setup_official_bug_tag_management
*/
namespace.setup_official_bug_tag_management = function() {
- official_tags = get_official_bug_tags(official_bug_tags);
- other_tags = get_other_bug_tags(used_bug_tags);
+ // official_tags and other_tags hold the lists of tags currently in use.
+ namespace.official_tags = get_official_bug_tags(official_bug_tags);
+ namespace.other_tags = get_other_bug_tags(used_bug_tags);
+ // Regular expression object for validating new tags. Initialized from
+ // a JSON representation of the regular expression used in the server
+ // code, embedded in the page.
+ namespace.valid_name_re = new RegExp(valid_name_pattern);
var layout_table = Y.one('#layout-table');
@@ -389,9 +384,9 @@ namespace.setup_official_bug_tag_management = function() {
// tags from the list of unofficial tags to the list of official tags.
Y.one('#add-official-tags').on('click', function(e) {
var updated_tags = get_updated_tags(
- other_tags_ul, other_tags, official_tags);
- other_tags = updated_tags.from_tags;
- official_tags = updated_tags.to_tags;
+ other_tags_ul, namespace.other_tags, namespace.official_tags);
+ namespace.other_tags = updated_tags.from_tags;
+ namespace.official_tags = updated_tags.to_tags;
render_tag_lists();
enable_arrows();
Y.one('#save-button').set('disabled', false);
@@ -401,9 +396,9 @@ namespace.setup_official_bug_tag_management = function() {
// tags from the list of official tags to the list of unofficial tags.
Y.one('#remove-official-tags').on('click', function(e) {
var updated_tags = get_updated_tags(
- official_tags_ul, official_tags, other_tags);
- official_tags = updated_tags.from_tags;
- other_tags = updated_tags.to_tags;
+ official_tags_ul, namespace.official_tags, namespace.other_tags);
+ namespace.official_tags = updated_tags.from_tags;
+ namespace.other_tags = updated_tags.to_tags;
render_tag_lists();
enable_arrows();
Y.one('#save-button').set('disabled', false);
diff --git a/lib/lp/buildmaster/javascript/buildstatus.js b/lib/lp/buildmaster/javascript/buildstatus.js
index fcbc411..e61b8af 100644
--- a/lib/lp/buildmaster/javascript/buildstatus.js
+++ b/lib/lp/buildmaster/javascript/buildstatus.js
@@ -41,7 +41,7 @@ YUI.add('lp.buildmaster.buildstatus', function(Y) {
if (!(build_summary.status in icon_map)) {
return false;
}
- icon_props = icon_map[build_summary.status];
+ var icon_props = icon_map[build_summary.status];
node.setAttribute('class', 'build_status');
node.addClass(build_summary.status);
diff --git a/lib/lp/code/javascript/branch.subscription.js b/lib/lp/code/javascript/branch.subscription.js
index f473a53..9372050 100644
--- a/lib/lp/code/javascript/branch.subscription.js
+++ b/lib/lp/code/javascript/branch.subscription.js
@@ -135,7 +135,6 @@ Y.extend(SubscriptionWidget, Y.Widget, {
},
failure: function(id, response) {
Y.log(response.responseText);
- subscription_form_overlay.show();
}
},
parameters: {
diff --git a/lib/lp/translations/javascript/importqueue.js b/lib/lp/translations/javascript/importqueue.js
index 9dbba94..c83d0a3 100644
--- a/lib/lp/translations/javascript/importqueue.js
+++ b/lib/lp/translations/javascript/importqueue.js
@@ -5,6 +5,8 @@
* @requires oop, event, node, widget, plugin, overlay, lp.ui.choiceedit
*/
+/* global choice_confs */
+
YUI.add('lp.translations.importqueue', function(Y) {
var namespace = Y.namespace('lp.translations.importqueue');
diff --git a/lib/lp/translations/javascript/importqueueentry.js b/lib/lp/translations/javascript/importqueueentry.js
index 4ea6737..7281bb2 100644
--- a/lib/lp/translations/javascript/importqueueentry.js
+++ b/lib/lp/translations/javascript/importqueueentry.js
@@ -5,6 +5,8 @@
* @requires node, lp.anim
*/
+/* global template_domains */
+
YUI.add('lp.translations.importqueueentry', function(Y) {
var namespace = Y.namespace('lp.translations.importqueueentry');
diff --git a/lib/lp/translations/javascript/pofile.js b/lib/lp/translations/javascript/pofile.js
index 806d54e..c87dca9 100644
--- a/lib/lp/translations/javascript/pofile.js
+++ b/lib/lp/translations/javascript/pofile.js
@@ -5,6 +5,10 @@
* @requires anim, cookie, event-key, event, node
*/
+/* global autofocus_field, documentation_cookie, plural_forms,
+ * translations_order
+ */
+
YUI.add('lp.translations.pofile', function(Y) {
var namespace = Y.namespace('lp.translations.pofile');
diff --git a/lib/lp/translations/javascript/tests/test_importqueue.js b/lib/lp/translations/javascript/tests/test_importqueue.js
index 7c947a3..302bf95 100644
--- a/lib/lp/translations/javascript/tests/test_importqueue.js
+++ b/lib/lp/translations/javascript/tests/test_importqueue.js
@@ -51,7 +51,8 @@ tests.suite.add(new Y.Test.Case({
},
test_initialize_import_queue_page: function() {
- choice_confs = make_choice_confs(); // setup global choice_confs.
+ // Set up global choice_confs.
+ window.choice_confs = make_choice_confs();
namespace.initialize_import_queue_page(Y);
Y.Assert.isTrue(
Y.one('#import-queue-submit').hasClass('hidden'));