Commit b0e82e58 authored by alexpott's avatar alexpott
Browse files

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.
......
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