Update ESLint devDependencies in package.json

This patch updates outdated JavaScript dev dependencies.

The latest ESLint version adds rules changes. Some rules are disabled
to prevent checks failures, some minor issues are fixed.

Change-Id: I01c5ccb5c8f7ceb827a3978157b4d76805d259c1
This commit is contained in:
Tatiana Ovchinnikova 2020-12-16 11:31:23 -06:00
parent 6f0200032d
commit 807a33e1c8
11 changed files with 34 additions and 31 deletions

View File

@ -37,6 +37,8 @@ rules:
space-in-parens: 1 space-in-parens: 1
no-use-before-define: 1 no-use-before-define: 1
no-unneeded-ternary: 1 no-unneeded-ternary: 1
consistent-return: 0
no-unmodified-loop-condition: 0
############################################################################# #############################################################################
# Angular Plugin Customization # Angular Plugin Customization

View File

@ -522,7 +522,7 @@ horizon.d3_line_chart = {
new Rickshaw.Graph.HoverDetail({ new Rickshaw.Graph.HoverDetail({
graph: graph, graph: graph,
formatter: function(series, x, y) { formatter: function(series, x, y) {
if(y % 1 === 0) { if (y % 1 === 0) {
y = parseInt(y, 10); y = parseInt(y, 10);
} else { } else {
y = parseFloat(y).toFixed(2); y = parseFloat(y).toFixed(2);

View File

@ -25,7 +25,7 @@ horizon.extensible_header = {
$('#extensible-header').replaceWith($(data)); $('#extensible-header').replaceWith($(data));
selected = horizon.cookies.get('selected_header'); selected = horizon.cookies.get('selected_header');
if(selected && $('#header-list #' + selected).length){ if (selected && $('#header-list #' + selected).length) {
$old_primary = $('#primary-extensible-header > a'); $old_primary = $('#primary-extensible-header > a');
$new_primary = $('#header-list #' + selected); $new_primary = $('#header-list #' + selected);

View File

@ -278,7 +278,7 @@ horizon.forms.init_themable_select = function ($elem) {
} }
// Set the select if necessary // Set the select if necessary
if($select.val() !== value) { if ($select.val() !== value) {
$select.val(value).change(); $select.val(value).change();
} }
}); });
@ -520,7 +520,7 @@ horizon.addInitFunction(horizon.forms.init = function () {
} }
} else { } else {
//If the input is a checkbox no need to replace html for label since it has another structure //If the input is a checkbox no need to replace html for label since it has another structure
if($input.attr('type') !== "checkbox"){ if ($input.attr('type') !== "checkbox") {
$('label[for=' + $input.attr('id') + ']').html(data); $('label[for=' + $input.attr('id') + ']').html(data);
} }
$input.closest('.form-group').show(); $input.closest('.form-group').show();
@ -568,7 +568,7 @@ horizon.addInitFunction(horizon.forms.init = function () {
var hide_tab = String($switchable.data('hide-tab')).split(','); var hide_tab = String($switchable.data('hide-tab')).split(',');
for (var i = 0, len = hide_tab.length; i < len; i++) { for (var i = 0, len = hide_tab.length; i < len; i++) {
var tab = $('*[data-target="#'+ hide_tab[i] +'"]').parent(); var tab = $('*[data-target="#'+ hide_tab[i] +'"]').parent();
if(checked == hide_on) { if (checked == hide_on) {
// If the checkbox is not checked then hide the tab // If the checkbox is not checked then hide the tab
tab.hide(); tab.hide();
} else if (!tab.is(':visible')) { } else if (!tab.is(':visible')) {
@ -579,11 +579,11 @@ horizon.addInitFunction(horizon.forms.init = function () {
// hide/show button-next or button-final // hide/show button-next or button-final
var $btnfinal = $('.button-final'); var $btnfinal = $('.button-final');
if(checked == hide_on) { if (checked == hide_on) {
$('.button-next').hide(); $('.button-next').hide();
$btnfinal.show(); $btnfinal.show();
$btnfinal.data('show-on-tab', $fieldset.prop('id')); $btnfinal.data('show-on-tab', $fieldset.prop('id'));
} else{ } else {
$btnfinal.hide(); $btnfinal.hide();
$('.button-next').show(); $('.button-next').show();
$btnfinal.removeData('show-on-tab'); $btnfinal.removeData('show-on-tab');

View File

@ -157,7 +157,7 @@ function build_node_links(node){
//make sure target node exists //make sure target node exists
try { try {
target_idx = findNodeIndex(node.required_by[j]); target_idx = findNodeIndex(node.required_by[j]);
} catch(err) { } catch (err) {
push_link =false; push_link =false;
} }
//check for duplicates //check for duplicates
@ -180,11 +180,11 @@ function build_node_links(node){
function build_reverse_links(node){ function build_reverse_links(node){
for (var i=0;i<nodes.length;i++){ for (var i=0;i<nodes.length;i++){
if(nodes[i].required_by){ if (nodes[i].required_by) {
for (var j=0;j<nodes[i].required_by.length;j++){ for (var j=0;j<nodes[i].required_by.length;j++){
var dependency = nodes[i].required_by[j]; var dependency = nodes[i].required_by[j];
//if new node is required by existing node, push new link //if new node is required by existing node, push new link
if(node.name === dependency){ if (node.name === dependency) {
links.push({ links.push({
'source':findNodeIndex(nodes[i].name), 'source':findNodeIndex(nodes[i].name),
'target':findNodeIndex(node.name), 'target':findNodeIndex(node.name),

View File

@ -33,8 +33,8 @@ horizon.lists = {
}); });
$("#"+type+"ListId ul").html( $("#"+type+"ListId ul").html(
lists.sort(function (a,b) { lists.sort(function (a,b) {
if($(a).data("index") < $(b).data("index")) { return -1; } if ($(a).data("index") < $(b).data("index")) { return -1; }
if($(a).data("index") > $(b).data("index")) { return 1; } if ($(a).data("index") > $(b).data("index")) { return 1; }
return 0; return 0;
}) })
); );
@ -60,7 +60,7 @@ horizon.lists = {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
if($this.parents("ul#available_"+type).length > 0) { if ($this.parents("ul#available_"+type).length > 0) {
$this.parent().appendTo($("#selected_"+type)); $this.parent().appendTo($("#selected_"+type));
} else if ($this.parents("ul#selected_"+type).length > 0) { } else if ($this.parents("ul#selected_"+type).length > 0) {
$this.parent().appendTo($("#available_"+type)); $this.parent().appendTo($("#available_"+type));
@ -103,7 +103,7 @@ horizon.lists = {
$('pre.logs').text(response_body); $('pre.logs').text(response_body);
}, },
error: function () { error: function () {
if(via_user_submit) { if (via_user_submit) {
horizon.clearErrorMessages(); horizon.clearErrorMessages();
horizon.toast.add('error', error_txt); horizon.toast.add('error', error_txt);
} }

View File

@ -252,7 +252,7 @@ horizon.membership = {
generate_html: function(step_slug) { generate_html: function(step_slug) {
var data_id, data = horizon.membership.data[step_slug]; var data_id, data = horizon.membership.data[step_slug];
for (data_id in data) { for (data_id in data) {
if(data.hasOwnProperty(data_id)){ if (data.hasOwnProperty(data_id)) {
var display_name = data[data_id]; var display_name = data[data_id];
var role_ids = this.get_member_roles(step_slug, data_id); var role_ids = this.get_member_roles(step_slug, data_id);
if (role_ids.length > 0) { if (role_ids.length > 0) {
@ -491,7 +491,7 @@ horizon.membership = {
// prevent filter inputs from submitting form on 'enter' // prevent filter inputs from submitting form on 'enter'
$form.find('.' + step_slug + '_membership').keydown(function(event){ $form.find('.' + step_slug + '_membership').keydown(function(event){
if(event.keyCode === 13) { if (event.keyCode === 13) {
event.preventDefault(); event.preventDefault();
return false; return false;
} }

View File

@ -22,7 +22,7 @@ horizon.datatables = {
var requests = []; var requests = [];
// do nothing if there are no rows to update. // do nothing if there are no rows to update.
if($rows_to_update.length <= 0) { return; } if ($rows_to_update.length <= 0) { return; }
// Do not update this row if the action column is expanded // Do not update this row if the action column is expanded
if ($rows_to_update.find('.actions_column .btn-group.open').length) { if ($rows_to_update.find('.actions_column .btn-group.open').length) {
@ -50,7 +50,7 @@ horizon.datatables = {
// existing count minus one for the row we're removing // existing count minus one for the row we're removing
row_count = horizon.datatables.update_footer_count($table, -1); row_count = horizon.datatables.update_footer_count($table, -1);
if(row_count === 0) { if (row_count === 0) {
colspan = $table.find('.table_column_header th').length; colspan = $table.find('.table_column_header th').length;
template = horizon.templates.compiled_templates["#empty_row_template"]; template = horizon.templates.compiled_templates["#empty_row_template"];
params = { params = {
@ -104,12 +104,12 @@ horizon.datatables = {
} }
// Only replace row if the html content has changed // Only replace row if the html content has changed
if($new_row.html() !== $row.html()) { if ($new_row.html() !== $row.html()) {
// Directly accessing the checked property of the element // Directly accessing the checked property of the element
// is MUCH faster than using jQuery's helper method // is MUCH faster than using jQuery's helper method
var $checkbox = $row.find('.table-row-multi-select'); var $checkbox = $row.find('.table-row-multi-select');
if($checkbox.length && $checkbox[0].checked) { if ($checkbox.length && $checkbox[0].checked) {
// Preserve the checkbox if it's already clicked // Preserve the checkbox if it's already clicked
$new_row.find('.table-row-multi-select').prop('checked', true); $new_row.find('.table-row-multi-select').prop('checked', true);
} }
@ -146,7 +146,7 @@ horizon.datatables = {
$table.attr('decay_constant', decay_constant); $table.attr('decay_constant', decay_constant);
var next_poll = interval * decay_constant; var next_poll = interval * decay_constant;
// Limit the interval to 30 secs // Limit the interval to 30 secs
if(next_poll > 30 * 1000) { next_poll = 30 * 1000; } if (next_poll > 30 * 1000) { next_poll = 30 * 1000; }
setTimeout(horizon.datatables.update, next_poll); setTimeout(horizon.datatables.update, next_poll);
}); });
}, },
@ -164,7 +164,7 @@ horizon.datatables = {
var $new_action = $(data); var $new_action = $(data);
// Only replace row if the html content has changed // Only replace row if the html content has changed
if($new_action.html() != $action.html()) { if ($new_action.html() != $action.html()) {
$action.replaceWith($new_action); $action.replaceWith($new_action);
} }
} }
@ -296,11 +296,11 @@ horizon.datatables.confirm = function(action) {
name_string = " \"" + $action.closest("tr").attr("data-display") + "\""; name_string = " \"" + $action.closest("tr").attr("data-display") + "\"";
name_array = [name_string]; name_array = [name_string];
} }
} else{ } else {
// Probably we are getting the action from a detail view, so we try to get // Probably we are getting the action from a detail view, so we try to get
// the data-display from a dd element instead // the data-display from a dd element instead
$data_display = $('dd[data-display]'); $data_display = $('dd[data-display]');
if($data_display.length > 0) { if ($data_display.length > 0) {
name_string = ' "' + $('dd[data-display]').attr("data-display") + '"'; name_string = ' "' + $('dd[data-display]').attr("data-display") + '"';
name_array = [name_string]; name_array = [name_string];
} }
@ -475,7 +475,7 @@ $.tablesorter.addParser({
// numerically comparable to other strings. // numerically comparable to other strings.
s = s.toUpperCase(); s = s.toUpperCase();
var value = 0.0; var value = 0.0;
for(var i = 0; i < s.length; i++) { for (var i = 0; i < s.length; i++) {
var char_offset = 1.0 / Math.pow(100, i); var char_offset = 1.0 / Math.pow(100, i);
value = value + (s.charCodeAt(i) * char_offset); value = value + (s.charCodeAt(i) * char_offset);
} }

View File

@ -41,7 +41,7 @@ horizon.tabs.load_tab = function () {
.addClass('tab-loading'); .addClass('tab-loading');
// If query params exist, append tab id. // If query params exist, append tab id.
if(window.location.search.length > 0) { if (window.location.search.length > 0) {
$tab_pane.load(window.location.search + "&tab=" + tab_id.replace('#', ''), function() { $tab_pane.load(window.location.search + "&tab=" + tab_id.replace('#', ''), function() {
horizon.tabs.initTabLoad($tab_pane); horizon.tabs.initTabLoad($tab_pane);
}); });
@ -74,7 +74,7 @@ horizon.addInitFunction(horizon.tabs.init = function () {
}); });
// d3 renders incorrectly in a hidden tab, this forces a rerender when the // d3 renders incorrectly in a hidden tab, this forces a rerender when the
// container size is not 0 from display:none // container size is not 0 from display:none
if($content.find(".d3-container").length) { if ($content.find(".d3-container").length) {
window.dispatchEvent(new Event('resize')); window.dispatchEvent(new Event('resize'));
} }

View File

@ -12,6 +12,7 @@ rules:
one-var: 0 one-var: 0
space-infix-ops: 0 space-infix-ops: 0
space-after-keywords: 0 space-after-keywords: 0
keyword-spacing: 0
no-console: 0 no-console: 0
no-multiple-empty-lines: 0 no-multiple-empty-lines: 0
no-sync: 0 no-sync: 0

View File

@ -6,14 +6,14 @@
"repository": "none", "repository": "none",
"license": "Apache 2.0", "license": "Apache 2.0",
"devDependencies": { "devDependencies": {
"eslint": "1.10.3", "eslint": "3.0.0",
"eslint-config-openstack": "1.2.4", "eslint-config-openstack": "4.0.1",
"eslint-plugin-angular": "1.0.1", "eslint-plugin-angular": "4.0.1",
"jasmine-core": "2.4.1", "jasmine-core": "2.4.1",
"karma": "1.1.2", "karma": "1.1.2",
"karma-firefox-launcher": "2.1.0",
"karma-cli": "1.0.1", "karma-cli": "1.0.1",
"karma-coverage": "1.1.1", "karma-coverage": "1.1.1",
"karma-firefox-launcher": "2.1.0",
"karma-jasmine": "1.0.2", "karma-jasmine": "1.0.2",
"karma-ng-html2js-preprocessor": "1.0.0", "karma-ng-html2js-preprocessor": "1.0.0",
"karma-threshold-reporter": "0.1.15" "karma-threshold-reporter": "0.1.15"