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
computed-property-spacing: error
curly: error
dot-notation: error
eol-last: error
eqeqeq:
- error

View File

@@ -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({

View File

@@ -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();
}
},

View File

@@ -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 = [];
}

View File

@@ -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 "<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);
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);
}
});

View File

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