Commit b61c2592 authored by alexpott's avatar alexpott

Issue #2915526 by drpal: JS codestyle: prefer-const

parent 8dc50099
......@@ -16,7 +16,6 @@
"default-case": "off",
"camelcase": "off",
"vars-on-top": "off",
"prefer-rest-params": "off",
"prefer-const": "off"
"prefer-rest-params": "off"
}
}
......@@ -117,9 +117,7 @@
Drupal.AjaxError = function (xmlhttp, uri, customMessage) {
let statusCode;
let statusText;
let pathText;
let responseText;
let readyStateText;
if (xmlhttp.status) {
statusCode = `\n${Drupal.t('An AJAX HTTP error occurred.')}\n${Drupal.t('HTTP Result Code: !status', { '!status': xmlhttp.status })}`;
}
......@@ -127,7 +125,7 @@
statusCode = `\n${Drupal.t('An AJAX HTTP request terminated abnormally.')}`;
}
statusCode += `\n${Drupal.t('Debugging information follows.')}`;
pathText = `\n${Drupal.t('Path: !uri', { '!uri': uri })}`;
const pathText = `\n${Drupal.t('Path: !uri', { '!uri': uri })}`;
statusText = '';
// In some cases, when statusCode === 0, xmlhttp.statusText may not be
// defined. Unfortunately, testing for it with typeof, etc, doesn't seem to
......@@ -155,7 +153,7 @@
responseText = responseText.replace(/[\n]+\s+/g, '\n');
// We don't need readyState except for status == 0.
readyStateText = xmlhttp.status === 0 ? (`\n${Drupal.t('ReadyState: !readyState', { '!readyState': xmlhttp.readyState })}`) : '';
const readyStateText = xmlhttp.status === 0 ? (`\n${Drupal.t('ReadyState: !readyState', { '!readyState': xmlhttp.readyState })}`) : '';
customMessage = customMessage ? (`\n${Drupal.t('CustomMessage: !customMessage', { '!customMessage': customMessage })}`) : '';
......
......@@ -73,16 +73,14 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
Drupal.AjaxError = function (xmlhttp, uri, customMessage) {
var statusCode = void 0;
var statusText = void 0;
var pathText = void 0;
var responseText = void 0;
var readyStateText = void 0;
if (xmlhttp.status) {
statusCode = '\n' + Drupal.t('An AJAX HTTP error occurred.') + '\n' + Drupal.t('HTTP Result Code: !status', { '!status': xmlhttp.status });
} else {
statusCode = '\n' + Drupal.t('An AJAX HTTP request terminated abnormally.');
}
statusCode += '\n' + Drupal.t('Debugging information follows.');
pathText = '\n' + Drupal.t('Path: !uri', { '!uri': uri });
var pathText = '\n' + Drupal.t('Path: !uri', { '!uri': uri });
statusText = '';
try {
......@@ -98,7 +96,7 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
responseText = responseText.replace(/<("[^"]*"|'[^']*'|[^'">])*>/gi, '');
responseText = responseText.replace(/[\n]+\s+/g, '\n');
readyStateText = xmlhttp.status === 0 ? '\n' + Drupal.t('ReadyState: !readyState', { '!readyState': xmlhttp.readyState }) : '';
var readyStateText = xmlhttp.status === 0 ? '\n' + Drupal.t('ReadyState: !readyState', { '!readyState': xmlhttp.readyState }) : '';
customMessage = customMessage ? '\n' + Drupal.t('CustomMessage: !customMessage', { '!customMessage': customMessage }) : '';
......
......@@ -12,7 +12,6 @@
_createButtons() {
const opts = this.options;
let primaryIndex;
let $buttons;
let index;
const il = opts.buttons.length;
for (index = 0; index < il; index++) {
......@@ -23,7 +22,7 @@
}
}
this._super();
$buttons = this.uiButtonSet.children().addClass(opts.buttonClass);
const $buttons = this.uiButtonSet.children().addClass(opts.buttonClass);
if (typeof primaryIndex !== 'undefined') {
$buttons.eq(index).addClass(opts.buttonPrimaryClass);
}
......
......@@ -14,7 +14,6 @@
_createButtons: function _createButtons() {
var opts = this.options;
var primaryIndex = void 0;
var $buttons = void 0;
var index = void 0;
var il = opts.buttons.length;
for (index = 0; index < il; index++) {
......@@ -25,7 +24,7 @@
}
}
this._super();
$buttons = this.uiButtonSet.children().addClass(opts.buttonClass);
var $buttons = this.uiButtonSet.children().addClass(opts.buttonClass);
if (typeof primaryIndex !== 'undefined') {
$buttons.eq(index).addClass(opts.buttonPrimaryClass);
}
......
......@@ -88,7 +88,6 @@
Object.keys(settings.machineName).forEach((source_id) => {
let machine = '';
let eventData;
const options = settings.machineName[source_id];
const $source = $context.find(source_id).addClass('machine-name-source').once('machine-name');
......@@ -129,7 +128,7 @@
return;
}
eventData = {
const eventData = {
$source,
$target,
$suffix,
......
......@@ -51,7 +51,6 @@
Object.keys(settings.machineName).forEach(function (source_id) {
var machine = '';
var eventData = void 0;
var options = settings.machineName[source_id];
var $source = $context.find(source_id).addClass('machine-name-source').once('machine-name');
......@@ -88,7 +87,7 @@
return;
}
eventData = {
var eventData = {
$source: $source,
$target: $target,
$suffix: $suffix,
......
......@@ -1354,12 +1354,11 @@
*/
Drupal.tableDrag.prototype.row.prototype.validIndentInterval = function (prevRow, nextRow) {
const $prevRow = $(prevRow);
let minIndent;
let maxIndent;
// Minimum indentation:
// Do not orphan the next row.
minIndent = nextRow ? $(nextRow).find('.js-indentation').length : 0;
const minIndent = nextRow ? $(nextRow).find('.js-indentation').length : 0;
// Maximum indentation:
if (!prevRow || $prevRow.is(':not(.draggable)') || $(this.element).is('.tabledrag-root')) {
......
......@@ -848,10 +848,9 @@
Drupal.tableDrag.prototype.row.prototype.validIndentInterval = function (prevRow, nextRow) {
var $prevRow = $(prevRow);
var minIndent = void 0;
var maxIndent = void 0;
minIndent = nextRow ? $(nextRow).find('.js-indentation').length : 0;
var minIndent = nextRow ? $(nextRow).find('.js-indentation').length : 0;
if (!prevRow || $prevRow.is(':not(.draggable)') || $(this.element).is('.tabledrag-root')) {
maxIndent = 0;
......
......@@ -760,7 +760,6 @@
* An operator element.
*/
duplicateGroupsOperator() {
let dropdowns;
let newRow;
let titleRow;
......@@ -777,7 +776,7 @@
// Keep a list of the operator dropdowns, so we can sync their behavior
// later.
dropdowns = this.operator;
const dropdowns = this.operator;
// Move the operator to a new row just above the second group.
titleRow = $('tr#views-group-title-2');
......
......@@ -372,7 +372,6 @@
event.preventDefault();
},
duplicateGroupsOperator: function duplicateGroupsOperator() {
var dropdowns = void 0;
var newRow = void 0;
var titleRow = void 0;
......@@ -385,7 +384,7 @@
this.operator.find('label').add('div.description').addClass('visually-hidden');
this.operator.find('select').addClass('form-select');
dropdowns = this.operator;
var dropdowns = this.operator;
titleRow = $('tr#views-group-title-2');
newRow = $('<tr class="filter-group-operator-row"><td colspan="5"></td></tr>');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment