address semicolon insertion lint

> Code that uses automatic semicolon insertion inconsistently is hard to read and maintain.

See: https://github.com/PrivateBin/PrivateBin/security/quality/rules/js%2Fautomatic-semicolon-insertion
This commit is contained in:
El RIDO
2026-01-25 09:41:52 +01:00
parent 7806faf16c
commit a4eaa77b82
7 changed files with 17 additions and 15 deletions

View File

@@ -10,7 +10,7 @@ global.WebCrypto = require('@peculiar/webcrypto').Crypto;
// application libraries to test
global.$ = global.jQuery = require('./jquery-3.7.1');
global.zlib = require('./zlib-1.3.1-1').zlib;
global.zlib = require('./zlib-1.3.1-2').zlib;
require('./prettify');
global.prettyPrint = window.PR.prettyPrint;
global.prettyPrintOne = window.PR.prettyPrintOne;
@@ -82,10 +82,10 @@ function parseMime(line) {
// these to be character encoding agnostic
exports.atob = function(encoded) {
return Buffer.from(encoded, 'base64').toString('binary');
}
};
exports.btoa = function(text) {
return Buffer.from(text, 'binary').toString('base64');
}
};
// provides random lowercase characters from a to z
exports.jscA2zString = function() {

View File

@@ -555,13 +555,14 @@ jQuery.PrivateBin = (function($) {
* @param {string} str
* @return {string} escaped HTML
*/
me.htmlEntities = function(str) {
me.htmlEntities = function(str)
{
return String(str).replace(
/[&<>"'`=\/]/g, function(s) {
return entityMap[s];
}
);
}
};
/**
* calculate expiration date given initial date and expiration period
@@ -572,7 +573,8 @@ jQuery.PrivateBin = (function($) {
* @param {string|number} expirationDisplayStringOrSecondsToExpire - may not be empty
* @return {Date}
*/
me.calculateExpirationDate = function(initialDate, expirationDisplayStringOrSecondsToExpire) {
me.calculateExpirationDate = function(initialDate, expirationDisplayStringOrSecondsToExpire)
{
let expirationDate = new Date(initialDate),
secondsToExpiration = expirationDisplayStringOrSecondsToExpire;
if (typeof expirationDisplayStringOrSecondsToExpire === 'string') {
@@ -617,7 +619,7 @@ jQuery.PrivateBin = (function($) {
}
return result;
}
};
/**
* resets state, used for unit testing
@@ -1312,7 +1314,7 @@ jQuery.PrivateBin = (function($) {
spec[1] = atob(spec[1]);
if (spec[7] === 'zlib') {
if (typeof zlib === 'undefined') {
throw 'Error decompressing document, your browser does not support WebAssembly. Please use another browser to view this document.'
throw 'Error decompressing document, your browser does not support WebAssembly. Please use another browser to view this document.';
}
}
try {

View File

@@ -49,7 +49,7 @@ describe('AttachmentViewer', function () {
{value: function(blob) {
return 'blob:' + location.origin + '/1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed';
}}
)
);
}
$.PrivateBin.AttachmentViewer.init();
$.PrivateBin.Model.init();
@@ -152,7 +152,7 @@ describe('AttachmentViewer', function () {
{value: function(blob) {
return 'blob:' + location.origin + '/1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed';
}}
)
);
}
$.PrivateBin.AttachmentViewer.init();
$.PrivateBin.Model.init();

View File

@@ -129,7 +129,7 @@
rawDef.destroy();
return ret;
},
}
};
return ret;
}

View File

@@ -122,10 +122,10 @@ class Configuration
'js/kjua-0.10.0.js' => 'sha512-BYj4xggowR7QD150VLSTRlzH62YPfhpIM+b/1EUEr7RQpdWAGKulxWnOvjFx1FUlba4m6ihpNYuQab51H6XlYg==',
'js/legacy.js' => 'sha512-rGXYUpIqbFoHAgBXZ0UlJBdNAIMOC9EQ67MG0X46D5uRB8LvwzgKirbSQRGdYfk8I2jsUcm+tvHXYboUnC6DUg==',
'js/prettify.js' => 'sha512-puO0Ogy++IoA2Pb9IjSxV1n4+kQkKXYAEUtVzfZpQepyDPyXk8hokiYDS7ybMogYlyyEIwMLpZqVhCkARQWLMg==',
'js/privatebin.js' => 'sha512-a8zeCawerrfYBa3x0fiaqZMtR1k9Fd0ZKMl2rhR2M7q25dGHDaoZOzn5xk9AiNHR+Enn7srauqOxnnI1XlooCw==',
'js/privatebin.js' => 'sha512-Ln6NW/gCPGV/Ol6EEJUIqGOm5yklpbZ9/C3iexn+ab4bLY62Ke26ZgAz6YuYUH5aHhLhTZkodQQpOK+jdZg2jg==',
'js/purify-3.3.0.js' => 'sha512-lsHD5zxs4lu/NDzaaibe27Vd2t7Cy9JQ3qDHUvDfb4oZvKoWDNEhwUY+4bT3R68cGgpgCYp8U1x2ifeVxqurdQ==',
'js/showdown-2.1.0.js' => 'sha512-WYXZgkTR0u/Y9SVIA4nTTOih0kXMEd8RRV6MLFdL6YU8ymhR528NLlYQt1nlJQbYz4EW+ZsS0fx1awhiQJme1Q==',
'js/zlib-1.3.1-1.js' => 'sha512-5bU9IIP4PgBrOKLZvGWJD4kgfQrkTz8Z3Iqeu058mbQzW3mCumOU6M3UVbVZU9rrVoVwaW4cZK8U8h5xjF88eQ==',
'js/zlib-1.3.1-2.js' => 'sha512-4gT+v+BkBqdVBbKOO4qKGOAzuay+v1FmOLksS+bMgQ08Oo4xEb3X48Xq1Kv2b4HtiCQA7xq9dFRzxal7jmQI7w==',
),
);

View File

@@ -50,7 +50,7 @@ if ($QRCODE) :
<?php
endif;
?>
<?php $this->_scriptTag('js/zlib-1.3.1-1.js', 'defer'); ?>
<?php $this->_scriptTag('js/zlib-1.3.1-2.js', 'defer'); ?>
<?php $this->_scriptTag('js/base-x-5.0.1.js', 'defer'); ?>
<?php $this->_scriptTag('js/bootstrap-3.4.1.js', 'defer'); ?>
<?php

View File

@@ -33,7 +33,7 @@ if ($QRCODE) :
<?php
endif;
?>
<?php $this->_scriptTag('js/zlib-1.3.1-1.js', 'defer'); ?>
<?php $this->_scriptTag('js/zlib-1.3.1-2.js', 'defer'); ?>
<?php $this->_scriptTag('js/base-x-5.0.1.js', 'defer'); ?>
<?php $this->_scriptTag('js/bootstrap-5.3.8.js', 'defer'); ?>
<?php $this->_scriptTag('js/dark-mode-switch.js', 'defer'); ?>