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 @@ ...@@ -71,6 +71,7 @@
"object-curly-spacing": [2, "never"], "object-curly-spacing": [2, "never"],
"one-var": [2, "never"], "one-var": [2, "never"],
"quote-props": [2, "consistent-as-needed"], "quote-props": [2, "consistent-as-needed"],
"quotes": [2, "single", "avoid-escape"],
"semi": [2, "always"], "semi": [2, "always"],
"semi-spacing": [2, {"before": false, "after": true}], "semi-spacing": [2, {"before": false, "after": true}],
"space-after-keywords": [2, "always"], "space-after-keywords": [2, "always"],
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
(function (Drupal, drupalSettings) { (function (Drupal, drupalSettings) {
"use strict"; 'use strict';
/** /**
* Append is-active class. * Append is-active class.
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
(function ($, window, Drupal, drupalSettings) { (function ($, window, Drupal, drupalSettings) {
"use strict"; 'use strict';
/** /**
* Attaches the Ajax behavior to each Ajax form element. * Attaches the Ajax behavior to each Ajax form element.
...@@ -106,20 +106,20 @@ ...@@ -106,20 +106,20 @@
var responseText; var responseText;
var readyStateText; var readyStateText;
if (xmlhttp.status) { 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 { 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."); statusCode += '\n' + Drupal.t('Debugging information follows.');
pathText = "\n" + Drupal.t("Path: !uri", {'!uri': uri}); pathText = '\n' + Drupal.t('Path: !uri', {'!uri': uri});
statusText = ''; statusText = '';
// In some cases, when statusCode === 0, xmlhttp.statusText may not be // In some cases, when statusCode === 0, xmlhttp.statusText may not be
// defined. Unfortunately, testing for it with typeof, etc, doesn't seem to // 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 // catch that and the test causes an exception. So we need to catch the
// exception here. // exception here.
try { try {
statusText = "\n" + Drupal.t("StatusText: !statusText", {'!statusText': $.trim(xmlhttp.statusText)}); statusText = '\n' + Drupal.t('StatusText: !statusText', {'!statusText': $.trim(xmlhttp.statusText)});
} }
catch (e) { catch (e) {
// Empty. // Empty.
...@@ -129,20 +129,20 @@ ...@@ -129,20 +129,20 @@
// Again, we don't have a way to know for sure whether accessing // 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. // xmlhttp.responseText is going to throw an exception. So we'll catch it.
try { try {
responseText = "\n" + Drupal.t("ResponseText: !responseText", {'!responseText': $.trim(xmlhttp.responseText)}); responseText = '\n' + Drupal.t('ResponseText: !responseText', {'!responseText': $.trim(xmlhttp.responseText)});
} }
catch (e) { catch (e) {
// Empty. // Empty.
} }
// Make the responseText more readable by stripping HTML tags and newlines. // Make the responseText more readable by stripping HTML tags and newlines.
responseText = responseText.replace(/<("[^"]*"|'[^']*'|[^'">])*>/gi, ""); responseText = responseText.replace(/<("[^"]*"|'[^']*'|[^'">])*>/gi, '');
responseText = responseText.replace(/[\n]+\s+/g, "\n"); responseText = responseText.replace(/[\n]+\s+/g, '\n');
// We don't need readyState except for status == 0. // 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. * Formatted and translated error message.
...@@ -406,7 +406,7 @@ ...@@ -406,7 +406,7 @@
// the response headers cannot be accessed for verification. // the response headers cannot be accessed for verification.
if (response !== null && !drupalSettings.ajaxTrustedUrl[ajax.url]) { if (response !== null && !drupalSettings.ajaxTrustedUrl[ajax.url]) {
if (xmlhttprequest.getResponseHeader('X-Drupal-Ajax-Token') !== '1') { 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); return ajax.error(xmlhttprequest, ajax.url, customMessage);
} }
} }
...@@ -499,7 +499,7 @@ ...@@ -499,7 +499,7 @@
// Unset the ajax.ajaxing flag here because it won't be unset during // Unset the ajax.ajaxing flag here because it won't be unset during
// the complete response. // the complete response.
this.ajaxing = false; 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 @@ ...@@ -579,7 +579,7 @@
// Unset the ajax.ajaxing flag here because it won't be unset during // Unset the ajax.ajaxing flag here because it won't be unset during
// the complete response. // the complete response.
ajax.ajaxing = false; 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 @@ ...@@ -20,7 +20,7 @@
(function (Drupal, debounce) { (function (Drupal, debounce) {
"use strict"; 'use strict';
var liveElement; var liveElement;
var announcements = []; var announcements = [];
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
(function ($, Drupal) { (function ($, Drupal) {
"use strict"; 'use strict';
var autocomplete; var autocomplete;
...@@ -158,7 +158,7 @@ ...@@ -158,7 +158,7 @@
// Remove the current input. // Remove the current input.
terms.pop(); terms.pop();
// Add the selected item. // Add the selected item.
if (ui.item.value.search(",") > 0) { if (ui.item.value.search(',') > 0) {
terms.push('"' + ui.item.value + '"'); terms.push('"' + ui.item.value + '"');
} }
else { else {
...@@ -178,8 +178,8 @@ ...@@ -178,8 +178,8 @@
* @return {object} * @return {object}
*/ */
function renderItem(ul, item) { function renderItem(ul, item) {
return $("<li>") return $('<li>')
.append($("<a>").html(item.label)) .append($('<a>').html(item.label))
.appendTo(ul); .appendTo(ul);
} }
...@@ -200,7 +200,7 @@ ...@@ -200,7 +200,7 @@
}); });
// Use jQuery UI Autocomplete on the textfield. // Use jQuery UI Autocomplete on the textfield.
$autocomplete.autocomplete(autocomplete.options) $autocomplete.autocomplete(autocomplete.options)
.data("ui-autocomplete") .data('ui-autocomplete')
._renderItem = autocomplete.options.renderItem; ._renderItem = autocomplete.options.renderItem;
} }
}, },
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
(function ($, Drupal) { (function ($, Drupal) {
"use strict"; 'use strict';
/** /**
* Attaches the batch behavior to progress bars. * Attaches the batch behavior to progress bars.
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
(function ($, Modernizr, Drupal) { (function ($, Modernizr, Drupal) {
"use strict"; 'use strict';
/** /**
* The collapsible details object represents a single details element. * The collapsible details object represents a single details element.
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
(function ($, Modernizr, Drupal) { (function ($, Modernizr, Drupal) {
"use strict"; 'use strict';
/** /**
* Attach datepicker fallback on date elements. * Attach datepicker fallback on date elements.
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
*/ */
Drupal.debounce = function (func, wait, immediate) { Drupal.debounce = function (func, wait, immediate) {
"use strict"; 'use strict';
var timeout; var timeout;
var result; var result;
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
(function ($, Drupal) { (function ($, Drupal) {
"use strict"; 'use strict';
/** /**
* Handles `aria-expanded` and `aria-pressed` attributes on details elements. * Handles `aria-expanded` and `aria-pressed` attributes on details elements.
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
(function ($, Drupal) { (function ($, Drupal) {
"use strict"; 'use strict';
/** /**
* Initialize dialogs for Ajax purposes. * Initialize dialogs for Ajax purposes.
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
(function ($) { (function ($) {
"use strict"; 'use strict';
$.widget('ui.dialog', $.ui.dialog, { $.widget('ui.dialog', $.ui.dialog, {
options: { options: {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
(function ($, Drupal, drupalSettings) { (function ($, Drupal, drupalSettings) {
"use strict"; 'use strict';
/** /**
* Default dialog options. * Default dialog options.
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
(function ($, Drupal, drupalSettings, debounce, displace) { (function ($, Drupal, drupalSettings, debounce, displace) {
"use strict"; 'use strict';
// autoResize option will turn off resizable and draggable. // autoResize option will turn off resizable and draggable.
drupalSettings.dialog = $.extend({autoResize: true, maxHeight: '95%'}, drupalSettings.dialog); drupalSettings.dialog = $.extend({autoResize: true, maxHeight: '95%'}, drupalSettings.dialog);
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
(function ($, Drupal, debounce) { (function ($, Drupal, debounce) {
"use strict"; 'use strict';
/** /**
* @name Drupal.displace.offsets * @name Drupal.displace.offsets
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
(function ($, Drupal) { (function ($, Drupal) {
"use strict"; 'use strict';
/** /**
* Process elements with the .dropbutton class on page load. * Process elements with the .dropbutton class on page load.
......
...@@ -52,7 +52,7 @@ if (window.jQuery) { ...@@ -52,7 +52,7 @@ if (window.jQuery) {
// wrapping it in an anonymous closure. // wrapping it in an anonymous closure.
(function (domready, Drupal, drupalSettings, drupalTranslations) { (function (domready, Drupal, drupalSettings, drupalTranslations) {
"use strict"; 'use strict';
/** /**
* Helper to rethrow errors asynchronously. * Helper to rethrow errors asynchronously.
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
(function () { (function () {
"use strict"; 'use strict';
var settingsElement = document.querySelector('script[type="application/json"][data-drupal-selector="drupal-settings-json"]'); var settingsElement = document.querySelector('script[type="application/json"][data-drupal-selector="drupal-settings-json"]');
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
(function ($, Drupal, debounce) { (function ($, Drupal, debounce) {
"use strict"; 'use strict';
/** /**
* Retrieves the summary for the first element. * Retrieves the summary for the first element.
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
(function ($, Drupal, drupalSettings) { (function ($, Drupal, drupalSettings) {
"use strict"; 'use strict';
/** /**
* Attach the machine-readable name form element behavior. * Attach the machine-readable name form element behavior.
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
(function ($, Drupal) { (function ($, Drupal) {
"use strict"; 'use strict';
/** /**
* Theme function for the progress bar. * Theme function for the progress bar.
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
(function ($) { (function ($) {
"use strict"; 'use strict';
/** /**
* The base States namespace. * The base States namespace.
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
(function ($, Drupal) { (function ($, Drupal) {
"use strict"; 'use strict';
/** /**
* Provides an API for managing page tabbing order modifications. * Provides an API for managing page tabbing order modifications.
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
(function ($, Drupal, drupalSettings) { (function ($, Drupal, drupalSettings) {
"use strict"; 'use strict';
/** /**
* Store the state of weight columns display for all tables. * Store the state of weight columns display for all tables.
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
(function ($, Drupal, displace) { (function ($, Drupal, displace) {
"use strict"; 'use strict';
/** /**
* Attaches sticky table headers. * Attaches sticky table headers.
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
(function ($, Drupal, window) { (function ($, Drupal, window) {
"use strict"; 'use strict';
/** /**
* Attach the tableResponsive function to {@link Drupal.behaviors}. * Attach the tableResponsive function to {@link Drupal.behaviors}.
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
(function ($, Drupal) { (function ($, Drupal) {
"use strict"; 'use strict';
/** /**
* Initialize tableSelects. * Initialize tableSelects.
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
(function ($) { (function ($) {
"use strict"; 'use strict';
/** /**
* Set the client's system time zone as default values of form fields. * Set the client's system time zone as default values of form fields.
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
(function ($) { (function ($) {
"use strict"; 'use strict';
/** /**
* This script transforms a set of details into a stack of vertical tabs. * This script transforms a set of details into a stack of vertical tabs.
...@@ -126,7 +126,7 @@ ...@@ -126,7 +126,7 @@
event.preventDefault(); event.preventDefault();
self.focus(); self.focus();
// Set focus on the first input field of the visible details/tab pane. // 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 @@ ...@@ -5,7 +5,7 @@
(function ($, Drupal) {