Enable the ESLint prefer-const rule in the web/ directory

Please find additional details about the ESLint rule at https://eslint.org/docs/rules/prefer-const

Note that this patch is generated automatically, by using the ESLint `--fix` argument, and will thus require some additional clean-up (which is done separately).
This commit is contained in:
Jonas Jenwald 2019-12-27 00:22:32 +01:00
parent 9c767e3875
commit 5d14e68bec
36 changed files with 367 additions and 367 deletions

View file

@ -135,18 +135,18 @@ class PDFAttachmentViewer {
return;
}
let names = Object.keys(attachments).sort(function(a, b) {
const names = Object.keys(attachments).sort(function(a, b) {
return a.toLowerCase().localeCompare(b.toLowerCase());
});
attachmentsCount = names.length;
for (let i = 0; i < attachmentsCount; i++) {
let item = attachments[names[i]];
let filename = removeNullCharacters(getFilenameFromUrl(item.filename));
const item = attachments[names[i]];
const filename = removeNullCharacters(getFilenameFromUrl(item.filename));
let div = document.createElement("div");
const div = document.createElement("div");
div.className = "attachmentsItem";
let button = document.createElement("button");
const button = document.createElement("button");
button.textContent = filename;
if (
/\.pdf$/i.test(filename) &&
@ -175,7 +175,7 @@ class PDFAttachmentViewer {
if (!attachments) {
attachments = Object.create(null);
} else {
for (let name in attachments) {
for (const name in attachments) {
if (id === name) {
return; // Ignore the new attachment if it already exists.
}