fix: eslint autofixable issues (#32181)

* 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 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

* fix: all autofixable eslint issues

* fix: all react related fixable issues

* fix: autofixable eslint issues

* chore: remove all template literals

* fix: remaining autofixable issues

* fix: failing js test
This commit is contained in:
Syed Ali Abbas Zaidi
2023-05-18 11:03:59 +05:00
committed by GitHub
parent f2daf37d4a
commit d7053a6783
140 changed files with 849 additions and 833 deletions

View File

@@ -32,9 +32,9 @@ import '../../common/static/common/js/vendor/sinon.js';
import 'jquery.ui';
// These
import './src/video/10_main.js'
import './spec/helper.js'
import './spec/video_helper.js'
import './src/video/10_main.js';
import './spec/helper.js';
import './spec/video_helper.js';
// These are the tests that will be run
import './spec/video/async_process_spec.js';
@@ -74,8 +74,8 @@ import './spec/video/social_share_spec.js';
// Somehow the code initialized in jQuery's onready doesn't get called before karma auto starts
'use strict';
window.__karma__.loaded = function () {
setTimeout(function () {
window.__karma__.loaded = function() {
setTimeout(function() {
window.__karma__.start();
}, 1000);
};

View File

@@ -6,6 +6,7 @@
'use strict';
var path = require('path');
var configModule = require(path.join(__dirname, 'common_static/common/js/karma.common.conf.js'));
var options = {

View File

@@ -6,6 +6,7 @@
'use strict';
var path = require('path');
var configModule = require(path.join(__dirname, 'common_static/common/js/karma.common.conf.js'));
var options = {

View File

@@ -1,38 +1,39 @@
(function() {
'use strict';
describe('VideoSocialSharingHandler', function() {
var state;
beforeEach(function() {
state = jasmine.initializePlayer('video_all.html');
window.analytics = jasmine.createSpyObj('analytics', ['track'])
window.analytics = jasmine.createSpyObj('analytics', ['track']);
});
afterAll(() => delete window.analytics);
describe('clicking social share fires an analytics event', function() {
const testCases = [
{ source: 'twitter' },
{ source: 'facebook' },
{ source: 'linkedin' },
{source: 'twitter'},
{source: 'facebook'},
{source: 'linkedin'},
];
_.each(testCases, ({ source }) => {
_.each(testCases, ({source}) => {
it(source, () => {
var siteShareButton = $(`.social-share-link[data-source="${source}"]`);
expect(siteShareButton.length).toEqual(1);
siteShareButton.trigger('click');
expect(window.analytics.track).toHaveBeenCalledWith(
'edx.social.video.share_button.clicked',
{
source: source,
video_block_id: 'block-v1:coursekey+type@video+block@000000000000000000',
course_id: 'course-v1:someOrg+thisCOurse+runAway',
}
{
source: source,
video_block_id: 'block-v1:coursekey+type@video+block@000000000000000000',
course_id: 'course-v1:someOrg+thisCOurse+runAway',
}
);
});
});
});
});
}).call(this);
}).call(this);

View File

@@ -1,4 +1,4 @@
import '../helper.js'
import '../helper.js';
(function(undefined) {
'use strict';

View File

@@ -183,7 +183,7 @@ import * as Time from 'time.js';
state.videoSaveStatePlugin.onUnload();
expect($.ajax).not.toHaveBeenCalledWith({
url: state.config.saveStateUrl
})
});
state.config.saveStateEnabled = true;
$.ajax.calls.reset();
state.videoSaveStatePlugin.onUnload();
@@ -200,7 +200,7 @@ import * as Time from 'time.js';
state.el.trigger('pause');
expect($.ajax).not.toHaveBeenCalledWith({
url: state.config.saveStateUrl
})
});
state.config.saveStateEnabled = true;
state.el.trigger('pause');
expect($.ajax).toHaveBeenCalledWith({
@@ -233,7 +233,7 @@ import * as Time from 'time.js';
state.config.saveStateEnabled = false;
state.config.recordedYoutubeIsAvailable = false;
state.el.trigger('youtube_availability', [true]);
expect($.ajax).not.toHaveBeenCalled()
expect($.ajax).not.toHaveBeenCalled();
state.config.saveStateEnabled = true;
state.config.recordedYoutubeIsAvailable = false;
state.el.trigger('youtube_availability', [true]);

View File

@@ -907,8 +907,8 @@
this.el.find('.choicegroup').each(function(i, choicegroupBlock) {
var checked;
checked = false;
$(choicegroupBlock).find('input[type=checkbox], input[type=radio]').
each(function(j, checkboxOrRadio) {
$(choicegroupBlock).find('input[type=checkbox], input[type=radio]')
.each(function(j, checkboxOrRadio) {
if ($(checkboxOrRadio).is(':checked')) {
checked = true;
}

View File

@@ -315,8 +315,6 @@
'ERROR: Invalid JSON config for poll ID "' + this.id + '".',
'Error messsage: "' + err.message + '".'
);
return;
}
} // End-of: function PollMain(el) {
}); // End-of: define('PollMain', [], function () {

View File

@@ -8,8 +8,8 @@ function format(time, formatFull) {
seconds = Math.floor(time);
minutes = Math.floor(seconds / 60);
hours = Math.floor(minutes / 60);
seconds = seconds % 60;
minutes = minutes % 60;
seconds %= 60;
minutes %= 60;
if (formatFull) {
return '' + _pad(hours) + ':' + _pad(minutes) + ':' + _pad(seconds % 60);
@@ -38,4 +38,4 @@ function _pad(number) {
}
}
export {format, formatFull, convert}
export {format, formatFull, convert};

View File

@@ -1,5 +1,6 @@
(function(define) {
'use strict';
// VideoSocialSharingHandler module.
define(
'video/036_video_social_sharing.js', ['underscore'],
@@ -37,13 +38,13 @@
this.el.on('click', '.btn-link', this.clickHandler);
this.baseVideoUrl = this.el.data('url');
this.course_id = this.container.data('courseId');
this.block_id = this.container.data('blockId')
this.block_id = this.container.data('blockId');
},
// Fire an analytics event on share button click.
clickHandler: function(event) {
var self = this;
var source = $(event.currentTarget).data('source')
var source = $(event.currentTarget).data('source');
self.sendAnalyticsEvent(source);
},

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

@@ -332,8 +332,8 @@ 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') + ' '

View File

@@ -1,7 +1,7 @@
(function(define) {
// VideoCaption module.
'use strict';
'use strict';
define('video/09_video_caption.js', [
'video/00_sjson.js',