diff --git a/.eslintrc.yml b/.eslintrc.yml index 944715bb8..0feacde55 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -20,6 +20,7 @@ rules: comma-spacing: error computed-property-spacing: error curly: error + dot-notation: error eol-last: error eqeqeq: - error diff --git a/app/assets/javascripts/budget_edit_associations.js b/app/assets/javascripts/budget_edit_associations.js index 83ff6c48a..a50485a24 100644 --- a/app/assets/javascripts/budget_edit_associations.js +++ b/app/assets/javascripts/budget_edit_associations.js @@ -2,9 +2,9 @@ "use strict"; App.BudgetEditAssociations = { set_text: function(response) { - $(".js-budget-show-administrators-list").text(response["administrators"]); - $(".js-budget-show-valuators-list").text(response["valuators"]); - $(".js-budget-show-trackers-list").text(response["trackers"]); + $(".js-budget-show-administrators-list").text(response.administrators); + $(".js-budget-show-valuators-list").text(response.valuators); + $(".js-budget-show-trackers-list").text(response.trackers); }, initialize: function() { $(".js-budget-list-checkbox-user").on({ diff --git a/app/assets/javascripts/documentable.js b/app/assets/javascripts/documentable.js index 3fd2857a4..b6b85ba8c 100644 --- a/app/assets/javascripts/documentable.js +++ b/app/assets/javascripts/documentable.js @@ -11,9 +11,9 @@ $("#nested-documents").on("cocoon:after-insert", function(e, nested_document) { var input; input = $(nested_document).find(".js-document-attachment"); - input["lockUpload"] = $(nested_document).closest("#nested-documents").find(".document:visible").length >= $("#nested-documents").data("max-documents-allowed"); + input.lockUpload = $(nested_document).closest("#nested-documents").find(".document:visible").length >= $("#nested-documents").data("max-documents-allowed"); App.Documentable.initializeDirectUploadInput(input); - if (input["lockUpload"]) { + if (input.lockUpload) { App.Documentable.lockUploads(); } }); @@ -64,7 +64,7 @@ event.stopPropagation(); App.Documentable.doDeleteCachedAttachmentRequest(this.href, data); }); - if (input["lockUpload"]) { + if (input.lockUpload) { App.Documentable.showNotice(); } }, diff --git a/app/assets/javascripts/legislation_annotatable.js b/app/assets/javascripts/legislation_annotatable.js index 50d46ecd8..ab5f5cc6d 100644 --- a/app/assets/javascripts/legislation_annotatable.js +++ b/app/assets/javascripts/legislation_annotatable.js @@ -70,7 +70,7 @@ type: "renderLegislationAnnotation", annotation_id: target.data("annotation-id"), annotation_url: target.closest(".legislation-annotatable").data("legislation-annotatable-base-url"), - offset: target.offset()["top"] + offset: target.offset().top }); parents_ids.each(function(i, pid) { $.event.trigger({ @@ -149,7 +149,7 @@ type: "renderLegislationAnnotation", annotation_id: ann_id, annotation_url: el.closest(".legislation-annotatable").data("legislation-annotatable-base-url"), - offset: el.offset()["top"] + offset: el.offset().top }); clearInterval(checkExist); } @@ -205,7 +205,7 @@ App.LegislationAnnotatable.app = new annotator.App().include(function() { return { beforeAnnotationCreated: function(ann) { - ann["legislation_draft_version_id"] = ann_id; + ann.legislation_draft_version_id = ann_id; ann.permissions = ann.permissions || {}; ann.permissions.admin = []; } diff --git a/app/assets/javascripts/map.js b/app/assets/javascripts/map.js index 84d90093e..d1882cc5e 100644 --- a/app/assets/javascripts/map.js +++ b/app/assets/javascripts/map.js @@ -75,7 +75,7 @@ }; openMarkerPopup = function(e) { marker = e.target; - $.ajax("/investments/" + marker.options["id"] + "/json_data", { + $.ajax("/investments/" + marker.options.id + "/json_data", { type: "GET", dataType: "json", success: function(data) { @@ -84,7 +84,7 @@ }); }; getPopupContent = function(data) { - return "" + data["investment_title"] + ""; + return "" + data.investment_title + ""; }; mapCenterLatLng = new L.LatLng(mapCenterLatitude, mapCenterLongitude); map = L.map(element.id).setView(mapCenterLatLng, zoom); @@ -103,7 +103,7 @@ addMarkerInvestments.forEach(function(coordinates) { if (App.Map.validCoordinates(coordinates)) { marker = createMarker(coordinates.lat, coordinates.long); - marker.options["id"] = coordinates.investment_id; + marker.options.id = coordinates.investment_id; marker.on("click", openMarkerPopup); } }); diff --git a/app/assets/javascripts/votations.js b/app/assets/javascripts/votations.js index c409b58c3..312ccdcb7 100644 --- a/app/assets/javascripts/votations.js +++ b/app/assets/javascripts/votations.js @@ -29,7 +29,7 @@ } }, setTraduction: function(response) { - $(".js-description_text").text(response["traduction"]); + $(".js-description_text").text(response.traduction); }, updateChecks: function() { App.Votations.checkMaxVotes();