← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:upgrade-eslint into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:upgrade-eslint into launchpad:master.

Commit message:
Upgrade to eslint 8.2.0

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/411530

This involved a number of fixes, mainly to `hasOwnProperty` calls.  I fixed violations of the following rules:

  https://eslint.org/docs/rules/no-prototype-builtins
  https://eslint.org/docs/rules/no-redeclare
  https://eslint.org/docs/rules/no-shadow-restricted-names

The fix to `lib/lp/bugs/javascript/bugtarget_portlet_bugtags.js` looks odd from a Python point of view, but the formal parameter in question was unused, and generally speaking it's OK to call JavaScript functions with more arguments than they were declared with, so dropping this parameter doesn't break any API.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:upgrade-eslint into launchpad:master.
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 7c8290a..67848b8 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -33,7 +33,7 @@ repos:
     hooks:
     -   id: isort
 -   repo: https://github.com/pre-commit/mirrors-eslint
-    rev: v4.2.0
+    rev: v8.2.0
     hooks:
     -   id: eslint
         args: [--quiet]
diff --git a/lib/lp/app/javascript/client.js b/lib/lp/app/javascript/client.js
index 7b77759..87fb497 100644
--- a/lib/lp/app/javascript/client.js
+++ b/lib/lp/app/javascript/client.js
@@ -32,7 +32,7 @@ YUI.add('lp.client', function(Y) {
         var name;
         var html_name;
         for (name in cache) {
-            if (cache.hasOwnProperty(name)) {
+            if (Object.prototype.hasOwnProperty.call(cache, name)) {
                 var old_value = cache[name];
                 var new_value = entry.get(name);
                 if (name !== 'lp_html') {
@@ -57,7 +57,8 @@ YUI.add('lp.client', function(Y) {
                     // using the values here to determine if the field has
                     // changed, so we can just update the cache.
                     for (html_name in old_value) {
-                        if (old_value.hasOwnProperty(html_name)) {
+                        if (Object.prototype.hasOwnProperty.call(
+                                old_value, html_name)) {
                             old_value[html_name] = new_value[html_name];
                         }
                     }
@@ -118,13 +119,13 @@ YUI.add('lp.client', function(Y) {
             var key;
             var index;
             for (key in collection) {
-                if (collection.hasOwnProperty(key)) {
+                if (Object.prototype.hasOwnProperty.call(collection, key)) {
                     keys.push(key);
                 }
             }
             keys.sort();
             for (index in keys) {
-                if (keys.hasOwnProperty(index)) {
+                if (Object.prototype.hasOwnProperty.call(keys, index)) {
                     key = keys[index];
                     var value;
                     try {
@@ -336,7 +337,7 @@ YUI.add('lp.client', function(Y) {
         var name;
         var cached_object;
         for (name in LP.cache) {
-            if (LP.cache.hasOwnProperty(name)) {
+            if (Object.prototype.hasOwnProperty.call(LP.cache, name)) {
                 cached_object = LP.cache[name];
                 /*jslint continue:true*/
                 if (!Y.Lang.isValue(cached_object)) {
@@ -519,7 +520,8 @@ YUI.add('lp.client', function(Y) {
             this.uri = uri;
             var key;
             for (key in representation) {
-                if (representation.hasOwnProperty(key)) {
+                if (Object.prototype.hasOwnProperty.call(
+                        representation, key)) {
                     this[key] = representation[key];
                 }
             }
@@ -615,7 +617,7 @@ YUI.add('lp.client', function(Y) {
         // an attribute-change event listener for caching purposes.
         var key;
         for (key in representation) {
-            if (representation.hasOwnProperty(key)) {
+            if (Object.prototype.hasOwnProperty.call(representation, key)) {
                 this.addAttr(key, {value: representation[key]});
                 this.on(key + "Change", this.mark_as_dirty);
             }
@@ -718,7 +720,7 @@ YUI.add('lp.client', function(Y) {
             var data = module.append_qs("", "ws.op", operation_name);
             var name;
             for (name in parameters) {
-                if (parameters.hasOwnProperty(name)) {
+                if (Object.prototype.hasOwnProperty.call(parameters, name)) {
                     data = module.append_qs(data, name, parameters[name]);
                 }
             }
@@ -735,7 +737,7 @@ YUI.add('lp.client', function(Y) {
             uri = module.normalize_uri(uri);
             data = module.append_qs(data, "ws.op", operation_name);
             for (name in parameters) {
-                if (parameters.hasOwnProperty(name)) {
+                if (Object.prototype.hasOwnProperty.call(parameters, name)) {
                     data = module.append_qs(data, name, parameters[name]);
                 }
             }
@@ -784,7 +786,7 @@ YUI.add('lp.client', function(Y) {
             var name;
             if (headers !== undefined) {
                 for (name in headers) {
-                    if (headers.hasOwnProperty(name)) {
+                    if (Object.prototype.hasOwnProperty.call(headers, name)) {
                         extra_headers[name] = headers[name];
                     }
                 }
@@ -826,7 +828,8 @@ YUI.add('lp.client', function(Y) {
                         new_representation = {};
                     }
                     for (key in representation) {
-                        if (representation.hasOwnProperty(key)) {
+                        if (Object.prototype.hasOwnProperty.call(
+                                representation, key)) {
                             var value = representation[key];
                             if (Y.Lang.isValue(value)) {
                                 value = this.wrap_resource(
diff --git a/lib/lp/app/javascript/expander.js b/lib/lp/app/javascript/expander.js
index 0c34a49..eb58a8e 100644
--- a/lib/lp/app/javascript/expander.js
+++ b/lib/lp/app/javascript/expander.js
@@ -98,14 +98,14 @@ Y.extend(ExpanderRadioController, Y.Base, {
     },
 
     _registerExpander: function(group_id, expander) {
-        if (!this.expanders.hasOwnProperty(group_id)) {
+        if (!Object.prototype.hasOwnProperty.call(this.expanders, group_id)) {
             this.expanders[group_id] = [];
         }
         this.expanders[group_id].push(expander);
     },
 
     _deregisterExpander: function(group_id, expander) {
-        if (this.expanders.hasOwnProperty(group_id)) {
+        if (Object.prototype.hasOwnProperty.call(this.expanders, group_id)) {
             var idx = Y.Array.indexOf(this.expanders[group_id], expander);
             if (idx !== -1) {
                 this.expanders[group_id].splice(idx, 1);
diff --git a/lib/lp/app/javascript/gallery-accordion/gallery-accordion.js b/lib/lp/app/javascript/gallery-accordion/gallery-accordion.js
index 91d9776..55e4500 100644
--- a/lib/lp/app/javascript/gallery-accordion/gallery-accordion.js
+++ b/lib/lp/app/javascript/gallery-accordion/gallery-accordion.js
@@ -329,7 +329,8 @@ Y.Accordion = Y.Base.create( AccName, Y.Widget, [], {
         itemHandles = this._itemsHandles[ item ];
 
         for( itemHandle in itemHandles ){
-            if( itemHandles.hasOwnProperty( itemHandle ) ){
+            if( Object.prototype.hasOwnProperty.call(
+		    itemHandles, itemHandle ) ){
                 itemHandle = itemHandles[ itemHandle ];
                 itemHandle.detach();
             }
@@ -1079,7 +1080,7 @@ Y.Accordion = Y.Base.create( AccName, Y.Widget, [], {
         this._setItemsProperties();
 
         for( item in forCollapsing ){
-            if( forCollapsing.hasOwnProperty( item ) ){
+            if( Object.prototype.hasOwnProperty.call( forCollapsing, item ) ){
                 itemCont = forCollapsing[ item ];
 
                 this._collapseItem( itemCont.item );
@@ -1089,7 +1090,7 @@ Y.Accordion = Y.Base.create( AccName, Y.Widget, [], {
         heightPerStretchItem = this._adjustStretchItems();
 
         for( item in forExpanding ){
-            if( forExpanding.hasOwnProperty( item ) ){
+            if( Object.prototype.hasOwnProperty.call( forExpanding, item ) ){
                 itemCont = forExpanding[ item ];
                 item = itemCont.item;
                 height = heightPerStretchItem;
@@ -1121,14 +1122,16 @@ Y.Accordion = Y.Base.create( AccName, Y.Widget, [], {
         forExpanding = this._forExpanding;
 
         for( itemData in forCollapsing ){
-            if( forCollapsing.hasOwnProperty( itemData ) ){
+            if( Object.prototype.hasOwnProperty.call(
+		    forCollapsing, itemData ) ){
                 itemData = forCollapsing[ itemData ];
                 this._setItemProperties( itemData.item, false, false );
             }
         }
 
         for( itemData in forExpanding ){
-            if( forExpanding.hasOwnProperty( itemData ) ){
+            if( Object.prototype.hasOwnProperty.call(
+		    forExpanding, itemData ) ){
                 itemData = forExpanding[ itemData ];
                 this._setItemProperties( itemData.item, true, itemData.alwaysVisible );
             }
diff --git a/lib/lp/app/javascript/information_type.js b/lib/lp/app/javascript/information_type.js
index 5279237..6b7812d 100644
--- a/lib/lp/app/javascript/information_type.js
+++ b/lib/lp/app/javascript/information_type.js
@@ -210,7 +210,7 @@ ns.save_success = function(widget, context, value, subscribers_list,
         var cache_data = result_data.cache_data;
         var item;
         for (item in cache_data) {
-            if (cache_data.hasOwnProperty(item)) {
+            if (Object.prototype.hasOwnProperty.call(cache_data, item)) {
                 LP.cache[item] = cache_data[item];
             }
         }
@@ -331,7 +331,7 @@ ns.get_cache_data_from_key = function(cache_value,
     var cache = LP.cache.information_type_data;
     var key;
     for (key in cache) {
-        if (cache.hasOwnProperty(key)) {
+        if (Object.prototype.hasOwnProperty.call(cache, key)) {
             if (cache[key][cache_field] === cache_value) {
                 return cache[key][data_field];
             }
@@ -352,7 +352,7 @@ ns.cache_to_choicesource = function (cache) {
     var data = [];
     var key;
     for (key in cache) {
-        if (cache.hasOwnProperty(key)) {
+        if (Object.prototype.hasOwnProperty.call(cache, key)) {
             data.push(cache[key]);
         }
     }
diff --git a/lib/lp/app/javascript/listing_navigator.js b/lib/lp/app/javascript/listing_navigator.js
index 6262f28..e7344f4 100644
--- a/lib/lp/app/javascript/listing_navigator.js
+++ b/lib/lp/app/javascript/listing_navigator.js
@@ -180,7 +180,7 @@ Y.extend(module.ListingNavigator, Y.Base, {
      * Default event handler for history:change events.
      */
     default_history_changed: function(e) {
-        if (e.newVal.hasOwnProperty('batch_key')) {
+        if (Object.prototype.hasOwnProperty.call(e.newVal, 'batch_key')) {
             this.pre_fetch_batches();
             this.render();
             this._bindUI();
diff --git a/lib/lp/app/javascript/lp-links.js b/lib/lp/app/javascript/lp-links.js
index eb4740e..ffe5c90 100644
--- a/lib/lp/app/javascript/lp-links.js
+++ b/lib/lp/app/javascript/lp-links.js
@@ -36,7 +36,7 @@ YUI.add('lp.app.links', function(Y) {
 
         Y.all('.'+link_class).each(function(link) {
             var href = link.getAttribute('href');
-            if(invalid_links.hasOwnProperty(href)) {
+            if(Object.prototype.hasOwnProperty.call(invalid_links, href)) {
                 var invalid_link_msg = invalid_links[href];
                 link.removeClass(link_class);
                 link.addClass('invalid-link');
@@ -45,7 +45,8 @@ YUI.add('lp.app.links', function(Y) {
                     e.halt();
                     alert(invalid_link_msg);
                 });
-            } else if(valid_links.hasOwnProperty(href)) {
+            } else if(Object.prototype.hasOwnProperty.call(
+                    valid_links, href)) {
                 var valid_link_msg = valid_links[href];
                 link.setAttribute('title', valid_link_msg);
             }
diff --git a/lib/lp/app/javascript/subscribers/subscribers_list.js b/lib/lp/app/javascript/subscribers/subscribers_list.js
index a513354..a975037 100644
--- a/lib/lp/app/javascript/subscribers/subscribers_list.js
+++ b/lib/lp/app/javascript/subscribers/subscribers_list.js
@@ -184,7 +184,7 @@ SubscribersLoader.prototype._subscriber_is_me = function(subscriber) {
  *     supported levels, default_subscriber_level is used instead.
  */
 SubscribersLoader.prototype._addSubscriber = function(subscriber, level) {
-    if (!this.subscriber_levels.hasOwnProperty(level)) {
+    if (!Object.prototype.hasOwnProperty.call(this.subscriber_levels, level)) {
         // Default to 'subscribed at unknown level' for unrecognized
         // subscription levels.
         level = this.default_subscriber_level;
@@ -568,7 +568,8 @@ function SubscribersList(config) {
         this.subscriber_level_order = [];
         var level;
         for (level in this.subscriber_levels) {
-            if (this.subscriber_levels.hasOwnProperty(level)) {
+            if (Object.prototype.hasOwnProperty.call(
+                    this.subscriber_levels, level)) {
                 this.subscriber_level_order.push(level);
             }
         }
@@ -959,7 +960,8 @@ SubscribersList.prototype._createSubscriberNode = function(subscriber) {
  */
 SubscribersList.prototype._checkSubscriptionLevel = function(level) {
     if (Y.Object.size(this.subscriber_levels) > 0
-            && !this.subscriber_levels.hasOwnProperty(level)) {
+            && !Object.prototype.hasOwnProperty.call(
+                    this.subscriber_levels, level)) {
         Y.error(
             'Level "' + level + '" is not an acceptable subscription level.');
     }
diff --git a/lib/lp/app/javascript/subscribers/tests/test_subscribers_list.js b/lib/lp/app/javascript/subscribers/tests/test_subscribers_list.js
index be3bb4a..f333ad3 100644
--- a/lib/lp/app/javascript/subscribers/tests/test_subscribers_list.js
+++ b/lib/lp/app/javascript/subscribers/tests/test_subscribers_list.js
@@ -149,7 +149,8 @@ YUI.add('lp.app.subscribers.subscribers_list.test', function (Y) {
                 subscriber_levels: subscriber_levels});
             var level;
             for (level in subscriber_levels) {
-                if (subscriber_levels.hasOwnProperty(level)) {
+                if (Object.prototype.hasOwnProperty.call(
+                        subscriber_levels, level)) {
                     list._checkSubscriptionLevel(level);
                 }
             }
@@ -1494,7 +1495,8 @@ YUI.add('lp.app.subscribers.subscribers_list.test', function (Y) {
 
            var config_var;
            for (config_var in default_config) {
-               if (default_config.hasOwnProperty(config_var)) {
+               if (Object.prototype.hasOwnProperty.call(
+                       default_config, config_var)) {
                    Y.Assert.areEqual(
                        default_config[config_var], loader[config_var],
                        'Unexpected config value for ' + config_var);
@@ -1535,7 +1537,8 @@ YUI.add('lp.app.subscribers.subscribers_list.test', function (Y) {
 
            var config_var;
            for (config_var in override_config) {
-               if (override_config.hasOwnProperty(config_var)) {
+               if (Object.prototype.hasOwnProperty.call(
+                       override_config, config_var)) {
                    Y.Assert.areEqual(
                        override_config[config_var], loader[config_var],
                        'Unexpected config value for ' + config_var);
diff --git a/lib/lp/app/javascript/testing/testrunner.js b/lib/lp/app/javascript/testing/testrunner.js
index 27a61c8..fdcb528 100644
--- a/lib/lp/app/javascript/testing/testrunner.js
+++ b/lib/lp/app/javascript/testing/testrunner.js
@@ -1,7 +1,7 @@
 /* Copyright 2011 Canonical Ltd.  This software is licensed under the
  * GNU Affero General Public License version 3 (see the file LICENSE). */
 
-// eslint-disable-next-line no-unused-vars
+// eslint-disable-next-line no-redeclare, no-unused-vars
 var YUI_config = {
     filter: 'raw',
     combine: false,
diff --git a/lib/lp/app/javascript/ui/banner.js b/lib/lp/app/javascript/ui/banner.js
index deb7524..c5e5c9c 100644
--- a/lib/lp/app/javascript/ui/banner.js
+++ b/lib/lp/app/javascript/ui/banner.js
@@ -219,7 +219,8 @@ YUI.add('lp.ui.banner', function (Y) {
                     // that apply.
                     var features = this.get('features');
                     for (key in features) {
-                       if (features.hasOwnProperty(key)) {
+                       if (Object.prototype.hasOwnProperty.call(
+                               features, key)) {
                            var obj = features[key];
                            if (obj.is_beta) {
                                content = content + [
diff --git a/lib/lp/bugs/javascript/buglisting.js b/lib/lp/bugs/javascript/buglisting.js
index daf0d71..7f3996a 100644
--- a/lib/lp/bugs/javascript/buglisting.js
+++ b/lib/lp/bugs/javascript/buglisting.js
@@ -56,7 +56,7 @@ YUI.add('lp.bugs.buglisting', function (Y) {
             var result = this.get('history').get();
             var key_source = this.get('field_visibility_defaults');
             Y.each(result, function(value, key) {
-                if (!key_source.hasOwnProperty(key)){
+                if (!Object.prototype.hasOwnProperty.call(key_source, key)) {
                     delete result[key];
                 }
             });
diff --git a/lib/lp/bugs/javascript/buglisting_utils.js b/lib/lp/bugs/javascript/buglisting_utils.js
index 078419a..0812bfa 100644
--- a/lib/lp/bugs/javascript/buglisting_utils.js
+++ b/lib/lp/bugs/javascript/buglisting_utils.js
@@ -148,7 +148,7 @@ YUI.add('lp.buglisting_utils', function(Y) {
                 input_html,
                 input_node;
             for (item in fields) {
-                if (fields.hasOwnProperty(item)) {
+                if (Object.prototype.hasOwnProperty.call(fields, item)) {
                     name = item;
                     display_name = display_names[item];
                     if (fields[item] === true) {
@@ -235,7 +235,7 @@ YUI.add('lp.buglisting_utils', function(Y) {
             var fields = this.get('model').get_field_visibility();
             var member;
             for (member in fields) {
-                if (fields.hasOwnProperty(member)) {
+                if (Object.prototype.hasOwnProperty.call(fields, member)) {
                     if (Y.Lang.isValue(data[member])) {
                         // If this field exists in data, set it true.
                         // in field_visibility.
@@ -334,7 +334,8 @@ YUI.add('lp.buglisting_utils', function(Y) {
         var order_key;
         var data_key;
         for (data_key in data_visibility) {
-            if (data_visibility.hasOwnProperty(data_key) &&
+            if (Object.prototype.hasOwnProperty.call(
+                    data_visibility, data_key) &&
                 data_key.substring(0, 5) === 'show_') {
                 order_key = data_key.replace('show_', '');
                 orderby_visibility[order_key] = data_visibility[data_key];
diff --git a/lib/lp/bugs/javascript/bugtarget_portlet_bugtags.js b/lib/lp/bugs/javascript/bugtarget_portlet_bugtags.js
index cfa29dc..42cf36d 100644
--- a/lib/lp/bugs/javascript/bugtarget_portlet_bugtags.js
+++ b/lib/lp/bugs/javascript/bugtarget_portlet_bugtags.js
@@ -43,7 +43,7 @@ namespace.hide_spinner = function() {
 /**
  * Display the tag list and set up events for showing more/fewer tags.
  */
-namespace.on_success = function(transactionid, response, arguments) {
+namespace.on_success = function(transactionid, response) {
     var portlet = Y.one('#portlet-tags');
     if (Y.Lang.trim(response.responseText).length === 0) {
         portlet.addClass('hidden');
diff --git a/lib/lp/bugs/javascript/bugtask_index.js b/lib/lp/bugs/javascript/bugtask_index.js
index ef0324b..4fafb50 100644
--- a/lib/lp/bugs/javascript/bugtask_index.js
+++ b/lib/lp/bugs/javascript/bugtask_index.js
@@ -289,7 +289,7 @@ namespace.setup_bugtask_table = function() {
     };
     var id;
     for (id in bugtask_data) {
-        if (bugtask_data.hasOwnProperty(id)) {
+        if (Object.prototype.hasOwnProperty.call(bugtask_data, id)) {
             var conf = bugtask_data[id];
             var form_row = Y.one('#' + conf.form_row_id);
             // If there's associated expandable bugtask form for the bug task,
@@ -887,7 +887,8 @@ Y.extend(MeTooChoiceSource, Y.ChoiceSource, {
         var others_affected_count = this.get('others_affected_count');
         var source_names = this._getSourceNames(others_affected_count);
         Y.each(this.get('items'), function(item) {
-            if (source_names.hasOwnProperty(item.value)) {
+            if (Object.prototype.hasOwnProperty.call(
+                    source_names, item.value)) {
                 item.source_name = source_names[item.value];
             }
         });
diff --git a/lib/lp/bugs/javascript/subscription.js b/lib/lp/bugs/javascript/subscription.js
index 6faa0f5..8263c07 100644
--- a/lib/lp/bugs/javascript/subscription.js
+++ b/lib/lp/bugs/javascript/subscription.js
@@ -329,7 +329,7 @@ namespace._choose_by_number = choose_by_number;
 function replace_textual_references(info, cache) {
     var key;
     for (key in info) {
-        if (info.hasOwnProperty(key)) {
+        if (Object.prototype.hasOwnProperty.call(info, key)) {
             switch (typeof info[key]){
                 case "object":
                     replace_textual_references(info[key], cache);
@@ -480,7 +480,7 @@ function add_subscription_to_set(subscriptions, subscription) {
             var are_vars_same = true;
             var param;
             for (param in sub.vars) {
-                if (sub.vars.hasOwnProperty(param)) {
+                if (Object.prototype.hasOwnProperty.call(sub.vars, param)) {
                     // We only check vars from the existing subscription.
                     // Theoretically, there could be a var on `subscription`
                     // not present on `sub`, but we're guarding against that
@@ -827,7 +827,7 @@ function safely_render_description(subscription, additional_vars) {
                 final_element = get_objectlink_html(vars.pop());
                 text_elements = [];
                 for (index in vars) {
-                    if (vars.hasOwnProperty(index)) {
+                    if (Object.prototype.hasOwnProperty.call(vars, index)) {
                         text_elements.push(get_objectlink_html(vars[index]));
                     }
                 }
@@ -841,7 +841,7 @@ function safely_render_description(subscription, additional_vars) {
             }
         } else {
             if (Y.Lang.isObject(additional_vars) &&
-                additional_vars.hasOwnProperty(key)) {
+                Object.prototype.hasOwnProperty.call(additional_vars, key)) {
                 return get_objectlink_html(additional_vars[key]);
             }
         }
@@ -849,13 +849,14 @@ function safely_render_description(subscription, additional_vars) {
     var replacements = {};
     var property;
     for (property in subscription.vars) {
-        if (subscription.vars.hasOwnProperty(property)) {
+        if (Object.prototype.hasOwnProperty.call(
+                subscription.vars, property)) {
             replacements[property] = var_replacer(
                 undefined, subscription.vars[property]);
         }
     }
     for (property in additional_vars) {
-        if (additional_vars.hasOwnProperty(property)) {
+        if (Object.prototype.hasOwnProperty.call(additional_vars, property)) {
             replacements[property] = var_replacer(
                 property, additional_vars[property]);
         }
@@ -1193,7 +1194,7 @@ function reveal_direct_description_actions(direct_node, direct_info) {
     // actions after a successful direct subscription action.  After we hide
     // these, we will reveal the ones we want, immediately below.
     for (key in action_ids) {
-        if (action_ids.hasOwnProperty(key)) {
+        if (Object.prototype.hasOwnProperty.call(action_ids, key)) {
             direct_node.one('#'+action_ids[key]).addClass('hidden');
         }
     }
diff --git a/lib/lp/code/javascript/requestbuild_overlay.js b/lib/lp/code/javascript/requestbuild_overlay.js
index 0874ede..361eba8 100644
--- a/lib/lp/code/javascript/requestbuild_overlay.js
+++ b/lib/lp/code/javascript/requestbuild_overlay.js
@@ -352,7 +352,8 @@ var do_request_builds = function(data, io_provider) {
                             pending_build_info);
 
                     for (field_name in error_info) {
-                        if (error_info.hasOwnProperty(field_name)) {
+                        if (Object.prototype.hasOwnProperty.call(
+                                error_info, field_name)) {
                             errors.push(error_info[field_name]);
                         }
                     }
diff --git a/lib/lp/registry/javascript/distroseries/widgets.js b/lib/lp/registry/javascript/distroseries/widgets.js
index cf22fbc..e4791ac 100644
--- a/lib/lp/registry/javascript/distroseries/widgets.js
+++ b/lib/lp/registry/javascript/distroseries/widgets.js
@@ -475,7 +475,8 @@ Y.extend(ArchitecturesChoiceListWidget, formwidgets.ChoiceListWidget, {
             var remove_das = true;
             var arch = das.entries[i].get('architecture_tag');
             for (ds in this._distroseries) {
-                if (this._distroseries.hasOwnProperty(ds) &&
+                if (Object.prototype.hasOwnProperty.call(
+                        this._distroseries, ds) &&
                     ds !== distroseries_id) {
                    var other_das = this._distroseries[ds];
                    for (j=0; j<other_das.entries.length; j++) {
diff --git a/lib/lp/registry/javascript/structural-subscription.js b/lib/lp/registry/javascript/structural-subscription.js
index a380679..24c01a2 100644
--- a/lib/lp/registry/javascript/structural-subscription.js
+++ b/lib/lp/registry/javascript/structural-subscription.js
@@ -272,7 +272,8 @@ function check_for_errors_in_overlay(overlay) {
     var errors = [];
     var field;
     for (field in overlay.field_errors) {
-        if (overlay.field_errors.hasOwnProperty(field)) {
+        if (Object.prototype.hasOwnProperty.call(
+                overlay.field_errors, field)) {
             if (overlay.field_errors[field]) {
                 has_errors = true;
                 errors.push(field);
diff --git a/lib/lp/registry/javascript/timeline.js b/lib/lp/registry/javascript/timeline.js
index 5e66f9a..dd892fe 100644
--- a/lib/lp/registry/javascript/timeline.js
+++ b/lib/lp/registry/javascript/timeline.js
@@ -385,7 +385,8 @@ ProjectLine.prototype = {
         var last_series = this.series_lines[this.series_lines.length-1];
         var key;
         for (key in last_series.labels) {
-            if (last_series.labels.hasOwnProperty(key)) {
+            if (Object.prototype.hasOwnProperty.call(
+                    last_series.labels, key)) {
                 var label = last_series.labels[key];
                 bottom_label_height = Math.max(
                     bottom_label_height, label.get('offsetHeight'));
diff --git a/lib/lp/translations/javascript/sourcepackage_sharing_details.js b/lib/lp/translations/javascript/sourcepackage_sharing_details.js
index 6a0b620..a9c5781 100644
--- a/lib/lp/translations/javascript/sourcepackage_sharing_details.js
+++ b/lib/lp/translations/javascript/sourcepackage_sharing_details.js
@@ -178,7 +178,7 @@ function submit_form(config, form_data, entry, view_name, action) {
     var form_data_entries = [];
     var key;
     for (key in form_data){
-        if (form_data.hasOwnProperty(key)){
+        if (Object.prototype.hasOwnProperty.call(form_data, key)){
             var encoded_key = encodeURIComponent(key);
             var values = form_data[key];
             var i;