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

@@ -427,7 +427,7 @@
if (_.isFunction(conversions[option])) {
value = conversions[option].call(this, value);
} else {
throw new TypeError(option + ' is not a function.');
throw new TypeError(`${option} is not a function.`);
}
}
config[option] = value;
@@ -582,7 +582,7 @@
$(scriptTag).on('error', function() {
console.log(
'[Video info]: YouTube returned an error for '
+ 'video with id "' + self.id + '".'
+ `video with id "${self.id}".`
);
// If the video is already loaded in `_waitForYoutubeApi` by the
// time we get here, then we shouldn't load it again.

View File

@@ -60,7 +60,7 @@
data.levels.map(function(level) {
return {
bitrate: level.bitrate,
resolution: level.width + 'x' + level.height
resolution: `${level.width}x${level.height}`
};
})
);
@@ -72,7 +72,7 @@
'[HLS Video]: LEVEL_SWITCHED, qualityLevelInfo: ',
{
bitrate: level.bitrate,
resolution: level.width + 'x' + level.height
resolution: `${level.width}x${level.height}`
}
);
});

View File

@@ -342,7 +342,7 @@
);
}
el.trigger('html5:' + eventName, arguments);
el.trigger(`html5:${eventName}`, arguments);
});
});

View File

@@ -155,7 +155,7 @@
var endTime = (this.config.endTime !== null) ? this.config.endTime : params.duration;
// in case endTime is accidentally specified as being greater than the video
endTime = Math.min(endTime, params.duration);
this.videoControl.vidTimeEl.text(Time.format(params.time) + ' / ' + Time.format(endTime));
this.videoControl.vidTimeEl.text(`${Time.format(params.time)} / ${Time.format(endTime)}`);
}
}
);

View File

@@ -1,7 +1,7 @@
(function(requirejs, require, define) {
// VideoQualityControl module.
'use strict';
'use strict';
define(
'video/05_video_quality_control.js',

View File

@@ -190,8 +190,8 @@ mind, or whether to act, and in acting, to live."
width = endTime * step - left;
return {
left: left + '%',
width: width + '%'
left: `${left}%`,
width: `${width}%`
};
}
@@ -332,16 +332,16 @@ mind, or whether to act, and in acting, to live."
return interpolate(msg, {value: value}, true);
};
seconds = seconds % 60;
minutes = minutes % 60;
seconds %= 60;
minutes %= 60;
if (hours) {
return i18n(hours, 'hour') + ' '
+ i18n(minutes, 'minute') + ' '
+ i18n(seconds, 'second');
return `${i18n(hours, 'hour')} ${
i18n(minutes, 'minute')} ${
i18n(seconds, 'second')}`;
} else if (minutes) {
return i18n(minutes, 'minute') + ' '
+ i18n(seconds, 'second');
return `${i18n(minutes, 'minute')} ${
i18n(seconds, 'second')}`;
}
return i18n(seconds, 'second');

View File

@@ -133,7 +133,7 @@
*/
render: function() {
var container = this.el.find('.volume-slider'),
instructionsId = 'volume-instructions-' + this.state.id;
instructionsId = `volume-instructions-${this.state.id}`;
HtmlUtils.append(container, HtmlUtils.HTML('<div class="ui-slider-handle volume-handle"></div>'));
@@ -473,7 +473,7 @@
update: function(volume) {
this.liveRegion.text([
this.getVolumeDescription(volume),
this.i18n.Volume + '.'
`${this.i18n.Volume}.`
].join(' '));
$(this.button).parent().find('.volume-slider')

View File

@@ -99,7 +99,7 @@
render: function(speeds, currentSpeed) {
var speedsContainer = this.speedsContainer,
reversedSpeeds = speeds.concat().reverse(),
instructionsId = 'speed-instructions-' + this.state.id,
instructionsId = `speed-instructions-${this.state.id}`,
speedsList = $.map(reversedSpeeds, function(speed) {
return HtmlUtils.interpolateHtml(
HtmlUtils.HTML(
@@ -236,9 +236,9 @@
if (newSpeed !== this.currentSpeed || forceUpdate) {
this.speedsContainer
.find('li')
.siblings("li[data-speed='" + newSpeed + "']");
.siblings(`li[data-speed='${newSpeed}']`);
this.speedButton.find('.value').text(newSpeed + 'x');
this.speedButton.find('.value').text(`${newSpeed}x`);
this.currentSpeed = newSpeed;
if (!silent) {
@@ -261,13 +261,13 @@
},
setActiveSpeed: function(speed) {
var speedOption = this.speedsContainer.find('li[data-speed="' + this.state.speedToString(speed) + '"]');
var speedOption = this.speedsContainer.find(`li[data-speed="${this.state.speedToString(speed)}"]`);
speedOption.addClass('is-active')
.find('.speed-option')
.attr('aria-pressed', 'true');
this.speedButton.attr('title', gettext('Video speed: ') + this.state.speedToString(speed) + 'x');
this.speedButton.attr('title', `${gettext('Video speed: ') + this.state.speedToString(speed)}x`);
},
/**

View File

@@ -119,11 +119,11 @@
keyDownHandler: function() { },
delegateEvents: function() { },
undelegateEvents: function() {
this.getElement().off('.' + this.id);
this.getElement().off(`.${this.id}`);
},
addNamespace: function(events) {
return _.map(events.split(/\s+/), function(event) {
return event + '.' + this.id;
return `${event}.${this.id}`;
}, this).join(' ');
}
});
@@ -190,7 +190,7 @@
createElement: function() {
return $('<ol />', {
class: ['contextmenu', this.options.prefix + 'contextmenu'].join(' '),
class: ['contextmenu', `${this.options.prefix}contextmenu`].join(' '),
role: 'menu',
tabindex: -1
});
@@ -366,13 +366,13 @@
delegateEvents: function() {
var self = this;
$(document)
.on('click' + this.ns, function() {
.on(`click${this.ns}`, function() {
if (_.isFunction(self.clickHandler)) {
self.clickHandler.apply(this, arguments);
}
self.hide();
})
.on('contextmenu' + this.ns, function() {
.on(`contextmenu${this.ns}`, function() {
if (_.isFunction(self.contextmenuHandler)) {
self.contextmenuHandler.apply(this, arguments);
}
@@ -396,22 +396,22 @@
var $spanElem,
$listElem,
$element = $('<li />', {
class: ['submenu-item', 'menu-item', this.options.prefix + 'submenu-item'].join(' '),
class: ['submenu-item', 'menu-item', `${this.options.prefix}submenu-item`].join(' '),
'aria-expanded': 'false',
'aria-haspopup': 'true',
'aria-labelledby': 'submenu-item-label-' + this.id,
'aria-labelledby': `submenu-item-label-${this.id}`,
role: 'menuitem',
tabindex: -1
});
$spanElem = $('<span />', {
id: 'submenu-item-label-' + this.id,
id: `submenu-item-label-${this.id}`,
text: this.options.label
});
this.label = $spanElem.appendTo($element);
$listElem = $('<ol />', {
class: ['submenu', this.options.prefix + 'submenu'].join(' '),
class: ['submenu', `${this.options.prefix}submenu`].join(' '),
role: 'menu'
});
@@ -499,7 +499,7 @@
MenuItem = AbstractItem.extend({
createElement: function() {
var classNames = [
'menu-item', this.options.prefix + 'menu-item',
'menu-item', `${this.options.prefix}menu-item`,
this.options.isSelected ? 'is-selected' : ''
].join(' ');
@@ -639,7 +639,7 @@
items: _.map(state.speeds, function(speed) {
var isSelected = parseFloat(speed) === state.speed;
return {
label: speed + 'x', callback: speedCallback, speed: speed, isSelected: isSelected
label: `${speed}x`, callback: speedCallback, speed: speed, isSelected: isSelected
};
}),
initialize: function(menuitem) {

View File

@@ -172,7 +172,7 @@
self.complete = false;
errmsg = 'Failed to submit completion';
if (xhr.responseJSON !== undefined) {
errmsg += ': ' + xhr.responseJSON.error;
errmsg += `: ${xhr.responseJSON.error}`;
}
console.warn(errmsg);
/* eslint-enable no-console */

View File

@@ -67,7 +67,7 @@
onSkip: function(event, doNotShowAgain) {
var info = {currentTime: this.getCurrentTime()},
eventName = 'edx.video.bumper.' + (doNotShowAgain ? 'dismissed' : 'skipped');
eventName = `edx.video.bumper.${doNotShowAgain ? 'dismissed' : 'skipped'}`;
this.log(eventName, info);
},

View File

@@ -1,7 +1,7 @@
(function(define) {
// VideoCaption module.
'use strict';
'use strict';
define('video/09_video_caption.js', [
'video/00_sjson.js',
@@ -299,7 +299,7 @@
.focus();
} else {
this.languageChooserEl
.find('li:eq(' + index + ')')
.find(`li:eq(${index})`)
.next()
.find('.control-lang')
.focus();
@@ -321,7 +321,7 @@
.focus();
} else {
this.languageChooserEl
.find('li:eq(' + index + ')')
.find(`li:eq(${index})`)
.prev()
.find('.control-lang')
.focus();
@@ -582,8 +582,8 @@
var canFetchWithYoutubeId;
console.log('[Video info]: ERROR while fetching captions.');
console.log(
'[Video info]: STATUS:', textStatus
+ ', MESSAGE:', '' + errorThrown
'[Video info]: STATUS:', `${textStatus
}, MESSAGE:`, `${errorThrown}`
);
// If initial list of languages has more than 1 item, check
// for availability other transcripts.
@@ -1070,12 +1070,12 @@
}
this.subtitlesEl
.find("span[data-index='" + newIndex + "']")
.find(`span[data-index='${newIndex}']`)
.parent()
.addClass('current');
this.currentIndex = newIndex;
this.captionDisplayEl.text(this.subtitlesEl.find("span[data-index='" + newIndex + "']").text());
this.captionDisplayEl.text(this.subtitlesEl.find(`span[data-index='${newIndex}']`).text());
this.scrollCaption();
}
}

View File

@@ -45,7 +45,7 @@
if (_.has(this.commands, command)) {
this.commands[command].execute.apply(this, [this.state].concat(args));
} else {
console.log('Command "' + command + '" is not available.');
console.log(`Command "${command}" is not available.`);
}
},