implementing ESlint suggestions
This commit is contained in:
parent
5e070db6a1
commit
2db412873b
@ -1 +1,2 @@
|
||||
**/*{.,-}min.js
|
||||
js/*.js
|
||||
!js/privatebin.js
|
||||
|
@ -67,7 +67,6 @@ rules:
|
||||
no-case-declarations: 2
|
||||
no-div-regex: 2
|
||||
no-else-return: 0
|
||||
no-empty-label: 2
|
||||
no-empty-pattern: 2
|
||||
no-eq-null: 2
|
||||
no-eval: 2
|
||||
|
@ -104,7 +104,7 @@ describe('Alert', function () {
|
||||
icon = icon.join('');
|
||||
message = message.join('');
|
||||
var default_message = 'Loading…';
|
||||
if (message.length == 0) {
|
||||
if (message.length === 0) {
|
||||
message = default_message;
|
||||
}
|
||||
var expected = '<ul class="nav navbar-nav"><li ' +
|
||||
@ -191,7 +191,7 @@ describe('Alert', function () {
|
||||
$.PrivateBin.Alert.showRemaining,
|
||||
$.PrivateBin.Alert.showLoading
|
||||
];
|
||||
if (message.length == 0) {
|
||||
if (message.length === 0) {
|
||||
message = default_message;
|
||||
}
|
||||
$('body').html(
|
||||
|
@ -93,12 +93,12 @@ describe('DiscussionViewer', function () {
|
||||
$.PrivateBin.DiscussionViewer.getReplyNickname() === $('#reply #nickname').val() &&
|
||||
$.PrivateBin.DiscussionViewer.getReplyMessage() === $('#reply #replymessage').val()
|
||||
);
|
||||
var notificationResult = $.PrivateBin.DiscussionViewer.handleNotification(alertType == 'other' ? alert : alertType);
|
||||
if (alertType == 'loading') {
|
||||
var notificationResult = $.PrivateBin.DiscussionViewer.handleNotification(alertType === 'other' ? alert : alertType);
|
||||
if (alertType === 'loading') {
|
||||
results.push(notificationResult === false);
|
||||
} else {
|
||||
results.push(
|
||||
alertType == 'danger' ? (
|
||||
alertType === 'danger' ? (
|
||||
notificationResult.hasClass('alert-danger') &&
|
||||
!notificationResult.hasClass('alert-info')
|
||||
) : (
|
||||
|
@ -44,11 +44,11 @@ describe('Editor', function () {
|
||||
$.PrivateBin.Editor.show();
|
||||
$.PrivateBin.Editor.focusInput();
|
||||
results.push(
|
||||
$.PrivateBin.Editor.getText().length == 0
|
||||
$.PrivateBin.Editor.getText().length === 0
|
||||
);
|
||||
$.PrivateBin.Editor.setText(text);
|
||||
results.push(
|
||||
$.PrivateBin.Editor.getText() == $('#message').val()
|
||||
$.PrivateBin.Editor.getText() === $('#message').val()
|
||||
);
|
||||
$.PrivateBin.Editor.setText();
|
||||
results.push(
|
||||
|
@ -32,7 +32,7 @@ describe('PasteStatus', function () {
|
||||
var result1 = $('#pasteurl')[0].href,
|
||||
result2 = $('#deletelink a')[0].href;
|
||||
clean();
|
||||
return result1 == expected1 && result2 == expected2;
|
||||
return result1 === expected1 && result2 === expected2;
|
||||
}
|
||||
);
|
||||
});
|
||||
@ -58,7 +58,8 @@ describe('PasteStatus', function () {
|
||||
var clean = jsdom('', {
|
||||
url: schema.join('') + '://' + address.join('') +
|
||||
'/?' + query.join('') + '#' + fragment
|
||||
});
|
||||
}),
|
||||
result;
|
||||
$('body').html('<div id="remainingtime" class="hidden"></div>');
|
||||
$.PrivateBin.PasteStatus.init();
|
||||
$.PrivateBin.PasteStatus.showRemainingTime({
|
||||
@ -67,14 +68,14 @@ describe('PasteStatus', function () {
|
||||
'expire_date': remaining_time ? ((new Date()).getTime() / 1000) + remaining_time : 0
|
||||
});
|
||||
if (burnafterreading) {
|
||||
var result = $('#remainingtime').hasClass('foryoureyesonly') &&
|
||||
!$('#remainingtime').hasClass('hidden');
|
||||
result = $('#remainingtime').hasClass('foryoureyesonly') &&
|
||||
!$('#remainingtime').hasClass('hidden');
|
||||
} else if (remaining_time) {
|
||||
var result =!$('#remainingtime').hasClass('foryoureyesonly') &&
|
||||
!$('#remainingtime').hasClass('hidden');
|
||||
result =!$('#remainingtime').hasClass('foryoureyesonly') &&
|
||||
!$('#remainingtime').hasClass('hidden');
|
||||
} else {
|
||||
var result = $('#remainingtime').hasClass('hidden') &&
|
||||
!$('#remainingtime').hasClass('foryoureyesonly');
|
||||
result = $('#remainingtime').hasClass('hidden') &&
|
||||
!$('#remainingtime').hasClass('foryoureyesonly');
|
||||
}
|
||||
clean();
|
||||
return result;
|
||||
|
@ -28,8 +28,8 @@ describe('PasteViewer', function () {
|
||||
$('#placeholder').hasClass('hidden') &&
|
||||
$('#prettymessage').hasClass('hidden') &&
|
||||
$('#plaintext').hasClass('hidden') &&
|
||||
$.PrivateBin.PasteViewer.getFormat() == format &&
|
||||
$.PrivateBin.PasteViewer.getText() == ''
|
||||
$.PrivateBin.PasteViewer.getFormat() === format &&
|
||||
$.PrivateBin.PasteViewer.getText() === ''
|
||||
);
|
||||
$.PrivateBin.PasteViewer.run();
|
||||
results.push(
|
||||
@ -48,9 +48,9 @@ describe('PasteViewer', function () {
|
||||
results.push(
|
||||
$('#placeholder').hasClass('hidden') &&
|
||||
!$.PrivateBin.PasteViewer.isPrettyPrinted() &&
|
||||
$.PrivateBin.PasteViewer.getText() == text
|
||||
$.PrivateBin.PasteViewer.getText() === text
|
||||
);
|
||||
if (format == 'markdown') {
|
||||
if (format === 'markdown') {
|
||||
results.push(
|
||||
$('#prettymessage').hasClass('hidden') &&
|
||||
!$('#plaintext').hasClass('hidden')
|
||||
|
@ -32,7 +32,7 @@ describe('Prompt', function () {
|
||||
$('#passwordform').submit();
|
||||
var result = $.PrivateBin.Prompt.getPassword();
|
||||
clean();
|
||||
return result == password;
|
||||
return result === password;
|
||||
}
|
||||
);
|
||||
});
|
||||
|
@ -39,7 +39,7 @@ describe('UiHelper', function () {
|
||||
jsc.array(common.jscQueryString()),
|
||||
jsc.nearray(common.jscBase64String()),
|
||||
function (schema, address, query, fragment) {
|
||||
var expected = schema + '://' + address.join('') + '/' + '?' +
|
||||
var expected = schema + '://' + address.join('') + '/?' +
|
||||
query.join('') + '#' + fragment.join(''),
|
||||
clean = jsdom('', {url: expected});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user