address eslint errors

This commit is contained in:
El RIDO 2025-10-07 00:11:49 +02:00
parent 85962a537a
commit e7c2aa4d60
No known key found for this signature in database
GPG key ID: 0F5C940A6BD81F92
10 changed files with 15 additions and 16 deletions

View file

@ -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':

View file

@ -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),

View file

@ -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),

View file

@ -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');

View file

@ -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';
}

View file

@ -75,9 +75,9 @@ describe('PasteViewer', function () {
'<SCRIPT SRC=http://example.com/xss.js></SCRIPT>',
'\'">><marquee><img src=x onerror=confirm(1)></marquee>">' +
'</plaintext\\></|\\><plaintext/onmouseover=prompt(1)>' +
'<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\');">',

View file

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

View file

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

View file

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

View file

@ -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==',