Apply JavaScript rule to use the dot notation

We were using the dot notation in most places, but not everywhere.
This commit is contained in:
Javi Martín
2019-07-03 02:32:47 +02:00
parent 25bfd01e69
commit af6a494344
6 changed files with 14 additions and 13 deletions

View File

@@ -20,6 +20,7 @@ rules:
comma-spacing: error comma-spacing: error
computed-property-spacing: error computed-property-spacing: error
curly: error curly: error
dot-notation: error
eol-last: error eol-last: error
eqeqeq: eqeqeq:
- error - error

View File

@@ -2,9 +2,9 @@
"use strict"; "use strict";
App.BudgetEditAssociations = { App.BudgetEditAssociations = {
set_text: function(response) { set_text: function(response) {
$(".js-budget-show-administrators-list").text(response["administrators"]); $(".js-budget-show-administrators-list").text(response.administrators);
$(".js-budget-show-valuators-list").text(response["valuators"]); $(".js-budget-show-valuators-list").text(response.valuators);
$(".js-budget-show-trackers-list").text(response["trackers"]); $(".js-budget-show-trackers-list").text(response.trackers);
}, },
initialize: function() { initialize: function() {
$(".js-budget-list-checkbox-user").on({ $(".js-budget-list-checkbox-user").on({

View File

@@ -11,9 +11,9 @@
$("#nested-documents").on("cocoon:after-insert", function(e, nested_document) { $("#nested-documents").on("cocoon:after-insert", function(e, nested_document) {
var input; var input;
input = $(nested_document).find(".js-document-attachment"); 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); App.Documentable.initializeDirectUploadInput(input);
if (input["lockUpload"]) { if (input.lockUpload) {
App.Documentable.lockUploads(); App.Documentable.lockUploads();
} }
}); });
@@ -64,7 +64,7 @@
event.stopPropagation(); event.stopPropagation();
App.Documentable.doDeleteCachedAttachmentRequest(this.href, data); App.Documentable.doDeleteCachedAttachmentRequest(this.href, data);
}); });
if (input["lockUpload"]) { if (input.lockUpload) {
App.Documentable.showNotice(); App.Documentable.showNotice();
} }
}, },

View File

@@ -70,7 +70,7 @@
type: "renderLegislationAnnotation", type: "renderLegislationAnnotation",
annotation_id: target.data("annotation-id"), annotation_id: target.data("annotation-id"),
annotation_url: target.closest(".legislation-annotatable").data("legislation-annotatable-base-url"), 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) { parents_ids.each(function(i, pid) {
$.event.trigger({ $.event.trigger({
@@ -149,7 +149,7 @@
type: "renderLegislationAnnotation", type: "renderLegislationAnnotation",
annotation_id: ann_id, annotation_id: ann_id,
annotation_url: el.closest(".legislation-annotatable").data("legislation-annotatable-base-url"), annotation_url: el.closest(".legislation-annotatable").data("legislation-annotatable-base-url"),
offset: el.offset()["top"] offset: el.offset().top
}); });
clearInterval(checkExist); clearInterval(checkExist);
} }
@@ -205,7 +205,7 @@
App.LegislationAnnotatable.app = new annotator.App().include(function() { App.LegislationAnnotatable.app = new annotator.App().include(function() {
return { return {
beforeAnnotationCreated: function(ann) { beforeAnnotationCreated: function(ann) {
ann["legislation_draft_version_id"] = ann_id; ann.legislation_draft_version_id = ann_id;
ann.permissions = ann.permissions || {}; ann.permissions = ann.permissions || {};
ann.permissions.admin = []; ann.permissions.admin = [];
} }

View File

@@ -75,7 +75,7 @@
}; };
openMarkerPopup = function(e) { openMarkerPopup = function(e) {
marker = e.target; marker = e.target;
$.ajax("/investments/" + marker.options["id"] + "/json_data", { $.ajax("/investments/" + marker.options.id + "/json_data", {
type: "GET", type: "GET",
dataType: "json", dataType: "json",
success: function(data) { success: function(data) {
@@ -84,7 +84,7 @@
}); });
}; };
getPopupContent = function(data) { getPopupContent = function(data) {
return "<a href='/budgets/" + data["budget_id"] + "/investments/" + data["investment_id"] + "'>" + data["investment_title"] + "</a>"; return "<a href='/budgets/" + data.budget_id + "/investments/" + data.investment_id + "'>" + data.investment_title + "</a>";
}; };
mapCenterLatLng = new L.LatLng(mapCenterLatitude, mapCenterLongitude); mapCenterLatLng = new L.LatLng(mapCenterLatitude, mapCenterLongitude);
map = L.map(element.id).setView(mapCenterLatLng, zoom); map = L.map(element.id).setView(mapCenterLatLng, zoom);
@@ -103,7 +103,7 @@
addMarkerInvestments.forEach(function(coordinates) { addMarkerInvestments.forEach(function(coordinates) {
if (App.Map.validCoordinates(coordinates)) { if (App.Map.validCoordinates(coordinates)) {
marker = createMarker(coordinates.lat, coordinates.long); marker = createMarker(coordinates.lat, coordinates.long);
marker.options["id"] = coordinates.investment_id; marker.options.id = coordinates.investment_id;
marker.on("click", openMarkerPopup); marker.on("click", openMarkerPopup);
} }
}); });

View File

@@ -29,7 +29,7 @@
} }
}, },
setTraduction: function(response) { setTraduction: function(response) {
$(".js-description_text").text(response["traduction"]); $(".js-description_text").text(response.traduction);
}, },
updateChecks: function() { updateChecks: function() {
App.Votations.checkMaxVotes(); App.Votations.checkMaxVotes();