Skip to content
Permalink
Browse files

Enforce double quotes on JS (#3092)

  • Loading branch information...
deivid-rodriguez authored and josepjaume committed Mar 23, 2018
1 parent 720676d commit d5cbd3415637e25a223edc6c94e68692dc50df25
Showing with 275 additions and 275 deletions.
  1. +1 −1 .eslintrc.json
  2. +2 −2 decidim-accountability/app/assets/javascripts/decidim/accountability/accountability.js.es6
  3. +11 −11 ...im-accountability/app/assets/javascripts/decidim/accountability/admin/accountability_admin.js.es6
  4. +5 −5 decidim-admin/app/assets/javascripts/decidim/admin/application.js.es6
  5. +1 −1 decidim-admin/app/assets/javascripts/decidim/admin/sort_list.component.js.es6
  6. +4 −4 decidim-admin/app/assets/javascripts/decidim/admin/tab_focus.js.es6
  7. +4 −4 decidim-api/app/assets/javascripts/decidim/api/docs.js.es6
  8. +4 −4 decidim-assemblies/app/assets/javascripts/decidim/assemblies/admin/assemblies.js.es6
  9. +10 −10 decidim-budgets/app/assets/javascripts/decidim/budgets/projects.js.es6
  10. +5 −5 decidim-comments/app/frontend/support/graphql_transformer.js
  11. +8 −8 decidim-core/app/assets/javascripts/decidim/account_form.js.es6
  12. +1 −1 decidim-core/app/assets/javascripts/decidim/append_elements.js.es6
  13. +5 −5 decidim-core/app/assets/javascripts/decidim/append_redirect_url_to_modals.js.es6
  14. +10 −10 decidim-core/app/assets/javascripts/decidim/data_picker.js.es6
  15. +16 −16 decidim-core/app/assets/javascripts/decidim/editor.js.es6
  16. +1 −1 decidim-core/app/assets/javascripts/decidim/filters.js.es6
  17. +15 −15 decidim-core/app/assets/javascripts/decidim/form_filter.component.js.es6
  18. +29 −29 decidim-core/app/assets/javascripts/decidim/form_filter.component.test.js
  19. +3 −3 decidim-core/app/assets/javascripts/decidim/impersonation.js.es6
  20. +18 −18 decidim-core/app/assets/javascripts/decidim/input_mentions.js.es6
  21. +2 −2 decidim-core/app/assets/javascripts/decidim/input_tags.js.es6
  22. +9 −9 decidim-core/app/assets/javascripts/decidim/map.js.es6
  23. +10 −10 decidim-core/app/assets/javascripts/decidim/notifications.js.es6
  24. +5 −5 decidim-core/app/assets/javascripts/decidim/orders.js.es6
  25. +4 −4 decidim-core/app/assets/javascripts/decidim/user_registrations.js.es6
  26. +1 −1 decidim-core/app/assets/javascripts/decidim/widget.js.es6
  27. +10 −10 decidim-core/vendor/assets/javascripts/form_datepicker.js.es6
  28. +7 −7 decidim-meetings/app/assets/javascripts/decidim/meetings/admin/registrations_form.js.es6
  29. +4 −4 ...esses/app/assets/javascripts/decidim/participatory_processes/admin/participatory_processes.js.es6
  30. +8 −8 ...dim-participatory_processes/app/assets/javascripts/decidim/participatory_processes/filters.js.es6
  31. +3 −3 decidim-proposals/app/assets/javascripts/decidim/proposals/add_proposal.js.es6
  32. +17 −17 decidim-proposals/app/assets/javascripts/decidim/proposals/identity_selector_dialog.js.es6
  33. +2 −2 decidim-proposals/app/assets/javascripts/decidim/proposals/utils.js.es6
  34. +2 −2 ...im-surveys/app/assets/javascripts/decidim/surveys/admin/auto_buttons_by_position.component.js.es6
  35. +9 −9 decidim-surveys/app/assets/javascripts/decidim/surveys/admin/dynamic_fields.component.js.es6
  36. +29 −29 decidim-surveys/app/assets/javascripts/decidim/surveys/admin/surveys.js.es6
@@ -233,7 +233,7 @@
"prefer-spread": "error",
"prefer-template": "error",
"quote-props": "off",
"quotes": "off",
"quotes": ["error", "double", { "avoidEscape": true }],
"radix": "error",
"require-jsdoc": "error",
"rest-spread-spacing": "error",
@@ -5,8 +5,8 @@
$(() => {
// Show category list on click when we are on a small scren
if ($(window).width() < 768) {
$('.category--section').click((event) => {
$(event.currentTarget).next('.category--elements').toggleClass('active');
$(".category--section").click((event) => {
$(event.currentTarget).next(".category--elements").toggleClass("active");
});
}
})
@@ -2,7 +2,7 @@

$("#result_decidim_accountability_status_id").change(function () {
/* eslint-disable no-invalid-this */
const progress = $(this).find(':selected').data('progress')
const progress = $(this).find(":selected").data("progress")
if (progress || progress === 0) {
$("#result_progress").val(progress);
}
@@ -12,34 +12,34 @@ $(function() {
$(document).on("open.zf.reveal", "#data_picker-modal", function () {
let xhr = null;

$('#data_picker-autocomplete').autoComplete({
$("#data_picker-autocomplete").autoComplete({
minChars: 2,
source: function(term, response) {
try {
xhr.abort();
} catch (exception) { xhr = null}

xhr = $.getJSON(
'proposals.json',
"proposals.json",
{ term: term },
function(data) { response(data); }
);
},
renderItem: function (item, search) {
let sanitizedSearch = search.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
let re = new RegExp(`(${sanitizedSearch.split(' ').join('|')})`, "gi");
let sanitizedSearch = search.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
let re = new RegExp(`(${sanitizedSearch.split(" ").join("|")})`, "gi");
let title = item[0]
let modelId = item[1]
let val = `#${modelId}- ${title}`;
return `<div class="autocomplete-suggestion" data-model-id="${modelId}" data-val ="${title}">${val.replace(re, "<b>$1</b>")}</div>`;
},
onSelect: function(event, term, item) {
let choose = $('#proposal-picker-choose')
let modelId = item.data('modelId')
let val = `#${modelId}- ${item.data('val')}`;
choose.data('picker-value', modelId)
choose.data('picker-text', val)
choose.data('picker-choose', '')
let choose = $("#proposal-picker-choose")
let modelId = item.data("modelId")
let val = `#${modelId}- ${item.data("val")}`;
choose.data("picker-value", modelId)
choose.data("picker-text", val)
choose.data("picker-choose", "")
}
})
});
@@ -21,16 +21,16 @@ const pageLoad = () => {

toggleNav();

createSortList('#steps tbody', {
createSortList("#steps tbody", {
placeholder: $('<tr style="border-style: dashed; border-color: #000"><td colspan="4">&nbsp;</td></tr>')[0],
onSortUpdate: ($children) => {
const sortUrl = $('#steps tbody').data('sort-url')
const order = $children.map((index, child) => $(child).data('id')).toArray();
const sortUrl = $("#steps tbody").data("sort-url")
const order = $children.map((index, child) => $(child).data("id")).toArray();

$.ajax({
method: 'POST',
method: "POST",
url: sortUrl,
contentType: 'application/json',
contentType: "application/json",
data: JSON.stringify({ items_ids: order }) }, // eslint-disable-line camelcase
);
}
@@ -16,7 +16,7 @@
*/
constructor(sortListSelector, options) {
if ($(sortListSelector).length > 0) {
exports.sortable(sortListSelector, options)[0].addEventListener('sortupdate', (event) => {
exports.sortable(sortListSelector, options)[0].addEventListener("sortupdate", (event) => {
const $children = $(event.target).children();

if (options.onSortUpdate) {
@@ -5,15 +5,15 @@
*/
$(() => {
// Event launched by foundation
$('[data-tabs]').on('change.zf.tabs', (event) => {
const $container = $(event.target).next('.tabs-content .tabs-panel.is-active');
$("[data-tabs]").on("change.zf.tabs", (event) => {
const $container = $(event.target).next(".tabs-content .tabs-panel.is-active");
// Detect quilljs editor inside the tabs-panel
let $content = $container.find('.editor .ql-editor');
let $content = $container.find(".editor .ql-editor");
if ($content.length > 0) {
$content.focus();
// Detect if inside the tabs-panel have an input
} else {
$content = $container.find('input:first');
$content = $container.find("input:first");
if ($content.length > 0) {
$content.focus();
}
@@ -10,16 +10,16 @@ const fetcherFactory = (path) => {
return jQuery.ajax({
url: path,
data: JSON.stringify({ query }),
method: 'POST',
contentType: 'application/json',
dataType: 'json'
method: "POST",
contentType: "application/json",
dataType: "json"
});
};
}

window.renderDocumentation = (path) => {
ReactDOM.render(
<GraphQLDocs.GraphQLDocs fetcher={fetcherFactory(path)} />,
document.getElementById('documentation'),
document.getElementById("documentation"),
);
};
@@ -1,14 +1,14 @@
$(() => {
((exports) => {
const $assemblyScopeEnabled = $('#assembly_scopes_enabled');
const $assemblyScopeEnabled = $("#assembly_scopes_enabled");
const $assemblyScopeId = $("#assembly_scope_id");

if ($('.edit_assembly, .new_assembly').length > 0) {
$assemblyScopeEnabled.on('change', (event) => {
if ($(".edit_assembly, .new_assembly").length > 0) {
$assemblyScopeEnabled.on("change", (event) => {
const checked = event.target.checked;
exports.theDataPicker.enabled($assemblyScopeId, checked);
})
exports.theDataPicker.enabled($assemblyScopeId, $assemblyScopeEnabled.prop('checked'));
exports.theDataPicker.enabled($assemblyScopeId, $assemblyScopeEnabled.prop("checked"));
}
})(window);
});
@@ -2,27 +2,27 @@
// = require_self

$(() => {
const $projects = $('#projects, #project');
const $budgetSummaryTotal = $('.budget-summary__total');
const $budgetExceedModal = $('#budget-excess');
const $projects = $("#projects, #project");
const $budgetSummaryTotal = $(".budget-summary__total");
const $budgetExceedModal = $("#budget-excess");

const totalBudget = parseInt($budgetSummaryTotal.attr('data-total-budget'), 10);
const totalBudget = parseInt($budgetSummaryTotal.attr("data-total-budget"), 10);

const cancelEvent = (event) => {
event.stopPropagation();
event.preventDefault();
};

$projects.on('click', '.budget--list__action', (event) => {
const currentBudget = parseInt($('.budget-summary__progressbox').attr('data-current-budget'), 10);
$projects.on("click", ".budget--list__action", (event) => {
const currentBudget = parseInt($(".budget-summary__progressbox").attr("data-current-budget"), 10);
const $currentTarget = $(event.currentTarget);
const projectBudget = parseInt($currentTarget.attr('data-budget'), 10);
const projectBudget = parseInt($currentTarget.attr("data-budget"), 10);

if ($currentTarget.attr('disabled')) {
if ($currentTarget.attr("disabled")) {
cancelEvent(event);

} else if ($currentTarget.attr('data-add') && ((currentBudget + projectBudget) > totalBudget)) {
$budgetExceedModal.foundation('toggle');
} else if ($currentTarget.attr("data-add") && ((currentBudget + projectBudget) > totalBudget)) {
$budgetExceedModal.foundation("toggle");
cancelEvent(event);
}
});
@@ -1,21 +1,21 @@
/* eslint-env node */
const gql = require('graphql-tag');
const gql = require("graphql-tag");

// Takes `source` (the source GraphQL query string)
// and `doc` (the parsed GraphQL document) and tacks on
// the imported definitions.
const expandImports = (source) => {
const lines = source.split('\n');
const lines = source.split("\n");
let outputCode = "";

lines.some((line) => {
if (line[0] === '#' && line.slice(1).split(' ')[0] === 'import') {
const importFile = line.slice(1).split(' ')[1];
if (line[0] === "#" && line.slice(1).split(" ")[0] === "import") {
const importFile = line.slice(1).split(" ")[1];
const parseDocument = `require(${importFile})`;
const appendDef = `doc.definitions = doc.definitions.concat(${parseDocument}.definitions);`;
outputCode += `${appendDef}\n`;
}
return (line.length !== 0 && line[0] !== '#');
return (line.length !== 0 && line[0] !== "#");
});

return outputCode;
@@ -3,18 +3,18 @@
* reason field to the hidden field in the form inside the modal.
*/
$(() => {
const $deleteAccountForm = $('.delete-account');
const $deleteAccountModalForm = $('.delete-account-modal');
const $deleteAccountForm = $(".delete-account");
const $deleteAccountModalForm = $(".delete-account-modal");

if ($deleteAccountForm.length > 0) {
const $openModalButton = $('.open-modal-button');
const $modal = $('#deleteConfirm');
const $openModalButton = $(".open-modal-button");
const $modal = $("#deleteConfirm");

$openModalButton.on('click', (event) => {
$openModalButton.on("click", (event) => {
try {
const reasonValue = $deleteAccountForm.find('textarea#delete_account_delete_reason').val();
$deleteAccountModalForm.find('input#delete_account_delete_reason').val(reasonValue);
$modal.foundation('open');
const reasonValue = $deleteAccountForm.find("textarea#delete_account_delete_reason").val();
$deleteAccountModalForm.find("input#delete_account_delete_reason").val(reasonValue);
$modal.foundation("open");
} catch (error) {
console.error(error); // eslint-disable-line no-console
}
@@ -2,7 +2,7 @@

(function() {
$(() => {
let $appendableElements = $('.js-append');
let $appendableElements = $(".js-append");
$appendableElements.appendAround();
})
}(window));
@@ -23,14 +23,14 @@
*/
$(() => {
const removeUrlParameter = (url, parameter) => {
const urlParts = url.split('?');
const urlParts = url.split("?");

if (urlParts.length >= 2) {
// Get first part, and remove from array
const urlBase = urlParts.shift();

// Join it back up
const queryString = urlParts.join('?');
const queryString = urlParts.join("?");

const prefix = `${encodeURIComponent(parameter)}=`;
const parts = queryString.split(/[&;]/g);
@@ -47,7 +47,7 @@ $(() => {
return urlBase;
}

return `${urlBase}?${parts.join('&')}`;
return `${urlBase}?${parts.join("&")}`;
}

return url;
@@ -66,12 +66,12 @@ $(() => {

$(`${target} a`).attr("href", (index, href) => {
const querystring = jQuery.param({"redirect_url": redirectUrl});
return href + (href.match(/\?/) ? '&' : '?') + querystring;
return href + (href.match(/\?/) ? "&" : "?") + querystring;
});
}
});

$(document).on('closed.zf.reveal', (event) => {
$(document).on("closed.zf.reveal", (event) => {
$("#redirect_url", event.target).remove();
$("a", event.target).attr("href", (index, href) => {
if (href && href.indexOf("redirect_url") !== -1) {
@@ -16,7 +16,7 @@
activate(picker) {
let $element = $(picker);
let input = "hidden",
name = $element.data('picker-name'),
name = $element.data("picker-name"),
values = $(".picker-values", $element);

if ($element.hasClass("picker-multiple")) {
@@ -31,7 +31,7 @@

$element.on("click", "a", (event) => {
event.preventDefault();
if ($element.hasClass('disabled')) {
if ($element.hasClass("disabled")) {
return;
}
this._openPicker($element, event.target.parentNode);
@@ -78,7 +78,7 @@

_openPicker($picker, div) {
this._setCurrentPicker($picker, div);
this._load($("a", div).attr('href'));
this._load($("a", div).attr("href"));
}

_setCurrentPicker($picker, div) {
@@ -90,7 +90,7 @@
this.current = {
multiple: $picker.hasClass("picker-multiple"),
picker: $picker,
name: $picker.data('picker-name'),
name: $picker.data("picker-name"),
values: $picker.find(".picker-values"),
div: currentDiv
};
@@ -101,7 +101,7 @@
let modalContent = $(".data_picker-modal-content", this.modal);
modalContent.html(resp);
this._handleLinks(modalContent);
this.modal.foundation('open');
this.modal.foundation("open");
});
}

@@ -110,16 +110,16 @@
let $link = $(link);
$link.click((event) => {
event.preventDefault();
if ($link.data('data-close')) {
if ($link.data("data-close")) {
return;
}

let chooseUrl = $link.attr('href');
let chooseUrl = $link.attr("href");
if (chooseUrl) {
if (typeof $link.data('picker-choose') === 'undefined') {
if (typeof $link.data("picker-choose") === "undefined") {
this._load(chooseUrl);
} else {
this._choose({url: chooseUrl, value: $link.data('picker-value') || "", text: $link.data('picker-text') || ""});
this._choose({url: chooseUrl, value: $link.data("picker-value") || "", text: $link.data("picker-text") || ""});
}
}
});
@@ -153,7 +153,7 @@
if (user) {
$input.trigger("change");
this._removeErrors();
this.modal.foundation('close');
this.modal.foundation("close");
}

// Unselect updated value and close modal

0 comments on commit d5cbd34

Please sign in to comment.
You can’t perform that action at this time.