fix: all auto fixable eslint issues (#31900)

* fix: eslint operator-linebreak issue

* fix: eslint quotes issue

* fix: react jsx indent and props issues

* fix: eslint trailing spaces issues

* fix: eslint line around directives issue

* fix: eslint prefer template issue

* fix: eslint semi rule

* fix: eslint newline per chain rule

* fix: eslint space infix ops rule

* fix: eslint space-in-parens issue

* fix: eslint space before function paren issue

* fix: eslint space before blocks issue

* fix: eslint arrow body style issue

* fix: eslint dot-location issue

* fix: eslint quotes issue

* fix: eslint quote props issue

* fix: eslint operator assignment issue

* fix: eslint new line after import issue

* fix: indent issues

* fix: operator assignment issue
This commit is contained in:
Syed Ali Abbas Zaidi
2023-05-09 11:57:15 +05:00
committed by GitHub
parent 118ea3a024
commit 228180b1ef
354 changed files with 1498 additions and 1489 deletions

View File

@@ -91,9 +91,9 @@ var onCertificatesReady = null;
var response = JSON.parse(jqXHR.responseText);
$certificate_regeneration_status.text(gettext(response.message)).addClass('message');
} catch (error) {
$certificate_regeneration_status.
text(gettext('Error while regenerating certificates. Please try again.')).
addClass('message');
$certificate_regeneration_status
.text(gettext('Error while regenerating certificates. Please try again.'))
.addClass('message');
}
}
});

View File

@@ -19,7 +19,7 @@
this.$course_error_toggle_text = this.$course_error_toggle.find('h2');
this.$course_errors = this.$course_errors_wrapper.find('.course-error');
this.$course_error_toggle_text.text(
this.$course_error_toggle_text.text() + (" (' + this.$course_errors.length + ')")
`${this.$course_error_toggle_text.text()} (' + this.$course_errors.length + ')`
);
this.$course_error_toggle.click(function(e) {
e.preventDefault();

View File

@@ -75,7 +75,7 @@
});
this.$list_issued_certificate_csv_btn.click(function() {
dataDownloadCert.clear_ui();
location.href = dataDownloadCert.$list_issued_certificate_csv_btn.data('endpoint') + '?csv=true';
location.href = `${dataDownloadCert.$list_issued_certificate_csv_btn.data('endpoint')}?csv=true`;
});
}
@@ -197,7 +197,7 @@
});
});
this.$list_studs_csv_btn.click(function() {
var url = dataDownloadObj.$list_studs_csv_btn.data('endpoint') + '/csv';
var url = `${dataDownloadObj.$list_studs_csv_btn.data('endpoint')}/csv`;
var errorMessage = gettext('Error generating student profile information. Please try again.');
dataDownloadObj.clear_display();
return $.ajax({

View File

@@ -38,7 +38,7 @@
this.$data_display_table = $('.data-display-table-holder');
this.$downloadProblemReport = $('#download-problem-report');
this.$tabSwitch = $('.data-download-nav .btn-link');
this.$selectedSection = $('#' + this.$tabSwitch.first().attr('data-section'));
this.$selectedSection = $(`#${this.$tabSwitch.first().attr('data-section')}`);
this.$learnerStatus = $('.learner-status');
this.ERROR_MESSAGES = {
@@ -75,7 +75,7 @@
* Show and hide selected tab data
*/
this.$tabSwitch.click(function(event) {
var selectedSection = '#' + $(this).attr('data-section');
var selectedSection = `#${$(this).attr('data-section')}`;
event.preventDefault();
$('.data-download-nav .btn-link').removeClass('active-section');
$('section.tab-data').hide();
@@ -117,7 +117,7 @@
var errorMessage = dataDownloadObj.ERROR_MESSAGES[selectedOption.val()];
if (selectedOption.data('directdownload')) {
location.href = selectedOption.data('endpoint') + '?csv=true';
location.href = `${selectedOption.data('endpoint')}?csv=true`;
} else if (selectedOption.data('datatable')) {
dataDownloadObj.renderDataTable(selectedOption);
} else {

View File

@@ -34,7 +34,7 @@
this.instructor_tasks = new (PendingInstructorTasks())(this.$section);
this.$error_msg = this.$section.find('#error-msg');
this.$list_sale_csv_btn.click(function() {
location.href = eCom.$list_sale_csv_btn.data('endpoint') + '/csv';
location.href = `${eCom.$list_sale_csv_btn.data('endpoint')}/csv`;
return location.href;
});
this.$list_order_sale_csv_btn.click(function() {

View File

@@ -123,11 +123,11 @@
extensions.prototype.fail_with_error = function(id, msg, xhr) {
var $taskError, $taskResponse, data,
message = msg;
$taskError = this.$section.find('#' + id + ' .request-response-error');
$taskResponse = this.$section.find('#' + id + ' .request-response');
$taskError = this.$section.find(`#${id} .request-response-error`);
$taskResponse = this.$section.find(`#${id} .request-response`);
this.clear_display();
data = $.parseJSON(xhr.responseText);
message += ': ' + data.error;
message += `: ${data.error}`;
$taskResponse.empty();
$taskError.empty();
$taskError.text(message);
@@ -136,8 +136,8 @@
extensions.prototype.display_response = function(id, data) {
var $taskError, $taskResponse;
$taskError = this.$section.find('#' + id + ' .request-response-error');
$taskResponse = this.$section.find('#' + id + ' .request-response');
$taskError = this.$section.find(`#${id} .request-response-error`);
$taskResponse = this.$section.find(`#${id} .request-response`);
$taskError.empty().hide();
$taskResponse.empty().text(data);
return $taskResponse.show();

View File

@@ -93,7 +93,7 @@ such that the value can be defined later than this assignment (file load order).
$(function() {
var $instructorDashboardContent;
$instructorDashboardContent = $('.' + CSS_INSTRUCTOR_CONTENT);
$instructorDashboardContent = $(`.${CSS_INSTRUCTOR_CONTENT}`);
if ($instructorDashboardContent.length > 0) {
setupInstructorDashboard($instructorDashboardContent);
return setupInstructorDashboardSections($instructorDashboardContent);
@@ -103,21 +103,21 @@ such that the value can be defined later than this assignment (file load order).
setupInstructorDashboard = function(idashContent) {
var $links, clickFirstLink, link, rmatch, sectionName;
$links = idashContent.find('.' + CSS_INSTRUCTOR_NAV).find('.btn-link');
$links = idashContent.find(`.${CSS_INSTRUCTOR_NAV}`).find('.btn-link');
$links.each(function(i, linkItem) {
return $(linkItem).click(function(e) {
var $section, itemSectionName, ref;
e.preventDefault();
idashContent.find('.' + CSS_INSTRUCTOR_NAV + ' li').children().removeClass(CSS_ACTIVE_SECTION);
idashContent.find('.' + CSS_INSTRUCTOR_NAV + ' li').children().attr('aria-pressed', 'false');
idashContent.find('.' + CSS_IDASH_SECTION).removeClass(CSS_ACTIVE_SECTION);
idashContent.find(`.${CSS_INSTRUCTOR_NAV} li`).children().removeClass(CSS_ACTIVE_SECTION);
idashContent.find(`.${CSS_INSTRUCTOR_NAV} li`).children().attr('aria-pressed', 'false');
idashContent.find(`.${CSS_IDASH_SECTION}`).removeClass(CSS_ACTIVE_SECTION);
itemSectionName = $(this).data('section');
$section = idashContent.find('#' + itemSectionName);
$section = idashContent.find(`#${itemSectionName}`);
$(this).addClass(CSS_ACTIVE_SECTION);
$(this).attr('aria-pressed', 'true');
$section.addClass(CSS_ACTIVE_SECTION);
window.analytics.pageview('instructor_section:' + itemSectionName);
location.hash = '' + HASH_LINK_PREFIX + itemSectionName;
window.analytics.pageview(`instructor_section:${itemSectionName}`);
location.hash = `${HASH_LINK_PREFIX}${itemSectionName}`;
sectionsHaveLoaded.afterFor(function() {
return $section.data('wrapper').onClickTitle();
});
@@ -140,10 +140,10 @@ such that the value can be defined later than this assignment (file load order).
firstLink = $links.eq(0);
return firstLink.click();
};
if ((new RegExp('^' + HASH_LINK_PREFIX)).test(location.hash)) {
rmatch = (new RegExp('^' + HASH_LINK_PREFIX + '(.*)')).exec(location.hash);
if ((new RegExp(`^${HASH_LINK_PREFIX}`)).test(location.hash)) {
rmatch = (new RegExp(`^${HASH_LINK_PREFIX}(.*)`)).exec(location.hash);
sectionName = rmatch[1];
link = $links.filter("[data-section='" + sectionName + "']");
link = $links.filter(`[data-section='${sectionName}']`);
if (link.length === 1) {
return link.click();
} else {
@@ -159,59 +159,59 @@ such that the value can be defined later than this assignment (file load order).
sectionsToInitialize = [
{
constructor: window.InstructorDashboard.sections.CourseInfo,
$element: idashContent.find('.' + CSS_IDASH_SECTION + '#course_info')
$element: idashContent.find(`.${CSS_IDASH_SECTION}#course_info`)
}, {
constructor: window.InstructorDashboard.sections.DataDownload,
$element: idashContent.find('.' + CSS_IDASH_SECTION + '#data_download')
$element: idashContent.find(`.${CSS_IDASH_SECTION}#data_download`)
}, {
constructor: window.InstructorDashboard.sections.DataDownloadV2,
$element: idashContent.find('.' + CSS_IDASH_SECTION + '#data_download_2')
$element: idashContent.find(`.${CSS_IDASH_SECTION}#data_download_2`)
}, {
constructor: window.InstructorDashboard.sections.ECommerce,
$element: idashContent.find('.' + CSS_IDASH_SECTION + '#e-commerce')
$element: idashContent.find(`.${CSS_IDASH_SECTION}#e-commerce`)
}, {
constructor: window.InstructorDashboard.sections.Membership,
$element: idashContent.find('.' + CSS_IDASH_SECTION + '#membership')
$element: idashContent.find(`.${CSS_IDASH_SECTION}#membership`)
}, {
constructor: window.InstructorDashboard.sections.StudentAdmin,
$element: idashContent.find('.' + CSS_IDASH_SECTION + '#student_admin')
$element: idashContent.find(`.${CSS_IDASH_SECTION}#student_admin`)
}, {
constructor: window.InstructorDashboard.sections.Extensions,
$element: idashContent.find('.' + CSS_IDASH_SECTION + '#extensions')
$element: idashContent.find(`.${CSS_IDASH_SECTION}#extensions`)
}, {
constructor: window.InstructorDashboard.sections.Email,
$element: idashContent.find('.' + CSS_IDASH_SECTION + '#send_email')
$element: idashContent.find(`.${CSS_IDASH_SECTION}#send_email`)
}, {
constructor: window.InstructorDashboard.sections.Metrics,
$element: idashContent.find('.' + CSS_IDASH_SECTION + '#metrics')
$element: idashContent.find(`.${CSS_IDASH_SECTION}#metrics`)
}, {
constructor: window.InstructorDashboard.sections.CohortManagement,
$element: idashContent.find('.' + CSS_IDASH_SECTION + '#cohort_management')
$element: idashContent.find(`.${CSS_IDASH_SECTION}#cohort_management`)
}, {
constructor: window.InstructorDashboard.sections.DiscussionsManagement,
$element: idashContent.find('.' + CSS_IDASH_SECTION + '#discussions_management')
$element: idashContent.find(`.${CSS_IDASH_SECTION}#discussions_management`)
}, {
constructor: window.InstructorDashboard.sections.Certificates,
$element: idashContent.find('.' + CSS_IDASH_SECTION + '#certificates')
$element: idashContent.find(`.${CSS_IDASH_SECTION}#certificates`)
}, {
constructor: window.InstructorDashboard.sections.OpenResponseAssessment,
$element: idashContent.find('.' + CSS_IDASH_SECTION + '#open_response_assessment')
$element: idashContent.find(`.${CSS_IDASH_SECTION}#open_response_assessment`)
}
];
if (edx.instructor_dashboard.proctoring !== void 0) {
sectionsToInitialize = sectionsToInitialize.concat([
{
constructor: edx.instructor_dashboard.proctoring.ProctoredExamAllowanceView,
$element: idashContent.find('.' + CSS_IDASH_SECTION + '#special_exams')
$element: idashContent.find(`.${CSS_IDASH_SECTION}#special_exams`)
}, {
constructor: edx.instructor_dashboard.proctoring.ProctoredExamOnboardingView,
$element: idashContent.find('.' + CSS_IDASH_SECTION + '#special_exams')
$element: idashContent.find(`.${CSS_IDASH_SECTION}#special_exams`)
}, {
constructor: edx.instructor_dashboard.proctoring.ProctoredExamAttemptView,
$element: idashContent.find('.' + CSS_IDASH_SECTION + '#special_exams')
$element: idashContent.find(`.${CSS_IDASH_SECTION}#special_exams`)
}, {
constructor: edx.instructor_dashboard.proctoring.ProctoredExamDashboardView,
$element: idashContent.find('.' + CSS_IDASH_SECTION + '#special_exams')
$element: idashContent.find(`.${CSS_IDASH_SECTION}#special_exams`)
}
]);
}

View File

@@ -380,7 +380,7 @@ such that the value can be defined later than this assignment (file load order).
if (studentResult.is_general_error) {
details.push(studentResult.response);
} else {
responseMessage = studentResult.username + ' (' + studentResult.email + '): ' + ' (' + studentResult.response + ')'; // eslint-disable-line max-len, no-useless-concat
responseMessage = `${studentResult.username} (${studentResult.email}): ` + ` (${studentResult.response})`; // eslint-disable-line max-len, no-useless-concat
details.push(responseMessage);
}
}
@@ -721,7 +721,7 @@ such that the value can be defined later than this assignment (file load order).
} else if (dataFromServer.action === 'unenroll') {
return 'There was an error unenrolling:';
} else {
console.warn("unknown action from server '" + dataFromServer.action + "'"); // eslint-disable-line no-console, max-len
console.warn(`unknown action from server '${dataFromServer.action}'`); // eslint-disable-line no-console, max-len
return 'There was an error processing:';
}
}());
@@ -932,7 +932,7 @@ such that the value can be defined later than this assignment (file load order).
},
success: loadAuthList,
error: statusAjaxError(function() {
return ths.$request_response_error.text("Error fetching list for '" + ths.rolename + "'");
return ths.$request_response_error.text(`Error fetching list for '${ths.rolename}'`);
})
});
};

View File

@@ -76,7 +76,7 @@
if (!validation.isValid) {
message = gettext(
'There are invalid keywords in your email. Check the following keywords and try again.');
message += '\n' + validation.invalidKeywords.join('\n');
message += `\n${validation.invalidKeywords.join('\n')}`;
alert(message); // eslint-disable-line no-alert
return false;
}
@@ -100,9 +100,9 @@
'You are sending an email message with the subject {subject} to the following recipients.');
for (i = 0, len = targets.length; i < len; i++) {
target = targets[i];
confirmMessage += '\n-' + displayTarget(target);
confirmMessage += `\n-${displayTarget(target)}`;
}
confirmMessage += '\n\n' + gettext('Is this OK?');
confirmMessage += `\n\n${gettext('Is this OK?')}`;
fullConfirmMessage = confirmMessage.replace('{subject}', subject);
if (confirm(fullConfirmMessage)) { // eslint-disable-line no-alert
sendData = {
@@ -204,7 +204,7 @@
$('input[name="send_to"]:checked+label').each(function() {
return targets.push(this.innerText.replace(/\s*\n.*/g, ''));
});
return $('.send_to_list').text(gettext('Send to:') + ' ' + targets.join(', '));
return $('.send_to_list').text(`${gettext('Send to:')} ${targets.join(', ')}`);
});
}

View File

@@ -257,7 +257,7 @@
$messageContent = $('<section>', {
'aria-hidden': 'true',
class: 'modal email-modal',
id: 'email_message_' + emailId
id: `email_message_${emailId}`
});
$emailWrapper = $('<div>', {
class: 'inner-wrapper email-content-wrapper'
@@ -269,7 +269,7 @@
type: 'button',
name: 'copy-email-body-text',
value: gettext('Copy Email To Editor'),
id: 'copy_email_' + emailId
id: `copy_email_${emailId}`
}));
$closeButton = $('<a>', {
href: '#',
@@ -306,16 +306,16 @@
$emailWrapper.append($emailContent);
$messageContent.append($emailWrapper);
$messagesWrapper.append($messageContent);
$('#email_message_' + emailInfo.email.id + '_trig').leanModal({
$(`#email_message_${emailInfo.email.id}_trig`).leanModal({
closeButton: '.close-modal',
copyEmailButton: '#copy_email_' + emailId
copyEmailButton: `#copy_email_${emailId}`
});
setupCopyEmailButton(emailId, emailInfo.email.html_message, emailInfo.email.subject);
}
};
setupCopyEmailButton = function(emailId, htmlMessage, subject) {
return $('#copy_email_' + emailId).click(function() {
return $(`#copy_email_${emailId}`).click(function() {
var editor;
editor = tinyMCE.get('mce_0');
editor.setContent(htmlMessage);