From e7c2aa4d607ad697d681be0426b5ec49d5559706 Mon Sep 17 00:00:00 2001 From: El RIDO Date: Tue, 7 Oct 2025 00:11:49 +0200 Subject: [PATCH] address eslint errors --- js/privatebin.js | 4 ++-- js/test/AttachmentViewer.js | 1 + js/test/Helper.js | 2 +- js/test/I18n.js | 3 +-- js/test/PasteStatus.js | 2 +- js/test/PasteViewer.js | 4 ++-- js/test/Prompt.js | 3 +-- js/test/TopNav.js | 6 +++--- js/test/emailTemplateTest.js | 4 ++-- lib/Configuration.php | 2 +- 10 files changed, 15 insertions(+), 16 deletions(-) diff --git a/js/privatebin.js b/js/privatebin.js index e8dbc7fa..22554a0d 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -727,7 +727,7 @@ jQuery.PrivateBin = (function($) { * @param {...*} args - one or multiple parameters injected into placeholders * @return {string} */ - me.translate = function() + me.translate = function() // eslint-disable-line complexity { // convert parameters to array let args = Array.prototype.slice.call(arguments), @@ -855,7 +855,7 @@ jQuery.PrivateBin = (function($) { * @param {int} n * @return {int} array key */ - me.getPluralForm = function(n) { + me.getPluralForm = function(n) { // eslint-disable-line complexity switch (language) { case 'ar': diff --git a/js/test/AttachmentViewer.js b/js/test/AttachmentViewer.js index f3016076..2a03ef54 100644 --- a/js/test/AttachmentViewer.js +++ b/js/test/AttachmentViewer.js @@ -12,6 +12,7 @@ describe('AttachmentViewer', function () { 'string', 'string', 'string', + // eslint-disable-next-line complexity function (mimeType, rawdata, filename, prefix, postfix) { let clean = jsdom(), data = 'data:' + mimeType + ';base64,' + common.btoa(rawdata), diff --git a/js/test/Helper.js b/js/test/Helper.js index 709d5121..7a2fa384 100644 --- a/js/test/Helper.js +++ b/js/test/Helper.js @@ -100,7 +100,7 @@ describe('Helper', function () { jsc.array(common.jscHashString()), 'string', function (prefix, url, fragment, postfix) { - prefix = prefix.replace(/\r|\f/g, '\n').replace('\u0000', '').replace('\u000b', '');; + prefix = prefix.replace(/\r|\f/g, '\n').replace('\u0000', '').replace('\u000b', ''); postfix = ' ' + postfix.replace('\r', '\n').replace('\u0000', ''); url.fragment = fragment.join(''); let urlString = common.urlToString(url), diff --git a/js/test/I18n.js b/js/test/I18n.js index eeea648c..503422e9 100644 --- a/js/test/I18n.js +++ b/js/test/I18n.js @@ -192,9 +192,8 @@ describe('I18n', function () { // mock clean = jsdom('', {cookie: ['lang=' + language]}); - // eslint-disable-line global-require + // eslint-disable-next-line global-require $.PrivateBin.I18n.reset(language, require('../../i18n/' + language + '.json')); - // eslint-enable-line global-require var loadedLang = $.PrivateBin.I18n.getLanguage(), result = $.PrivateBin.I18n.translate('Never'), alias = $.PrivateBin.I18n._('Never'); diff --git a/js/test/PasteStatus.js b/js/test/PasteStatus.js index f749f659..82aa951f 100644 --- a/js/test/PasteStatus.js +++ b/js/test/PasteStatus.js @@ -50,7 +50,7 @@ describe('PasteStatus', function () { 'nestring', common.jscUrl(), function (schema, domain, url) { - domain = domain.replace(/\P{Letter}|[\u{00AA}-\u{00BA}]/gu, '').toLowerCase(); + domain = domain.replace(/\P{Letter}|[\u{AA}-\u{BA}]/gu, '').toLowerCase(); if (domain.length === 0) { domain = 'a'; } diff --git a/js/test/PasteViewer.js b/js/test/PasteViewer.js index eb9eab29..4e306c72 100644 --- a/js/test/PasteViewer.js +++ b/js/test/PasteViewer.js @@ -75,9 +75,9 @@ describe('PasteViewer', function () { '', '\'">>">' + '' + - '<script>prompt(1)</script>@gmail.com<isindex formaction=' + + '<script>prompt(1)</script>@gmail.com<isindex formaction=java' + // obfuscate script URL from eslint rule: no-script-url - 'java' + 'script' + ':alert(/XSS/) type=submit>\'-->"></script>' + + 'script:alert(/XSS/) type=submit>\'-->"></script>' + '<script>alert(document.cookie)</script>"><img/id="confirm' + '&lpar;1)"/alt="/"src="/"onerror=eval(id)>\'">', '<IMG SRC="javascript:alert(\'XSS\');">', diff --git a/js/test/Prompt.js b/js/test/Prompt.js index 41775d12..273c3896 100644 --- a/js/test/Prompt.js +++ b/js/test/Prompt.js @@ -22,9 +22,8 @@ describe('Prompt', function () { ); $.PrivateBin.Model.reset(); $.PrivateBin.Model.init(); - // eslint-disable-line global-require + // eslint-disable-next-line global-require global.bootstrap = require('../bootstrap-5.3.7'); - // eslint-enable-line global-require $.PrivateBin.Prompt.init(); $.PrivateBin.Prompt.requestPassword(); $('#passworddecrypt').val(password); diff --git a/js/test/TopNav.js b/js/test/TopNav.js index ab2bf145..7798d856 100644 --- a/js/test/TopNav.js +++ b/js/test/TopNav.js @@ -68,7 +68,7 @@ describe('TopNav', function () { it( 'displays & hides navigation elements for creating a document', - function () { + function () { // eslint-disable-line complexity var results = []; $('body').html( '<nav><div id="navbar"><ul><li><button id="newbutton" ' + @@ -517,12 +517,12 @@ describe('TopNav', function () { cleanup(); }); - // eslint-disable-line global-require + // eslint-disable global-require var File = window.File, FileList = window.FileList, path = require('path'), mime = require('mime-types'); - // eslint-enable-line global-require + // eslint-enable global-require // mocking file input as per https://github.com/jsdom/jsdom/issues/1272 function createFile(file_path) { diff --git a/js/test/emailTemplateTest.js b/js/test/emailTemplateTest.js index 56b845f6..24ed9147 100644 --- a/js/test/emailTemplateTest.js +++ b/js/test/emailTemplateTest.js @@ -37,7 +37,7 @@ function buildEmailDomWithShortUrl() { '</ul></div></nav>' + '<input id="burnafterreadingoption" type="checkbox">' + '<div id="pastelink">Your document is ' + - `<a id="pasteurl" href="'https://short.example/xYz'">'https://short.example/xYz'</a> ` + + '<a id="pasteurl" href="https://short.example/xYz">https://short.example/xYz</a> ' + '<span id="copyhint">(Hit <kbd>Ctrl</kbd>+<kbd>c</kbd> to copy)</span>' + '</div>' ); @@ -72,7 +72,7 @@ function stubWinOpen($element) { return { getUrl: () => openedUrl, - restore: () => { try { win.open = origOpen; } catch (e) {} }, + restore: () => { try { win.open = origOpen; } catch (e) { /* suppress exception in restore */ } }, win }; } diff --git a/lib/Configuration.php b/lib/Configuration.php index fd2de0a1..ef8ddc5f 100644 --- a/lib/Configuration.php +++ b/lib/Configuration.php @@ -121,7 +121,7 @@ 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-Doh4XjuMlSGZcnrwhwCV5/SdLAQOJ1YjnVFleZ3o6yN9qRfbq5T3glrYir6xVlU7vHY5v0zdHWSJspGIkWG33w==', + 'js/privatebin.js' => 'sha512-28TbF+KEbUv22X+tVm5a0ik1qQGtjqcKoSuXA+jFZqC9zyFF8Km+V2rSDqwgF0hf38WMVp5F2k0T6u/bKJLpSQ==', 'js/purify-3.2.6.js' => 'sha512-zqwL4OoBLFx89QPewkz4Lz5CSA2ktU+f31fuECkF0iK3Id5qd3Zpq5dMby8KwHjIEpsUgOqwF58cnmcaNem0EA==', 'js/showdown-2.1.0.js' => 'sha512-WYXZgkTR0u/Y9SVIA4nTTOih0kXMEd8RRV6MLFdL6YU8ymhR528NLlYQt1nlJQbYz4EW+ZsS0fx1awhiQJme1Q==', 'js/zlib-1.3.1-1.js' => 'sha512-5bU9IIP4PgBrOKLZvGWJD4kgfQrkTz8Z3Iqeu058mbQzW3mCumOU6M3UVbVZU9rrVoVwaW4cZK8U8h5xjF88eQ==',