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

@@ -22,7 +22,7 @@
// if response includes an error message it will take precedence
if (serverResponse && serverResponse.error_msg) {
Annotator.showNotification(serverResponse.error_msg, Annotator.Notification.ERROR);
return console.error(Annotator._t('API request failed:') + (" '" + xhr.status + "'"));
return console.error(`${Annotator._t('API request failed:')} '${xhr.status}'`);
}
// Delegate to original error handler

View File

@@ -53,9 +53,9 @@
dataType: 'json',
headers: {'x-annotator-auth-token': searchRequestsData[0].params.token}
};
searchEndpoint = searchRequestsData[0].params.endpoint + 'search/?';
searchEndpoint = `${searchRequestsData[0].params.endpoint}search/?`;
usageIds = _.map(searchRequestsData, function(item) {
return 'usage_id=' + encodeURIComponent(item.params.usageId);
return `usage_id=${encodeURIComponent(item.params.usageId)}`;
});
// Search endpoint expects the below format for query params

View File

@@ -8,10 +8,10 @@
* @return The loaded template.
*/
var loadTemplate = function(name) {
var templateSelector = '#' + name + '-tpl',
var templateSelector = `#${name}-tpl`,
templateText = $(templateSelector).text();
if (!templateText) {
console.error('Failed to load ' + name + ' template');
console.error(`Failed to load ${name} template`);
}
return _.template(templateText);
};

View File

@@ -15,7 +15,7 @@
* string<br>
*/
var nl2br = function(str) {
return (str + '').replace(/(\r\n|\n\r|\r|\n)/g, '<br>');
return (`${str}`).replace(/(\r\n|\n\r|\r|\n)/g, '<br>');
};
return {

View File

@@ -9,7 +9,7 @@
GroupView = Backbone.View.extend({
tagName: 'section',
id: function() {
return 'note-section-' + _.uniqueId();
return `note-section-${_.uniqueId()}`;
},
initialize: function(options) {
@@ -35,7 +35,7 @@
tagName: 'section',
className: 'note-group',
id: function() {
return 'note-group-' + _.uniqueId();
return `note-group-${_.uniqueId()}`;
},
template: HtmlUtils.template('<h3 class="course-title"><%- chapterName %></h3>'),

View File

@@ -9,7 +9,7 @@
tagName: 'article',
className: 'note',
id: function() {
return 'note-' + _.uniqueId();
return `note-${_.uniqueId()}`;
},
events: {
'click .note-excerpt-more-link': 'moreHandler',

View File

@@ -47,9 +47,9 @@
// Add screen reader label for edit mode. Note that the id of the tags element will not always be "1".
// It depends on the number of annotatable components on the page.
var tagsField = $('li.annotator-item >input', this.annotator.editor.element).attr('id');
if ($("label.sr[for='" + tagsField + "']", this.annotator.editor.element).length === 0) {
if ($(`label.sr[for='${tagsField}']`, this.annotator.editor.element).length === 0) {
HtmlUtils.prepend(
$('#' + tagsField, this.annotator.editor.element),
$(`#${tagsField}`, this.annotator.editor.element),
$(HtmlUtils.joinHtml(
HtmlUtils.HTML('<label class="sr" for='),
tagsField,
@@ -105,7 +105,7 @@
this.unfreezeAll();
} else {
// Unfreeze only this instance and unbound associated 'click.edxnotes:freeze' handler
$(document).off('click.edxnotes:freeze' + this.uid);
$(document).off(`click.edxnotes:freeze${this.uid}`);
this.isFrozen = false;
}
@@ -215,9 +215,9 @@
// Add screen reader label for the note area. Note that the id of the tags element will not always be "0".
// It depends on the number of annotatable components on the page.
var noteField = $('li.annotator-item >textarea', this.element).attr('id');
if ($("label.sr[for='" + noteField + "']", this.element).length === 0) {
if ($(`label.sr[for='${noteField}']`, this.element).length === 0) {
HtmlUtils.prepend(
$('#' + noteField, this.element),
$(`#${noteField}`, this.element),
$(HtmlUtils.joinHtml(
HtmlUtils.HTML('<label class="sr" for='),
noteField,
@@ -303,7 +303,7 @@
this.removeEvents();
this.viewer.element.unbind('mouseover mouseout');
this.uid = _.uniqueId();
$(document).on('click.edxnotes:freeze' + this.uid, _.bind(this.unfreeze, this));
$(document).on(`click.edxnotes:freeze${this.uid}`, _.bind(this.unfreeze, this));
this.isFrozen = true;
}
return this;
@@ -318,7 +318,7 @@
mouseout: this.startViewerHideTimer
});
this.viewer.hide();
$(document).off('click.edxnotes:freeze' + this.uid);
$(document).off(`click.edxnotes:freeze${this.uid}`);
this.isFrozen = false;
Annotator.frozenSrc = null;
}