mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2025-11-27 09:40:34 -05:00
address eslint errors
This commit is contained in:
parent
85962a537a
commit
e7c2aa4d60
10 changed files with 15 additions and 16 deletions
|
|
@ -727,7 +727,7 @@ jQuery.PrivateBin = (function($) {
|
||||||
* @param {...*} args - one or multiple parameters injected into placeholders
|
* @param {...*} args - one or multiple parameters injected into placeholders
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
me.translate = function()
|
me.translate = function() // eslint-disable-line complexity
|
||||||
{
|
{
|
||||||
// convert parameters to array
|
// convert parameters to array
|
||||||
let args = Array.prototype.slice.call(arguments),
|
let args = Array.prototype.slice.call(arguments),
|
||||||
|
|
@ -855,7 +855,7 @@ jQuery.PrivateBin = (function($) {
|
||||||
* @param {int} n
|
* @param {int} n
|
||||||
* @return {int} array key
|
* @return {int} array key
|
||||||
*/
|
*/
|
||||||
me.getPluralForm = function(n) {
|
me.getPluralForm = function(n) { // eslint-disable-line complexity
|
||||||
switch (language)
|
switch (language)
|
||||||
{
|
{
|
||||||
case 'ar':
|
case 'ar':
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ describe('AttachmentViewer', function () {
|
||||||
'string',
|
'string',
|
||||||
'string',
|
'string',
|
||||||
'string',
|
'string',
|
||||||
|
// eslint-disable-next-line complexity
|
||||||
function (mimeType, rawdata, filename, prefix, postfix) {
|
function (mimeType, rawdata, filename, prefix, postfix) {
|
||||||
let clean = jsdom(),
|
let clean = jsdom(),
|
||||||
data = 'data:' + mimeType + ';base64,' + common.btoa(rawdata),
|
data = 'data:' + mimeType + ';base64,' + common.btoa(rawdata),
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ describe('Helper', function () {
|
||||||
jsc.array(common.jscHashString()),
|
jsc.array(common.jscHashString()),
|
||||||
'string',
|
'string',
|
||||||
function (prefix, url, fragment, postfix) {
|
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', '');
|
postfix = ' ' + postfix.replace('\r', '\n').replace('\u0000', '');
|
||||||
url.fragment = fragment.join('');
|
url.fragment = fragment.join('');
|
||||||
let urlString = common.urlToString(url),
|
let urlString = common.urlToString(url),
|
||||||
|
|
|
||||||
|
|
@ -192,9 +192,8 @@ describe('I18n', function () {
|
||||||
|
|
||||||
// mock
|
// mock
|
||||||
clean = jsdom('', {cookie: ['lang=' + language]});
|
clean = jsdom('', {cookie: ['lang=' + language]});
|
||||||
// eslint-disable-line global-require
|
// eslint-disable-next-line global-require
|
||||||
$.PrivateBin.I18n.reset(language, require('../../i18n/' + language + '.json'));
|
$.PrivateBin.I18n.reset(language, require('../../i18n/' + language + '.json'));
|
||||||
// eslint-enable-line global-require
|
|
||||||
var loadedLang = $.PrivateBin.I18n.getLanguage(),
|
var loadedLang = $.PrivateBin.I18n.getLanguage(),
|
||||||
result = $.PrivateBin.I18n.translate('Never'),
|
result = $.PrivateBin.I18n.translate('Never'),
|
||||||
alias = $.PrivateBin.I18n._('Never');
|
alias = $.PrivateBin.I18n._('Never');
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ describe('PasteStatus', function () {
|
||||||
'nestring',
|
'nestring',
|
||||||
common.jscUrl(),
|
common.jscUrl(),
|
||||||
function (schema, domain, url) {
|
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) {
|
if (domain.length === 0) {
|
||||||
domain = 'a';
|
domain = 'a';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -75,9 +75,9 @@ describe('PasteViewer', function () {
|
||||||
'<SCRIPT SRC=http://example.com/xss.js></SCRIPT>',
|
'<SCRIPT SRC=http://example.com/xss.js></SCRIPT>',
|
||||||
'\'">><marquee><img src=x onerror=confirm(1)></marquee>">' +
|
'\'">><marquee><img src=x onerror=confirm(1)></marquee>">' +
|
||||||
'</plaintext\\></|\\><plaintext/onmouseover=prompt(1)>' +
|
'</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
|
// 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' +
|
'<script>alert(document.cookie)</script>"><img/id="confirm' +
|
||||||
'(1)"/alt="/"src="/"onerror=eval(id)>\'">',
|
'(1)"/alt="/"src="/"onerror=eval(id)>\'">',
|
||||||
'<IMG SRC="javascript:alert(\'XSS\');">',
|
'<IMG SRC="javascript:alert(\'XSS\');">',
|
||||||
|
|
|
||||||
|
|
@ -22,9 +22,8 @@ describe('Prompt', function () {
|
||||||
);
|
);
|
||||||
$.PrivateBin.Model.reset();
|
$.PrivateBin.Model.reset();
|
||||||
$.PrivateBin.Model.init();
|
$.PrivateBin.Model.init();
|
||||||
// eslint-disable-line global-require
|
// eslint-disable-next-line global-require
|
||||||
global.bootstrap = require('../bootstrap-5.3.7');
|
global.bootstrap = require('../bootstrap-5.3.7');
|
||||||
// eslint-enable-line global-require
|
|
||||||
$.PrivateBin.Prompt.init();
|
$.PrivateBin.Prompt.init();
|
||||||
$.PrivateBin.Prompt.requestPassword();
|
$.PrivateBin.Prompt.requestPassword();
|
||||||
$('#passworddecrypt').val(password);
|
$('#passworddecrypt').val(password);
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ describe('TopNav', function () {
|
||||||
|
|
||||||
it(
|
it(
|
||||||
'displays & hides navigation elements for creating a document',
|
'displays & hides navigation elements for creating a document',
|
||||||
function () {
|
function () { // eslint-disable-line complexity
|
||||||
var results = [];
|
var results = [];
|
||||||
$('body').html(
|
$('body').html(
|
||||||
'<nav><div id="navbar"><ul><li><button id="newbutton" ' +
|
'<nav><div id="navbar"><ul><li><button id="newbutton" ' +
|
||||||
|
|
@ -517,12 +517,12 @@ describe('TopNav', function () {
|
||||||
cleanup();
|
cleanup();
|
||||||
});
|
});
|
||||||
|
|
||||||
// eslint-disable-line global-require
|
// eslint-disable global-require
|
||||||
var File = window.File,
|
var File = window.File,
|
||||||
FileList = window.FileList,
|
FileList = window.FileList,
|
||||||
path = require('path'),
|
path = require('path'),
|
||||||
mime = require('mime-types');
|
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
|
// mocking file input as per https://github.com/jsdom/jsdom/issues/1272
|
||||||
function createFile(file_path) {
|
function createFile(file_path) {
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ function buildEmailDomWithShortUrl() {
|
||||||
'</ul></div></nav>' +
|
'</ul></div></nav>' +
|
||||||
'<input id="burnafterreadingoption" type="checkbox">' +
|
'<input id="burnafterreadingoption" type="checkbox">' +
|
||||||
'<div id="pastelink">Your document is ' +
|
'<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>' +
|
'<span id="copyhint">(Hit <kbd>Ctrl</kbd>+<kbd>c</kbd> to copy)</span>' +
|
||||||
'</div>'
|
'</div>'
|
||||||
);
|
);
|
||||||
|
|
@ -72,7 +72,7 @@ function stubWinOpen($element) {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
getUrl: () => openedUrl,
|
getUrl: () => openedUrl,
|
||||||
restore: () => { try { win.open = origOpen; } catch (e) {} },
|
restore: () => { try { win.open = origOpen; } catch (e) { /* suppress exception in restore */ } },
|
||||||
win
|
win
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ class Configuration
|
||||||
'js/kjua-0.10.0.js' => 'sha512-BYj4xggowR7QD150VLSTRlzH62YPfhpIM+b/1EUEr7RQpdWAGKulxWnOvjFx1FUlba4m6ihpNYuQab51H6XlYg==',
|
'js/kjua-0.10.0.js' => 'sha512-BYj4xggowR7QD150VLSTRlzH62YPfhpIM+b/1EUEr7RQpdWAGKulxWnOvjFx1FUlba4m6ihpNYuQab51H6XlYg==',
|
||||||
'js/legacy.js' => 'sha512-rGXYUpIqbFoHAgBXZ0UlJBdNAIMOC9EQ67MG0X46D5uRB8LvwzgKirbSQRGdYfk8I2jsUcm+tvHXYboUnC6DUg==',
|
'js/legacy.js' => 'sha512-rGXYUpIqbFoHAgBXZ0UlJBdNAIMOC9EQ67MG0X46D5uRB8LvwzgKirbSQRGdYfk8I2jsUcm+tvHXYboUnC6DUg==',
|
||||||
'js/prettify.js' => 'sha512-puO0Ogy++IoA2Pb9IjSxV1n4+kQkKXYAEUtVzfZpQepyDPyXk8hokiYDS7ybMogYlyyEIwMLpZqVhCkARQWLMg==',
|
'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/purify-3.2.6.js' => 'sha512-zqwL4OoBLFx89QPewkz4Lz5CSA2ktU+f31fuECkF0iK3Id5qd3Zpq5dMby8KwHjIEpsUgOqwF58cnmcaNem0EA==',
|
||||||
'js/showdown-2.1.0.js' => 'sha512-WYXZgkTR0u/Y9SVIA4nTTOih0kXMEd8RRV6MLFdL6YU8ymhR528NLlYQt1nlJQbYz4EW+ZsS0fx1awhiQJme1Q==',
|
'js/showdown-2.1.0.js' => 'sha512-WYXZgkTR0u/Y9SVIA4nTTOih0kXMEd8RRV6MLFdL6YU8ymhR528NLlYQt1nlJQbYz4EW+ZsS0fx1awhiQJme1Q==',
|
||||||
'js/zlib-1.3.1-1.js' => 'sha512-5bU9IIP4PgBrOKLZvGWJD4kgfQrkTz8Z3Iqeu058mbQzW3mCumOU6M3UVbVZU9rrVoVwaW4cZK8U8h5xjF88eQ==',
|
'js/zlib-1.3.1-1.js' => 'sha512-5bU9IIP4PgBrOKLZvGWJD4kgfQrkTz8Z3Iqeu058mbQzW3mCumOU6M3UVbVZU9rrVoVwaW4cZK8U8h5xjF88eQ==',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue