Commit b0e82e58 authored by alexpott's avatar alexpott

Issue #2548195 by nod_, JohnAlbin, madhavvyas, sriharsha.uppuluri: Only use...

Issue #2548195 by nod_, JohnAlbin, madhavvyas, sriharsha.uppuluri: Only use single quotes in JavaScript and update .eslintrc
parent 26d5a5fc
......@@ -71,6 +71,7 @@
"object-curly-spacing": [2, "never"],
"one-var": [2, "never"],
"quote-props": [2, "consistent-as-needed"],
"quotes": [2, "single", "avoid-escape"],
"semi": [2, "always"],
"semi-spacing": [2, {"before": false, "after": true}],
"space-after-keywords": [2, "always"],
......
......@@ -5,7 +5,7 @@
(function (Drupal, drupalSettings) {
"use strict";
'use strict';
/**
* Append is-active class.
......
......@@ -13,7 +13,7 @@
(function ($, window, Drupal, drupalSettings) {
"use strict";
'use strict';
/**
* Attaches the Ajax behavior to each Ajax form element.
......@@ -106,20 +106,20 @@
var responseText;
var readyStateText;
if (xmlhttp.status) {
statusCode = "\n" + Drupal.t("An AJAX HTTP error occurred.") + "\n" + Drupal.t("HTTP Result Code: !status", {'!status': 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('An AJAX HTTP request terminated abnormally.');
}
statusCode += "\n" + Drupal.t("Debugging information follows.");
pathText = "\n" + Drupal.t("Path: !uri", {'!uri': uri});
statusCode += '\n' + Drupal.t('Debugging information follows.');
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
// catch that and the test causes an exception. So we need to catch the
// exception here.
try {
statusText = "\n" + Drupal.t("StatusText: !statusText", {'!statusText': $.trim(xmlhttp.statusText)});
statusText = '\n' + Drupal.t('StatusText: !statusText', {'!statusText': $.trim(xmlhttp.statusText)});
}
catch (e) {
// Empty.
......@@ -129,20 +129,20 @@
// Again, we don't have a way to know for sure whether accessing
// xmlhttp.responseText is going to throw an exception. So we'll catch it.
try {
responseText = "\n" + Drupal.t("ResponseText: !responseText", {'!responseText': $.trim(xmlhttp.responseText)});
responseText = '\n' + Drupal.t('ResponseText: !responseText', {'!responseText': $.trim(xmlhttp.responseText)});
}
catch (e) {
// Empty.
}
// Make the responseText more readable by stripping HTML tags and newlines.
responseText = responseText.replace(/<("[^"]*"|'[^']*'|[^'">])*>/gi, "");
responseText = responseText.replace(/[\n]+\s+/g, "\n");
responseText = responseText.replace(/<("[^"]*"|'[^']*'|[^'">])*>/gi, '');
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})) : "";
readyStateText = xmlhttp.status === 0 ? ('\n' + Drupal.t('ReadyState: !readyState', {'!readyState': xmlhttp.readyState})) : '';
customMessage = customMessage ? ("\n" + Drupal.t("CustomMessage: !customMessage", {'!customMessage': customMessage})) : "";
customMessage = customMessage ? ('\n' + Drupal.t('CustomMessage: !customMessage', {'!customMessage': customMessage})) : '';
/**
* Formatted and translated error message.
......@@ -406,7 +406,7 @@
// the response headers cannot be accessed for verification.
if (response !== null && !drupalSettings.ajaxTrustedUrl[ajax.url]) {
if (xmlhttprequest.getResponseHeader('X-Drupal-Ajax-Token') !== '1') {
var customMessage = Drupal.t("The response failed verification so will not be processed.");
var customMessage = Drupal.t('The response failed verification so will not be processed.');
return ajax.error(xmlhttprequest, ajax.url, customMessage);
}
}
......@@ -499,7 +499,7 @@
// Unset the ajax.ajaxing flag here because it won't be unset during
// the complete response.
this.ajaxing = false;
window.alert("An error occurred while attempting to process " + this.options.url + ": " + e.message);
window.alert('An error occurred while attempting to process ' + this.options.url + ': ' + e.message);
}
};
......@@ -579,7 +579,7 @@
// Unset the ajax.ajaxing flag here because it won't be unset during
// the complete response.
ajax.ajaxing = false;
window.alert("An error occurred while attempting to process " + ajax.options.url + ": " + e.message);
window.alert('An error occurred while attempting to process ' + ajax.options.url + ': ' + e.message);
}
};
......
......@@ -20,7 +20,7 @@
(function (Drupal, debounce) {
"use strict";
'use strict';
var liveElement;
var announcements = [];
......
......@@ -5,7 +5,7 @@
(function ($, Drupal) {
"use strict";
'use strict';
var autocomplete;
......@@ -158,7 +158,7 @@
// Remove the current input.
terms.pop();
// Add the selected item.
if (ui.item.value.search(",") > 0) {
if (ui.item.value.search(',') > 0) {
terms.push('"' + ui.item.value + '"');
}
else {
......@@ -178,8 +178,8 @@
* @return {object}
*/
function renderItem(ul, item) {
return $("<li>")
.append($("<a>").html(item.label))
return $('<li>')
.append($('<a>').html(item.label))
.appendTo(ul);
}
......@@ -200,7 +200,7 @@
});
// Use jQuery UI Autocomplete on the textfield.
$autocomplete.autocomplete(autocomplete.options)
.data("ui-autocomplete")
.data('ui-autocomplete')
._renderItem = autocomplete.options.renderItem;
}
},
......
......@@ -5,7 +5,7 @@
(function ($, Drupal) {
"use strict";
'use strict';
/**
* Attaches the batch behavior to progress bars.
......
......@@ -5,7 +5,7 @@
(function ($, Modernizr, Drupal) {
"use strict";
'use strict';
/**
* The collapsible details object represents a single details element.
......
......@@ -5,7 +5,7 @@
(function ($, Modernizr, Drupal) {
"use strict";
'use strict';
/**
* Attach datepicker fallback on date elements.
......
......@@ -28,7 +28,7 @@
*/
Drupal.debounce = function (func, wait, immediate) {
"use strict";
'use strict';
var timeout;
var result;
......
......@@ -5,7 +5,7 @@
(function ($, Drupal) {
"use strict";
'use strict';
/**
* Handles `aria-expanded` and `aria-pressed` attributes on details elements.
......
......@@ -5,7 +5,7 @@
(function ($, Drupal) {
"use strict";
'use strict';
/**
* Initialize dialogs for Ajax purposes.
......
......@@ -5,7 +5,7 @@
(function ($) {
"use strict";
'use strict';
$.widget('ui.dialog', $.ui.dialog, {
options: {
......
......@@ -7,7 +7,7 @@
(function ($, Drupal, drupalSettings) {
"use strict";
'use strict';
/**
* Default dialog options.
......
......@@ -11,7 +11,7 @@
(function ($, Drupal, drupalSettings, debounce, displace) {
"use strict";
'use strict';
// autoResize option will turn off resizable and draggable.
drupalSettings.dialog = $.extend({autoResize: true, maxHeight: '95%'}, drupalSettings.dialog);
......
......@@ -26,7 +26,7 @@
(function ($, Drupal, debounce) {
"use strict";
'use strict';
/**
* @name Drupal.displace.offsets
......
......@@ -5,7 +5,7 @@
(function ($, Drupal) {
"use strict";
'use strict';
/**
* Process elements with the .dropbutton class on page load.
......
......@@ -52,7 +52,7 @@ if (window.jQuery) {
// wrapping it in an anonymous closure.
(function (domready, Drupal, drupalSettings, drupalTranslations) {
"use strict";
'use strict';
/**
* Helper to rethrow errors asynchronously.
......
......@@ -5,7 +5,7 @@
(function () {
"use strict";
'use strict';
var settingsElement = document.querySelector('script[type="application/json"][data-drupal-selector="drupal-settings-json"]');
......
......@@ -14,7 +14,7 @@
(function ($, Drupal, debounce) {
"use strict";
'use strict';
/**
* Retrieves the summary for the first element.
......
......@@ -5,7 +5,7 @@
(function ($, Drupal, drupalSettings) {
"use strict";
'use strict';
/**
* Attach the machine-readable name form element behavior.
......
......@@ -5,7 +5,7 @@
(function ($, Drupal) {
"use strict";
'use strict';
/**
* Theme function for the progress bar.
......
......@@ -5,7 +5,7 @@
(function ($) {
"use strict";
'use strict';
/**
* The base States namespace.
......
......@@ -29,7 +29,7 @@
(function ($, Drupal) {
"use strict";
'use strict';
/**
* Provides an API for managing page tabbing order modifications.
......
......@@ -11,7 +11,7 @@
(function ($, Drupal, drupalSettings) {
"use strict";
'use strict';
/**
* Store the state of weight columns display for all tables.
......
......@@ -5,7 +5,7 @@
(function ($, Drupal, displace) {
"use strict";
'use strict';
/**
* Attaches sticky table headers.
......
......@@ -5,7 +5,7 @@
(function ($, Drupal, window) {
"use strict";
'use strict';
/**
* Attach the tableResponsive function to {@link Drupal.behaviors}.
......
......@@ -5,7 +5,7 @@
(function ($, Drupal) {
"use strict";
'use strict';
/**
* Initialize tableSelects.
......
......@@ -5,7 +5,7 @@
(function ($) {
"use strict";
'use strict';
/**
* Set the client's system time zone as default values of form fields.
......
......@@ -14,7 +14,7 @@
(function ($) {
"use strict";
'use strict';
/**
* This script transforms a set of details into a stack of vertical tabs.
......@@ -126,7 +126,7 @@
event.preventDefault();
self.focus();
// Set focus on the first input field of the visible details/tab pane.
$(".vertical-tabs__pane :input:visible:enabled").eq(0).trigger('focus');
$('.vertical-tabs__pane :input:visible:enabled').eq(0).trigger('focus');
}
});
......
......@@ -5,7 +5,7 @@
(function ($, Drupal) {
"use strict";
'use strict';
/**
* Filters the block list by a text input search string.
......
......@@ -5,7 +5,7 @@
(function ($, window) {
"use strict";
'use strict';
/**
* Provide the summary information for the block settings vertical tabs.
......
......@@ -5,7 +5,7 @@
(function ($) {
"use strict";
'use strict';
/**
* Sets summaries about revision and translation of block content.
......
......@@ -5,7 +5,7 @@
(function ($) {
"use strict";
'use strict';
/**
* Adds summaries to the book outline form.
......
......@@ -5,7 +5,7 @@
(function ($, Drupal, _, CKEDITOR) {
"use strict";
'use strict';
Drupal.ckeditor = Drupal.ckeditor || {};
......
......@@ -5,7 +5,7 @@
(function ($, Drupal, drupalSettings) {
"use strict";
'use strict';
/**
* Provides the summary for the "drupalimage" plugin settings vertical tab.
......
......@@ -5,7 +5,7 @@
(function (Drupal, debounce, CKEDITOR, $) {
"use strict";
'use strict';
/**
* @namespace
......@@ -34,7 +34,7 @@
// label so that screen readers say something that is understandable
// for end users.
var label = $('label[for=' + element.getAttribute('id') + ']').html();
format.editorSettings.title = Drupal.t("Rich Text Editor, !label field", {'!label': label});
format.editorSettings.title = Drupal.t('Rich Text Editor, !label field', {'!label': label});
return !!CKEDITOR.replace(element, format.editorSettings);
},
......@@ -249,7 +249,7 @@
// Moves the dialog to the top of the CKEDITOR stack.
$(window).on('dialogcreate', function (e, dialog, $element, settings) {
$('.ui-dialog--narrow').css("zIndex", CKEDITOR.config.baseFloatZIndex + 1);
$('.ui-dialog--narrow').css('zIndex', CKEDITOR.config.baseFloatZIndex + 1);
});
// Respond to new dialogs that are opened by CKEditor, closing the AJAX loader.
......
......@@ -5,7 +5,7 @@
(function ($, Drupal, drupalSettings) {
"use strict";
'use strict';
/**
* Ensures that the "stylescombo" button's metadata remains up-to-date.
......@@ -66,8 +66,8 @@
_generateStylesSetSetting: function (styles) {
var stylesSet = [];
styles = styles.replace(/\r/g, "\n");
var lines = styles.split("\n");
styles = styles.replace(/\r/g, '\n');
var lines = styles.split('\n');
for (var i = 0; i < lines.length; i++) {
var style = $.trim(lines[i]);
......@@ -118,7 +118,7 @@
return Drupal.t('No styles configured');
}
else {
var count = $.trim(styles).split("\n").length;
var count = $.trim(styles).split('\n').length;
return Drupal.t('@count styles configured', {'@count': count});
}
});
......
......@@ -5,7 +5,7 @@
(function (Drupal, Backbone) {
"use strict";
'use strict';
/**
* Backbone model for the CKEditor toolbar configuration state.
......
......@@ -15,7 +15,7 @@
(function ($, Drupal, CKEDITOR) {
"use strict";
'use strict';
CKEDITOR.plugins.add('drupalimage', {
requires: 'image2',
......
......@@ -12,7 +12,7 @@
(function (CKEDITOR) {
"use strict";
'use strict';
CKEDITOR.plugins.add('drupalimagecaption', {
requires: 'drupalimage',
......
......@@ -7,7 +7,7 @@
(function ($, Drupal, drupalSettings, CKEDITOR) {
"use strict";
'use strict';
CKEDITOR.plugins.add('drupallink', {
init: function (editor) {
......
......@@ -6,7 +6,7 @@
(function (Drupal, Backbone, $) {
"use strict";
'use strict';
Drupal.ckeditor.AuralView = Backbone.View.extend(/** @lends Drupal.ckeditor.AuralView# */{
......@@ -104,8 +104,8 @@
// If this position is the first in the last row then tell the user that
// pressing the down arrow key will create a new row.
if (position === 1 && row === rowCount) {
text += "\n";
text += Drupal.t("Press the down arrow key to create a new row.");
text += '\n';
text += Drupal.t('Press the down arrow key to create a new row.');
}
Drupal.announce(text, 'assertive');
},
......@@ -139,7 +139,7 @@
'@name': $button.children().attr('aria-label'),
'@type': type
});
text += "\n" + Drupal.t('Press the down arrow key to activate.');
text += '\n' + Drupal.t('Press the down arrow key to activate.');
Drupal.announce(text, 'assertive');
}
......@@ -157,14 +157,14 @@
// If this position is the first in the last row then tell the user that
// pressing the down arrow key will create a new row.
if (groupPosition === 1 && position === 1 && row === rowCount) {
text += "\n";
text += Drupal.t("Press the down arrow key to create a new button group in a new row.");
text += '\n';
text += Drupal.t('Press the down arrow key to create a new button group in a new row.');
}
// If this position is the last one in this row then tell the user that
// moving the button to the next group will create a new group.
if (groupPosition === groupPositionCount && position === positionCount) {
text += "\n";
text += Drupal.t("This is the last group. Move the button forward to create a new group.");
text += '\n';
text += Drupal.t('This is the last group. Move the button forward to create a new group.');
}
Drupal.announce(text, 'assertive');
}
......@@ -186,14 +186,14 @@
message = Drupal.t('The "@name" button is currently enabled.', {
'@name': $link.attr('aria-label')
});
message += "\n" + Drupal.t('Use the keyboard arrow keys to change the position of this button.');
message += "\n" + Drupal.t('Press the up arrow key on the top row to disable the button.');
message += '\n' + Drupal.t('Use the keyboard arrow keys to change the position of this button.');
message += '\n' + Drupal.t('Press the up arrow key on the top row to disable the button.');
}
else {
message = Drupal.t('The "@name" button is currently disabled.', {
'@name': $link.attr('aria-label')
});
message += "\n" + Drupal.t('Use the down arrow key to move this button into the active toolbar.');
message += '\n' + Drupal.t('Use the down arrow key to move this button into the active toolbar.');
}
Drupal.announce(message);
event.preventDefault();
......@@ -215,15 +215,15 @@
message = Drupal.t('This @name is currently enabled.', {
'@name': $link.attr('aria-label')
});
message += "\n" + Drupal.t('Use the keyboard arrow keys to change the position of this separator.');
message += '\n' + Drupal.t('Use the keyboard arrow keys to change the position of this separator.');
}
else {
message = Drupal.t('Separators are used to visually split individual buttons.');
message += "\n" + Drupal.t('This @name is currently disabled.', {
message += '\n' + Drupal.t('This @name is currently disabled.', {
'@name': $link.attr('aria-label')
});
message += "\n" + Drupal.t('Use the down arrow key to move this separator into the active toolbar.');
message += "\n" + Drupal.t('You may add multiple separators to each button group.');
message += '\n' + Drupal.t('Use the down arrow key to move this separator into the active toolbar.');
message += '\n' + Drupal.t('You may add multiple separators to each button group.');
}
Drupal.announce(message);
event.preventDefault();
......
......@@ -5,7 +5,7 @@
(function (Drupal, Backbone, $) {
"use strict";
'use strict';
Drupal.ckeditor.ControllerView = Backbone.View.extend(/** @lends Drupal.ckeditor.ControllerView# */{
......
......@@ -5,7 +5,7 @@
(function (Drupal, Backbone, $) {
"use strict";
'use strict';
Drupal.ckeditor.KeyboardView = Backbone.View.extend(/** @lends Drupal.ckeditor.KeyboardView# */{
......
......@@ -6,7 +6,7 @@
(function (Drupal, Backbone, $) {
"use strict";
'use strict';
Drupal.ckeditor.VisualView = Backbone.View.extend(/** @lends Drupal.ckeditor.VisualView# */{
......
......@@ -5,7 +5,7 @@
(function ($) {
"use strict";
'use strict';
/**
* Displays farbtastic color selector and initialize color administration UI.
......
......@@ -5,7 +5,7 @@
(function ($) {
"use strict";
'use strict';