Apply JavaScript rules to prevent shadowing

Using the same variable name makes the code more difficult to read.

We're also enabling the `no-param-reassing` rule since we accidentally
reassigned params in commit 824dd26d, and this rule will prevent us from
doing so in the future.
This commit is contained in:
Javi Martín
2019-07-03 01:57:31 +02:00
parent efc32bc764
commit 044da18af1
3 changed files with 8 additions and 6 deletions

View File

@@ -40,6 +40,8 @@ rules:
no-multiple-empty-lines: no-multiple-empty-lines:
- error - error
- max: 1 - max: 1
no-param-reassign: error
no-shadow: error
no-spaced-func: error no-spaced-func: error
no-tabs: error no-tabs: error
no-trailing-spaces: error no-trailing-spaces: error

View File

@@ -59,9 +59,9 @@
$(data.wrapper).find(".attachment-actions .action-remove").removeClass("small-3").addClass("small-12"); $(data.wrapper).find(".attachment-actions .action-remove").removeClass("small-3").addClass("small-12");
destroyAttachmentLink = $(data.result.destroy_link); destroyAttachmentLink = $(data.result.destroy_link);
$(data.destroyAttachmentLinkContainer).html(destroyAttachmentLink); $(data.destroyAttachmentLinkContainer).html(destroyAttachmentLink);
$(destroyAttachmentLink).on("click", function(e) { $(destroyAttachmentLink).on("click", function(event) {
e.preventDefault(); event.preventDefault();
e.stopPropagation(); event.stopPropagation();
App.Documentable.doDeleteCachedAttachmentRequest(this.href, data); App.Documentable.doDeleteCachedAttachmentRequest(this.href, data);
}); });
if (input["lockUpload"]) { if (input["lockUpload"]) {

View File

@@ -61,9 +61,9 @@
App.Imageable.setPreview(data); App.Imageable.setPreview(data);
destroyAttachmentLink = $(data.result.destroy_link); destroyAttachmentLink = $(data.result.destroy_link);
$(data.destroyAttachmentLinkContainer).html(destroyAttachmentLink); $(data.destroyAttachmentLinkContainer).html(destroyAttachmentLink);
$(destroyAttachmentLink).on("click", function(e) { $(destroyAttachmentLink).on("click", function(event) {
e.preventDefault(); event.preventDefault();
e.stopPropagation(); event.stopPropagation();
App.Imageable.doDeleteCachedAttachmentRequest(this.href, data); App.Imageable.doDeleteCachedAttachmentRequest(this.href, data);
}); });
}, },