From 148ca9bcfd5240cac9da3d6fe6eee5c0dca2eede Mon Sep 17 00:00:00 2001 From: Syed Ali Abbas Zaidi Date: Tue, 7 Mar 2023 12:42:50 +0500 Subject: [PATCH 01/30] fix: eslint operator-linebreak issue --- lms/static/js/dashboard/legacy.js | 16 ++++++++-------- xmodule/js/src/capa/display.js | 1 - 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/lms/static/js/dashboard/legacy.js b/lms/static/js/dashboard/legacy.js index bd36849b25b7..33b27d194877 100644 --- a/lms/static/js/dashboard/legacy.js +++ b/lms/static/js/dashboard/legacy.js @@ -239,12 +239,12 @@ var edx = edx || {}; // xss-lint: disable=javascript-jquery-append $('#activate-account-modal p').append( // xss-lint: disable=javascript-concat-html - '\n' + + + 'viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n' // xss-lint: disable=javascript-concat-html - '\n' + - '' + + '\n' + + '' ); }, 500); // adding timeout to make spinner animation longer } @@ -254,12 +254,12 @@ var edx = edx || {}; // xss-lint: disable=javascript-jquery-append $('#activate-account-modal p').append( // xss-lint: disable=javascript-concat-html - '\n' + + + 'viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n' // xss-lint: disable=javascript-concat-html - '\n' + - '' + + '\n' + + '' ); }); diff --git a/xmodule/js/src/capa/display.js b/xmodule/js/src/capa/display.js index 8afe368d4239..c2578b4f9f4e 100644 --- a/xmodule/js/src/capa/display.js +++ b/xmodule/js/src/capa/display.js @@ -7,7 +7,6 @@ (function() { 'use strict'; - var indexOfHelper = [].indexOf || function(item) { var i, len; From 3cecf212245c40d17d0fe7e7c7f219c66883a7cf Mon Sep 17 00:00:00 2001 From: Syed Ali Abbas Zaidi Date: Tue, 7 Mar 2023 14:21:54 +0500 Subject: [PATCH 02/30] fix: eslint quotes issue --- lms/static/js/dashboard/legacy.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lms/static/js/dashboard/legacy.js b/lms/static/js/dashboard/legacy.js index 33b27d194877..bd36849b25b7 100644 --- a/lms/static/js/dashboard/legacy.js +++ b/lms/static/js/dashboard/legacy.js @@ -239,12 +239,12 @@ var edx = edx || {}; // xss-lint: disable=javascript-jquery-append $('#activate-account-modal p').append( // xss-lint: disable=javascript-concat-html - '\n' + 'viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n' + // xss-lint: disable=javascript-concat-html - + '\n' - + '' + '\n' + + '' ); }, 500); // adding timeout to make spinner animation longer } @@ -254,12 +254,12 @@ var edx = edx || {}; // xss-lint: disable=javascript-jquery-append $('#activate-account-modal p').append( // xss-lint: disable=javascript-concat-html - '\n' + 'viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n' + // xss-lint: disable=javascript-concat-html - + '\n' - + '' + '\n' + + '' ); }); From b2fb0e182f2e2fb31b736aafa3b0e8b5358742d3 Mon Sep 17 00:00:00 2001 From: Syed Ali Abbas Zaidi Date: Tue, 7 Mar 2023 22:07:13 +0500 Subject: [PATCH 03/30] fix: react jsx indent and props issues --- .../support/static/support/jsx/program_enrollments/inspector.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/lms/djangoapps/support/static/support/jsx/program_enrollments/inspector.jsx b/lms/djangoapps/support/static/support/jsx/program_enrollments/inspector.jsx index 3f8f6fda57c4..3947f5f8e7f1 100644 --- a/lms/djangoapps/support/static/support/jsx/program_enrollments/inspector.jsx +++ b/lms/djangoapps/support/static/support/jsx/program_enrollments/inspector.jsx @@ -66,6 +66,7 @@ const renderEnrollmentsSection = enrollments => (

{enrollment.program_name} + Program ( {enrollment.program_uuid} ) From cf53f8826209db021f3dd53c4a9a39016f9b242d Mon Sep 17 00:00:00 2001 From: Syed Ali Abbas Zaidi Date: Tue, 7 Mar 2023 22:16:12 +0500 Subject: [PATCH 04/30] fix: eslint trailing spaces issues --- .../support/static/support/jsx/program_enrollments/inspector.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/lms/djangoapps/support/static/support/jsx/program_enrollments/inspector.jsx b/lms/djangoapps/support/static/support/jsx/program_enrollments/inspector.jsx index 3947f5f8e7f1..3f8f6fda57c4 100644 --- a/lms/djangoapps/support/static/support/jsx/program_enrollments/inspector.jsx +++ b/lms/djangoapps/support/static/support/jsx/program_enrollments/inspector.jsx @@ -66,7 +66,6 @@ const renderEnrollmentsSection = enrollments => (

{enrollment.program_name} - Program ( {enrollment.program_uuid} ) From 02cf040c281793424c7d34388a9b5b35946728be Mon Sep 17 00:00:00 2001 From: Syed Ali Abbas Zaidi Date: Tue, 7 Mar 2023 23:35:36 +0500 Subject: [PATCH 05/30] fix: eslint line around directives issue --- xmodule/js/src/capa/display.js | 1 + 1 file changed, 1 insertion(+) diff --git a/xmodule/js/src/capa/display.js b/xmodule/js/src/capa/display.js index c2578b4f9f4e..8afe368d4239 100644 --- a/xmodule/js/src/capa/display.js +++ b/xmodule/js/src/capa/display.js @@ -7,6 +7,7 @@ (function() { 'use strict'; + var indexOfHelper = [].indexOf || function(item) { var i, len; From aa3431a27891baf09e37a1b3dc8526444b0a49ba Mon Sep 17 00:00:00 2001 From: Syed Ali Abbas Zaidi Date: Thu, 9 Mar 2023 14:40:41 +0500 Subject: [PATCH 06/30] fix: eslint semi rule --- .eslintrc.json | 1 - cms/static/js/factories/container.js | 2 +- cms/static/js/factories/context_course.js | 2 +- cms/static/js/factories/edit_tabs.js | 2 +- cms/static/js/factories/library.js | 2 +- cms/static/js/factories/settings.js | 6 ++--- cms/static/js/factories/textbooks.js | 2 +- cms/static/js/factories/xblock_validation.js | 2 +- cms/static/js/sock.js | 2 +- .../spec/views/pages/course_outline_spec.js | 8 +++--- cms/static/js/spec_helpers/edit_helpers.js | 2 +- .../js/views/modals/course_outline_modals.js | 26 +++++++++---------- cms/static/js/views/paged_container.js | 2 +- cms/static/js/views/pages/container.js | 2 +- cms/static/js/views/settings/main.js | 2 +- .../js/components/ExperimentalCarousel.jsx | 2 +- common/static/common/js/discussion/utils.js | 2 +- common/static/js/src/accessibility_tools.js | 2 +- lms/static/js/dashboard/legacy.js | 2 +- .../DemographicsCollectionBanner.jsx | 4 +-- .../DemographicsCollectionModal.jsx | 20 +++++++------- .../MultiselectDropdown.jsx | 16 ++++++------ .../SelectWithInput.jsx | 4 +-- .../js/demographics_collection/Wizard.jsx | 10 +++---- .../CircleChartLegend.jsx | 2 +- .../Discussions.jsx | 2 +- .../learner_analytics_dashboard/DueDates.jsx | 4 +-- .../GradeTable.jsx | 4 +-- .../LearnerAnalyticsDashboard.jsx | 8 +++--- .../js/spec/student_account/register_spec.js | 8 +++--- .../js/student_account/views/AccessView.js | 2 +- .../js/student_account/views/FormView.js | 2 +- .../announcements/jsx/Announcements.jsx | 6 ++--- .../announcements/jsx/Announcements.test.jsx | 6 ++--- .../LibrarySourcedBlockPicker.jsx | 4 +-- xmodule/js/karma_runner_webpack.js | 6 ++--- .../js/spec/video/video_events_plugin_spec.js | 2 +- .../video/video_save_state_plugin_spec.js | 6 ++--- xmodule/js/src/time.js | 2 +- 39 files changed, 94 insertions(+), 95 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 9cc8eb1a5703..8244e400deec 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -73,7 +73,6 @@ "radix": "off", "react/jsx-indent-props": ["error", 4], "react/prop-types": "off", - "semi": "off", "vars-on-top": "off" } } diff --git a/cms/static/js/factories/container.js b/cms/static/js/factories/container.js index cfca29885183..892eb6196091 100644 --- a/cms/static/js/factories/container.js +++ b/cms/static/js/factories/container.js @@ -23,4 +23,4 @@ export default function ContainerFactory(componentTemplates, XBlockInfoJson, act }); }; -export {ContainerFactory} +export {ContainerFactory}; diff --git a/cms/static/js/factories/context_course.js b/cms/static/js/factories/context_course.js index 475e5a6282c6..24745295ec04 100644 --- a/cms/static/js/factories/context_course.js +++ b/cms/static/js/factories/context_course.js @@ -1,3 +1,3 @@ import * as ContextCourse from 'js/models/course'; -export {ContextCourse} +export {ContextCourse}; diff --git a/cms/static/js/factories/edit_tabs.js b/cms/static/js/factories/edit_tabs.js index 51688bf6a197..5ec459e52083 100644 --- a/cms/static/js/factories/edit_tabs.js +++ b/cms/static/js/factories/edit_tabs.js @@ -23,4 +23,4 @@ export default function EditTabsFactory(courseLocation, explicitUrl) { }); }; -export {EditTabsFactory} +export {EditTabsFactory}; diff --git a/cms/static/js/factories/library.js b/cms/static/js/factories/library.js index 7f8d45850233..0e72bdb4b44d 100644 --- a/cms/static/js/factories/library.js +++ b/cms/static/js/factories/library.js @@ -26,4 +26,4 @@ export default function LibraryFactory(componentTemplates, XBlockInfoJson, optio }); }; -export {LibraryFactory} +export {LibraryFactory}; diff --git a/cms/static/js/factories/settings.js b/cms/static/js/factories/settings.js index b17073139704..34faec2eb11e 100644 --- a/cms/static/js/factories/settings.js +++ b/cms/static/js/factories/settings.js @@ -16,9 +16,9 @@ define([ // Toggle collapsibles when trigger is clicked $('.collapsible .collapsible-trigger').click(function() { - const contentId = this.id.replace('-trigger', '-content') - $(`#${contentId}`).toggleClass('collapsed') - }) + const contentId = this.id.replace('-trigger', '-content'); + $(`#${contentId}`).toggleClass('collapsed'); + }); model = new CourseDetailsModel(); model.urlRoot = detailsUrl; diff --git a/cms/static/js/factories/textbooks.js b/cms/static/js/factories/textbooks.js index 01950f867f22..a257b368863a 100644 --- a/cms/static/js/factories/textbooks.js +++ b/cms/static/js/factories/textbooks.js @@ -21,4 +21,4 @@ export default function TextbooksFactory(textbooksJson) { }); }; -export {TextbooksFactory} +export {TextbooksFactory}; diff --git a/cms/static/js/factories/xblock_validation.js b/cms/static/js/factories/xblock_validation.js index 0411dc9150ab..03bee7547cba 100644 --- a/cms/static/js/factories/xblock_validation.js +++ b/cms/static/js/factories/xblock_validation.js @@ -18,4 +18,4 @@ export default function XBlockValidationFactory(validationMessages, hasEditingUr } }; -export {XBlockValidationFactory} +export {XBlockValidationFactory}; diff --git a/cms/static/js/sock.js b/cms/static/js/sock.js index 43c41ba2547b..3261eaf1de01 100644 --- a/cms/static/js/sock.js +++ b/cms/static/js/sock.js @@ -38,4 +38,4 @@ domReady(function () { $('.cta-show-sock').bind('click', toggleSock); }); -export {toggleSock} +export {toggleSock}; diff --git a/cms/static/js/spec/views/pages/course_outline_spec.js b/cms/static/js/spec/views/pages/course_outline_spec.js index 6f49ade213cb..be5b4ceb43e4 100644 --- a/cms/static/js/spec/views/pages/course_outline_spec.js +++ b/cms/static/js/spec/views/pages/course_outline_spec.js @@ -210,7 +210,7 @@ describe('CourseOutlinePage', function() { setSelfPacedCustomPLS = function() { setSelfPaced(); course.set('is_custom_relative_dates_active', true); - } + }; createCourseOutlinePage = function(test, courseJSON, createOnly) { requests = AjaxHelpers.requests(test); @@ -2210,7 +2210,7 @@ describe('CourseOutlinePage', function() { selectRelativeWeeksSubsection = function(weeks) { $('#due_in').val(weeks).trigger('keyup'); - } + }; mockCustomPacingServerValuesJson = createMockSectionJSON({ release_date: 'Jan 01, 2970 at 05:00 UTC' @@ -2304,7 +2304,7 @@ describe('CourseOutlinePage', function() { $('#grading_type').val('notgraded').trigger('change'); $('#due_in').val('').trigger('change'); expect($('#relative_date_input').css('display')).toBe('none'); - }) + }); it('shows validation error on relative date', function() { outlinePage.$('.outline-subsection .configure-button').click(); @@ -2371,7 +2371,7 @@ describe('CourseOutlinePage', function() { 'Contains staff only content' ); }); - }) + }); }); // Note: most tests for units can be found in Bok Choy diff --git a/cms/static/js/spec_helpers/edit_helpers.js b/cms/static/js/spec_helpers/edit_helpers.js index 217a067e878f..0fa81b1e5a0b 100644 --- a/cms/static/js/spec_helpers/edit_helpers.js +++ b/cms/static/js/spec_helpers/edit_helpers.js @@ -138,4 +138,4 @@ export { installEditTemplates, showEditModal, verifyXBlockRequest, -} +}; diff --git a/cms/static/js/views/modals/course_outline_modals.js b/cms/static/js/views/modals/course_outline_modals.js index aefb13d286ec..07b2f0042f6a 100644 --- a/cms/static/js/views/modals/course_outline_modals.js +++ b/cms/static/js/views/modals/course_outline_modals.js @@ -408,11 +408,11 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview', if (!this.getValue() || !course.get('start')) { return; } var startDate = new Date(course.get('start')); // The value returned by toUTCString() is a string in the form Www, dd Mmm yyyy hh:mm:ss GMT - var startDateList = startDate.toUTCString().split(' ') + var startDateList = startDate.toUTCString().split(' '); // This text will look like Mmm dd, yyyy (i.e. Jul 26, 2021) this.$('#relative_weeks_due_start_date').text(startDateList[2] + ' ' + startDateList[1] + ', ' + startDateList[3]); - var projectedDate = new Date(startDate) - projectedDate.setDate(projectedDate.getDate() + this.getValue()*7); + var projectedDate = new Date(startDate); + projectedDate.setDate(projectedDate.getDate() + this.getValue() * 7); var projectedDateList = projectedDate.toUTCString().split(' '); this.$('#relative_weeks_due_projected_due_in').text(projectedDateList[2] + ' ' + projectedDateList[1] + ', ' + projectedDateList[3]); this.$('#relative_weeks_due_projected').show(); @@ -433,9 +433,9 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview', afterRender: function() { AbstractEditor.prototype.afterRender.call(this); if (this.model.get('graded')) { - this.$('#relative_date_input').show() + this.$('#relative_date_input').show(); } else { - this.$('#relative_date_input').hide() + this.$('#relative_date_input').hide(); } this.$('.field-due-in input').val(this.model.get('relative_weeks_due')); this.$('#relative_weeks_due_projected').hide(); @@ -444,12 +444,12 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview', getRequestData: function() { // Grab all the sections, map them to their block_ids, then return as an Array - var sectionIds = $('.outline-section').map(function(){ return this.id; }).get() + var sectionIds = $('.outline-section').map(function(){ return this.id; }).get(); // Grab all the subsections, map them to their block_ids, then return as an Array - var subsectionIds = $('.outline-subsection').map(function(){ return this.id; }).get() + var subsectionIds = $('.outline-subsection').map(function(){ return this.id; }).get(); var relative_weeks_due = null; if (this.getValue() > 0 && $('#grading_type').val() !== 'notgraded') { - relative_weeks_due = this.getValue() + relative_weeks_due = this.getValue(); } window.analytics.track('edx.bi.studio.relative_date.saved', { block_id: this.model.get('id'), @@ -944,16 +944,16 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview', showTipText: function() { if (this.model.get('published')) { - $('.un-published-tip').hide() + $('.un-published-tip').hide(); } else { - $('.un-published-tip').show() + $('.un-published-tip').show(); } - let enabledForGraded = course.get('discussions_settings').enable_graded_units + let enabledForGraded = course.get('discussions_settings').enable_graded_units; if (this.model.get('graded') && !enabledForGraded) { $('#discussion_enabled').prop('disabled', true); - $('.graded-tip').show() + $('.graded-tip').show(); } else { - $('.graded-tip').hide() + $('.graded-tip').hide(); } }, diff --git a/cms/static/js/views/paged_container.js b/cms/static/js/views/paged_container.js index 31c123ad12a4..87f8605c4b29 100644 --- a/cms/static/js/views/paged_container.js +++ b/cms/static/js/views/paged_container.js @@ -109,7 +109,7 @@ function($, _, ViewUtils, ContainerView, ModuleUtils, gettext, NotificationView, if (originalDone) { originalDone(); } - } + }; self.handleXBlockFragment(fragment, options); } }); diff --git a/cms/static/js/views/pages/container.js b/cms/static/js/views/pages/container.js index 1793f28e75c1..c7464972efc1 100644 --- a/cms/static/js/views/pages/container.js +++ b/cms/static/js/views/pages/container.js @@ -266,7 +266,7 @@ function($, _, Backbone, gettext, BasePage, ViewUtils, ContainerView, XBlockView event.preventDefault(); if(!options || options.view !== 'visibility_view' ){ - const primaryHeader = $(event.target).closest('.xblock-header-primary') + const primaryHeader = $(event.target).closest('.xblock-header-primary'); var useNewTextEditor = primaryHeader.attr('use-new-editor-text'), useNewVideoEditor = primaryHeader.attr('use-new-editor-video'), diff --git a/cms/static/js/views/settings/main.js b/cms/static/js/views/settings/main.js index 4f5b358cdc6d..3876ae6f7327 100644 --- a/cms/static/js/views/settings/main.js +++ b/cms/static/js/views/settings/main.js @@ -402,7 +402,7 @@ function(ValidatingView, CodeMirror, _, $, ui, DateUtils, FileUploadModel, datepicker.prop('disabled', true); datepicker.val(null); this.clearValidationErrors(); - this.setAndValidate('certificate_available_date', null) + this.setAndValidate('certificate_available_date', null); certificateAvailableDateField.addClass('hidden'); } }, diff --git a/common/static/common/js/components/ExperimentalCarousel.jsx b/common/static/common/js/components/ExperimentalCarousel.jsx index 1f954d320689..c976aac702d0 100644 --- a/common/static/common/js/components/ExperimentalCarousel.jsx +++ b/common/static/common/js/components/ExperimentalCarousel.jsx @@ -87,7 +87,7 @@ export default class ExperimentalCarousel extends React.Component { }, tabIndex: tabIndex, className: 'carousel-item' - } + }; return (
diff --git a/common/static/common/js/discussion/utils.js b/common/static/common/js/discussion/utils.js index bc9a99f14ff6..9c038a16da9d 100644 --- a/common/static/common/js/discussion/utils.js +++ b/common/static/common/js/discussion/utils.js @@ -33,7 +33,7 @@ userId = this.user ? this.user.id : void 0; } if(_.isUndefined(this.roleIds)) { - this.roleIds = {} + this.roleIds = {}; } staff = _.union(this.roleIds.Moderator, this.roleIds.Administrator); return _.include(staff, parseInt(userId)); diff --git a/common/static/js/src/accessibility_tools.js b/common/static/js/src/accessibility_tools.js index 54f9997d19de..5c2392c35292 100644 --- a/common/static/js/src/accessibility_tools.js +++ b/common/static/js/src/accessibility_tools.js @@ -151,7 +151,7 @@ var accessible_modal = function(trigger, closeButtonId, modalId, mainPageId) { // see http://accessibility.oit.ncsu.edu/blog/2013/09/13/the-incredible-accessible-modal-dialog/ // for more information on managing modals // - var initialFocus + var initialFocus; $(trigger).click(function() { $focusedElementBeforeModal = $(trigger); diff --git a/lms/static/js/dashboard/legacy.js b/lms/static/js/dashboard/legacy.js index bd36849b25b7..7d0007a352e2 100644 --- a/lms/static/js/dashboard/legacy.js +++ b/lms/static/js/dashboard/legacy.js @@ -272,7 +272,7 @@ var edx = edx || {}; display: 'block', 'z-index': 0 }); - $('#activate-account-modal').focus() + $('#activate-account-modal').focus(); } $('.action-email-settings').each(function(index) { diff --git a/lms/static/js/demographics_collection/DemographicsCollectionBanner.jsx b/lms/static/js/demographics_collection/DemographicsCollectionBanner.jsx index 71a221d081f7..5aeddd55058b 100644 --- a/lms/static/js/demographics_collection/DemographicsCollectionBanner.jsx +++ b/lms/static/js/demographics_collection/DemographicsCollectionBanner.jsx @@ -10,7 +10,7 @@ export class DemographicsCollectionBanner extends React.Component { this.state = { modalOpen: false, hideBanner: false - } + }; this.dismissBanner = this.dismissBanner.bind(this); } @@ -88,7 +88,7 @@ export class DemographicsCollectionBanner extends React.Component { }
- ) + ); } else { return null; } diff --git a/lms/static/js/demographics_collection/DemographicsCollectionModal.jsx b/lms/static/js/demographics_collection/DemographicsCollectionModal.jsx index 065cdc75838d..036062eca160 100644 --- a/lms/static/js/demographics_collection/DemographicsCollectionModal.jsx +++ b/lms/static/js/demographics_collection/DemographicsCollectionModal.jsx @@ -3,7 +3,7 @@ import React from 'react'; import get from 'lodash/get'; import Wizard from './Wizard'; import Cookies from 'js-cookie'; -import {SelectWithInput} from './SelectWithInput' +import {SelectWithInput} from './SelectWithInput'; import {MultiselectDropdown} from './MultiselectDropdown'; import AxiosJwtTokenService from '../jwt_auth/AxiosJwtTokenService'; import StringUtils from 'edx-ui-toolkit/js/utils/string-utils'; @@ -66,7 +66,7 @@ class DemographicsCollectionModal extends React.Component { accessToken, refreshUrl, ); - this.csrfTokenService = new AxiosCsrfTokenService(this.props.csrfTokenPath) + this.csrfTokenService = new AxiosCsrfTokenService(this.props.csrfTokenPath); } async componentDidMount() { @@ -108,7 +108,7 @@ class DemographicsCollectionModal extends React.Component { }; try { await this.jwtTokenService.getJwtToken(); - await fetch(url, options) + await fetch(url, options); } catch (error) { this.setState({loading: false, fieldError: true, errorMessage: error}); } @@ -129,13 +129,13 @@ class DemographicsCollectionModal extends React.Component { this.setState(({selected}) => { // decline was previously selected if (selected[FIELD_NAMES.ETHNICITY].find(i => i === 'declined')) { - return {selected: {...selected, [FIELD_NAMES.ETHNICITY]: values.filter(value => value !== 'declined')}} + return {selected: {...selected, [FIELD_NAMES.ETHNICITY]: values.filter(value => value !== 'declined')}}; // decline was just selected } else if (decline) { - return {selected: {...selected, [FIELD_NAMES.ETHNICITY]: [decline]}} + return {selected: {...selected, [FIELD_NAMES.ETHNICITY]: [decline]}}; // anything else was selected } else { - return {selected: {...selected, [FIELD_NAMES.ETHNICITY]: values}} + return {selected: {...selected, [FIELD_NAMES.ETHNICITY]: values}}; } }); } @@ -174,7 +174,7 @@ class DemographicsCollectionModal extends React.Component { // We gather the possible answers to any demographics questions from the OPTIONS of the api async getDemographicsQuestionOptions() { try { - const optionsResponse = await fetch(`${this.props.demographicsBaseUrl}/demographics/api/v1/demographics/`, {method: 'OPTIONS'}) + const optionsResponse = await fetch(`${this.props.demographicsBaseUrl}/demographics/api/v1/demographics/`, {method: 'OPTIONS'}); const demographicsOptions = await optionsResponse.json(); return demographicsOptions; } catch (error) { @@ -240,7 +240,7 @@ class DemographicsCollectionModal extends React.Component { render() { if (this.state.loading) { - return
+ return
; } return ( @@ -319,7 +319,7 @@ class DemographicsCollectionModal extends React.Component { name: FIELD_NAMES.ETHNICITY, value: wizardConsumer[FIELD_NAMES.ETHNICITY].map(ethnicity => ({ethnicity, value: ethnicity})), } - } + }; this.handleSelectChange(e); }} /> @@ -493,7 +493,7 @@ class DemographicsCollectionModal extends React.Component {
- ) + ); } } diff --git a/lms/static/js/demographics_collection/MultiselectDropdown.jsx b/lms/static/js/demographics_collection/MultiselectDropdown.jsx index 780ed91929db..b5e9d78fd08f 100644 --- a/lms/static/js/demographics_collection/MultiselectDropdown.jsx +++ b/lms/static/js/demographics_collection/MultiselectDropdown.jsx @@ -13,7 +13,7 @@ class MultiselectDropdown extends React.Component { this.buttonRef = null; this.setButtonRef = (element) => { this.buttonRef = element; - } + }; this.focusButton = this.focusButton.bind(this); this.handleKeydown = this.handleKeydown.bind(this); @@ -87,7 +87,7 @@ class MultiselectDropdown extends React.Component { .map(selected => this.findOption(selected).display_name) .join(', '); if (selectedList.length > 60) { - return selectedList.substring(0, 55) + '...' + return selectedList.substring(0, 55) + '...'; } return selectedList; } @@ -95,7 +95,7 @@ class MultiselectDropdown extends React.Component { renderUnselect() { return this.props.selected.length > 0 && ( - ) + ); } renderMenu() { @@ -112,15 +112,15 @@ class MultiselectDropdown extends React.Component { {option.display_name}
- ) - }) + ); + }); return (
{this.props.label} {options}
- ) + ); } render() { @@ -136,7 +136,7 @@ class MultiselectDropdown extends React.Component { // and close the dropdown. if (!e.currentTarget.contains(e.relatedTarget)) { this.props.onBlur(e); - this.setState({open: false}) + this.setState({open: false}); } }} > @@ -151,7 +151,7 @@ class MultiselectDropdown extends React.Component { {this.renderMenu()} - ) + ); } } diff --git a/lms/static/js/demographics_collection/SelectWithInput.jsx b/lms/static/js/demographics_collection/SelectWithInput.jsx index 794c87e45074..237b514ae3bb 100644 --- a/lms/static/js/demographics_collection/SelectWithInput.jsx +++ b/lms/static/js/demographics_collection/SelectWithInput.jsx @@ -46,5 +46,5 @@ export const SelectWithInput = (props) => { /> } - ) -} + ); +}; diff --git a/lms/static/js/demographics_collection/Wizard.jsx b/lms/static/js/demographics_collection/Wizard.jsx index 42f57d3574b6..759cc8c2d148 100644 --- a/lms/static/js/demographics_collection/Wizard.jsx +++ b/lms/static/js/demographics_collection/Wizard.jsx @@ -16,7 +16,7 @@ export default class Wizard extends React.Component { totalPages: 0, pages: [], wizardContext: {}, - } + }; this.wizardComplete = this.wizardComplete.bind(this); } @@ -32,18 +32,18 @@ export default class Wizard extends React.Component { handleNext() { if (this.state.currentPage < this.props.children.length) { - this.setState(prevState => ({currentPage: prevState.currentPage + 1})) + this.setState(prevState => ({currentPage: prevState.currentPage + 1})); } } findSubComponentByType(type) { - return React.Children.toArray(this.props.children).filter(child => child.type.name === type) + return React.Children.toArray(this.props.children).filter(child => child.type.name === type); } // this needs to handle the case of no provided header renderHeader() { const header = this.findSubComponentByType(Wizard.Header.name)[0]; - return header.props.children({currentPage: this.state.currentPage, totalPages: this.state.totalPages}) + return header.props.children({currentPage: this.state.currentPage, totalPages: this.state.totalPages}); } renderPage() { @@ -74,7 +74,7 @@ export default class Wizard extends React.Component { - ) + ); } /** diff --git a/lms/static/js/learner_analytics_dashboard/CircleChartLegend.jsx b/lms/static/js/learner_analytics_dashboard/CircleChartLegend.jsx index 70348751974a..adf924607380 100644 --- a/lms/static/js/learner_analytics_dashboard/CircleChartLegend.jsx +++ b/lms/static/js/learner_analytics_dashboard/CircleChartLegend.jsx @@ -50,6 +50,6 @@ class CircleChartLegend extends React.Component { CircleChartLegend.propTypes = { data: PropTypes.array.isRequired -} +}; export default CircleChartLegend; diff --git a/lms/static/js/learner_analytics_dashboard/Discussions.jsx b/lms/static/js/learner_analytics_dashboard/Discussions.jsx index d5b48c915a97..8075d6269bbe 100644 --- a/lms/static/js/learner_analytics_dashboard/Discussions.jsx +++ b/lms/static/js/learner_analytics_dashboard/Discussions.jsx @@ -85,6 +85,6 @@ class Discussions extends React.Component { Discussions.propTypes = { content_authored: PropTypes.number.isRequired, thread_votes: PropTypes.number.isRequired -} +}; export default Discussions; diff --git a/lms/static/js/learner_analytics_dashboard/DueDates.jsx b/lms/static/js/learner_analytics_dashboard/DueDates.jsx index 86be589d0afa..accda77f2a08 100644 --- a/lms/static/js/learner_analytics_dashboard/DueDates.jsx +++ b/lms/static/js/learner_analytics_dashboard/DueDates.jsx @@ -51,7 +51,7 @@ class DueDates extends React.Component { return labels.reduce((accumulator, key) => { accumulator[key] = 0; return accumulator; - }, {}) + }, {}); } renderList() { @@ -73,6 +73,6 @@ class DueDates extends React.Component { DueDates.propTypes = { dates: PropTypes.array.isRequired -} +}; export default DueDates; diff --git a/lms/static/js/learner_analytics_dashboard/GradeTable.jsx b/lms/static/js/learner_analytics_dashboard/GradeTable.jsx index 6d5019c27fed..114f513b640e 100644 --- a/lms/static/js/learner_analytics_dashboard/GradeTable.jsx +++ b/lms/static/js/learner_analytics_dashboard/GradeTable.jsx @@ -68,7 +68,7 @@ class GradeTable extends React.Component { - ) + ); } }; @@ -77,6 +77,6 @@ GradeTable.propTypes = { grades: PropTypes.array.isRequired, passingGrade: PropTypes.number.isRequired, percentGrade: PropTypes.number.isRequired -} +}; export default GradeTable; diff --git a/lms/static/js/learner_analytics_dashboard/LearnerAnalyticsDashboard.jsx b/lms/static/js/learner_analytics_dashboard/LearnerAnalyticsDashboard.jsx index 24f059335056..097a7b3dfb45 100644 --- a/lms/static/js/learner_analytics_dashboard/LearnerAnalyticsDashboard.jsx +++ b/lms/static/js/learner_analytics_dashboard/LearnerAnalyticsDashboard.jsx @@ -15,7 +15,7 @@ function arrayToObject(array) { const key = Object.keys(obj)[0]; accumulator[key] = obj[key]; return accumulator; - }, {}) + }, {}); } function countByType(type, assignments) { @@ -24,7 +24,7 @@ function countByType(type, assignments) { if (format === type) { count += 1; } - }) + }); return count; } @@ -37,7 +37,7 @@ function getAssignmentCounts(types, assignments) { const countsArray = types.map((type) => { return { [type]: countByType(type, assignments) - } + }; }); return arrayToObject(countsArray); @@ -69,7 +69,7 @@ export function LearnerAnalyticsDashboard(props) { value: weight, label: type, sliceIndex: index + 1 - } + }; }); // Get a list of assignment types minus duplicates diff --git a/lms/static/js/spec/student_account/register_spec.js b/lms/static/js/spec/student_account/register_spec.js index 8b3fcce0e03e..17d82e2b13d6 100644 --- a/lms/static/js/spec/student_account/register_spec.js +++ b/lms/static/js/spec/student_account/register_spec.js @@ -514,7 +514,7 @@ }); it('shows optional exposed fields', function() { - var formFields = FORM_DESCRIPTION.fields + var formFields = FORM_DESCRIPTION.fields; formFields.push({ placeholder: '', name: 'exposed_custom_optional_field', @@ -525,15 +525,15 @@ exposed: true, instructions: 'Check this field if you would like to.', restrictions: {} - }) + }); createRegisterView(this, formFields); var elementClasses = view.$('.exposed-optional-fields').attr('class'); - var elementChildren = view.$('.exposed-optional-fields .form-field') + var elementChildren = view.$('.exposed-optional-fields .form-field'); // Expect the exposed optional fields container does not have other // classes assigned, like .hidden expect(elementClasses).toEqual('exposed-optional-fields'); - expect(elementChildren.length).toEqual(1) + expect(elementChildren.length).toEqual(1); }); it('hides optional fields by default', function() { diff --git a/lms/static/js/student_account/views/AccessView.js b/lms/static/js/student_account/views/AccessView.js index 3886a8272be5..f31a6f3abc6e 100644 --- a/lms/static/js/student_account/views/AccessView.js +++ b/lms/static/js/student_account/views/AccessView.js @@ -117,7 +117,7 @@ mode: this.activeForm }) ) - ) + ); this.postRender(); return this; diff --git a/lms/static/js/student_account/views/FormView.js b/lms/static/js/student_account/views/FormView.js index b04427df7d1a..c015a61842e3 100644 --- a/lms/static/js/student_account/views/FormView.js +++ b/lms/static/js/student_account/views/FormView.js @@ -65,7 +65,7 @@ HtmlUtils: HtmlUtils }) ) - ) + ); this.postRender(); return this; diff --git a/openedx/features/announcements/static/announcements/jsx/Announcements.jsx b/openedx/features/announcements/static/announcements/jsx/Announcements.jsx index 162a09aec824..b520d0ad3a22 100644 --- a/openedx/features/announcements/static/announcements/jsx/Announcements.jsx +++ b/openedx/features/announcements/static/announcements/jsx/Announcements.jsx @@ -15,7 +15,7 @@ class AnnouncementSkipLink extends React.Component { this.setState({ count: data.count }); - }) + }); } render() { @@ -66,7 +66,7 @@ class AnnouncementList extends React.Component { end_index: data.end_index, page: page }); - }) + }); } renderPrevPage() { @@ -132,4 +132,4 @@ export default class AnnouncementsView { } } -export {AnnouncementsView, AnnouncementList, AnnouncementSkipLink} +export {AnnouncementsView, AnnouncementList, AnnouncementSkipLink}; diff --git a/openedx/features/announcements/static/announcements/jsx/Announcements.test.jsx b/openedx/features/announcements/static/announcements/jsx/Announcements.test.jsx index 4b3b6a251efd..737d533a449a 100644 --- a/openedx/features/announcements/static/announcements/jsx/Announcements.test.jsx +++ b/openedx/features/announcements/static/announcements/jsx/Announcements.test.jsx @@ -1,15 +1,15 @@ import React from 'react'; import renderer from 'react-test-renderer'; -import testAnnouncements from './test-announcements.json' +import testAnnouncements from './test-announcements.json'; -import {AnnouncementSkipLink, AnnouncementList} from './Announcements' +import {AnnouncementSkipLink, AnnouncementList} from './Announcements'; describe('Announcements component', () => { test('render skip link', () => { const component = renderer.create( , ); - component.root.instance.setState({'count': 10}) + component.root.instance.setState({'count': 10}); const tree = component.toJSON(); expect(tree).toMatchSnapshot(); }); diff --git a/xmodule/assets/library_source_block/LibrarySourcedBlockPicker.jsx b/xmodule/assets/library_source_block/LibrarySourcedBlockPicker.jsx index d491939c947c..ff206cbb9d59 100644 --- a/xmodule/assets/library_source_block/LibrarySourcedBlockPicker.jsx +++ b/xmodule/assets/library_source_block/LibrarySourcedBlockPicker.jsx @@ -88,7 +88,7 @@ class LibrarySourcedBlockPicker extends React.Component { } onLibrarySearchInput(event) { - event.persist() + event.persist(); this.setState({ searchedLibrary: event.target.value, }); @@ -101,7 +101,7 @@ class LibrarySourcedBlockPicker extends React.Component { } onXBlockSearchInput(event) { - event.persist() + event.persist(); if (!this.debouncedFetchXblocks) { this.debouncedFetchXblocks = _.debounce(value => { this.fetchXblocks(this.state.selectedLibrary, value); diff --git a/xmodule/js/karma_runner_webpack.js b/xmodule/js/karma_runner_webpack.js index c5c4290d606b..f821c16038d8 100644 --- a/xmodule/js/karma_runner_webpack.js +++ b/xmodule/js/karma_runner_webpack.js @@ -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'; diff --git a/xmodule/js/spec/video/video_events_plugin_spec.js b/xmodule/js/spec/video/video_events_plugin_spec.js index 54ed1892074d..d6840e394158 100644 --- a/xmodule/js/spec/video/video_events_plugin_spec.js +++ b/xmodule/js/spec/video/video_events_plugin_spec.js @@ -1,4 +1,4 @@ -import '../helper.js' +import '../helper.js'; (function(undefined) { 'use strict'; diff --git a/xmodule/js/spec/video/video_save_state_plugin_spec.js b/xmodule/js/spec/video/video_save_state_plugin_spec.js index 556a6c6a1d18..04206ae9ad85 100644 --- a/xmodule/js/spec/video/video_save_state_plugin_spec.js +++ b/xmodule/js/spec/video/video_save_state_plugin_spec.js @@ -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]); diff --git a/xmodule/js/src/time.js b/xmodule/js/src/time.js index 7fecbebc9a56..10e87ad30008 100644 --- a/xmodule/js/src/time.js +++ b/xmodule/js/src/time.js @@ -38,4 +38,4 @@ function _pad(number) { } } -export {format, formatFull, convert} +export {format, formatFull, convert}; From 40ac89dcddb1205b7e7e3ce1f2793836f4aaa737 Mon Sep 17 00:00:00 2001 From: Syed Ali Abbas Zaidi Date: Thu, 9 Mar 2023 14:57:26 +0500 Subject: [PATCH 07/30] fix: eslint newline per chain rule --- .eslintrc.json | 1 - common/static/common/js/discussion/utils.js | 4 +++- lms/static/js/Markdown.Editor.js | 4 +++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 8244e400deec..22dbc24aab7d 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -49,7 +49,6 @@ "import/no-dynamic-require": "off", "import/no-unresolved": "off", "max-len": "off", - "newline-per-chained-call": "off", "no-console": "off", "no-lonely-if": "off", "no-param-reassign": "off", diff --git a/common/static/common/js/discussion/utils.js b/common/static/common/js/discussion/utils.js index 9c038a16da9d..f489ab2e8843 100644 --- a/common/static/common/js/discussion/utils.js +++ b/common/static/common/js/discussion/utils.js @@ -77,7 +77,9 @@ DiscussionUtil.generateDiscussionLink = function(cls, txt, handler) { return $('') .addClass('discussion-link').attr('href', '#') - .addClass(cls).text(txt).click(function() { return handler(this); }); + .addClass(cls) + .text(txt) + .click(function() { return handler(this); }); }; DiscussionUtil.urlFor = function(name, param, param1, param2) { diff --git a/lms/static/js/Markdown.Editor.js b/lms/static/js/Markdown.Editor.js index e61630bced43..5dcb0fa79d52 100644 --- a/lms/static/js/Markdown.Editor.js +++ b/lms/static/js/Markdown.Editor.js @@ -1663,7 +1663,9 @@ }); if (title) { title = title.trim ? title.trim() : title.replace(/^\s*/, '').replace(/\s*$/, ''); - title = $.trim(title).replace(/"/g, 'quot;').replace(/\(/g, '(').replace(/\)/g, ')').replace(//g, '>'); + title = $.trim(title).replace(/"/g, 'quot;').replace(/\(/g, '(').replace(/\)/g, ')') + .replace(//g, '>'); } return title ? link + ' "' + title + '"' : link; }); From 83dee98107f0cd967d235e7f133c1e29169f0fe4 Mon Sep 17 00:00:00 2001 From: Syed Ali Abbas Zaidi Date: Thu, 9 Mar 2023 15:17:37 +0500 Subject: [PATCH 08/30] fix: eslint space infix ops rule --- cms/static/js/views/pages/container.js | 2 +- lms/static/js/Markdown.Editor.js | 2 +- .../LearnerAnalyticsDashboard.jsx | 2 +- .../library_source_block/LibrarySourcedBlockPicker.jsx | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cms/static/js/views/pages/container.js b/cms/static/js/views/pages/container.js index c7464972efc1..927219f4479a 100644 --- a/cms/static/js/views/pages/container.js +++ b/cms/static/js/views/pages/container.js @@ -482,7 +482,7 @@ function($, _, Backbone, gettext, BasePage, ViewUtils, ContainerView, XBlockView } if((useNewTextEditor === 'True' && blockType.includes('html')) || (useNewVideoEditor === 'True' && blockType.includes('video')) - ||(useNewProblemEditor === 'True' && blockType.includes('problem')) + || (useNewProblemEditor === 'True' && blockType.includes('problem')) ){ var destinationUrl = this.$('.xblock-header-primary').attr('authoring_MFE_base_url') + '/' + blockType[1] + '/' + encodeURI(data.locator); window.location.href = destinationUrl; diff --git a/lms/static/js/Markdown.Editor.js b/lms/static/js/Markdown.Editor.js index 5dcb0fa79d52..f24f057a9205 100644 --- a/lms/static/js/Markdown.Editor.js +++ b/lms/static/js/Markdown.Editor.js @@ -236,7 +236,7 @@ function findAnEmptyToolbar(toolbarClassName) { var toolbars = doc.getElementsByClassName(toolbarClassName); - for (var i=0; i < toolbars.length; ++i) { + for (var i = 0; i < toolbars.length; ++i) { var aToolbar = toolbars[i]; if (aToolbar.children.length == 0) { var anEmptyToolbar = aToolbar; diff --git a/lms/static/js/learner_analytics_dashboard/LearnerAnalyticsDashboard.jsx b/lms/static/js/learner_analytics_dashboard/LearnerAnalyticsDashboard.jsx index 097a7b3dfb45..8ad5df2e0d11 100644 --- a/lms/static/js/learner_analytics_dashboard/LearnerAnalyticsDashboard.jsx +++ b/lms/static/js/learner_analytics_dashboard/LearnerAnalyticsDashboard.jsx @@ -56,7 +56,7 @@ function getStreakEncouragement(count) { } function getStreakString(count) { - const unit = (count ===1) ? 'week' : 'weeks'; + const unit = (count === 1) ? 'week' : 'weeks'; return (count > 0) ? `Active ${count} ${unit} in a row` : false; } diff --git a/xmodule/assets/library_source_block/LibrarySourcedBlockPicker.jsx b/xmodule/assets/library_source_block/LibrarySourcedBlockPicker.jsx index ff206cbb9d59..b1cd8e39067c 100644 --- a/xmodule/assets/library_source_block/LibrarySourcedBlockPicker.jsx +++ b/xmodule/assets/library_source_block/LibrarySourcedBlockPicker.jsx @@ -29,7 +29,7 @@ class LibrarySourcedBlockPicker extends React.Component { this.fetchLibraries(); } - fetchLibraries(textSearch='', page=1, append=false) { + fetchLibraries(textSearch = '', page = 1, append = false) { this.setState({ libraries: append ? this.state.libraries : [], libraryLoading: true, @@ -42,7 +42,7 @@ class LibrarySourcedBlockPicker extends React.Component { libraryLoading: false, }, () => { if (res.next) { - this.fetchLibraries(textSearch, page+1, true); + this.fetchLibraries(textSearch, page + 1, true); } }); } catch (error) { @@ -58,7 +58,7 @@ class LibrarySourcedBlockPicker extends React.Component { }); } - fetchXblocks(library, textSearch='', page=1, append=false) { + fetchXblocks(library, textSearch = '', page = 1, append = false) { this.setState({ xblocks: append ? this.state.xblocks : [], xblocksLoading: true, @@ -71,7 +71,7 @@ class LibrarySourcedBlockPicker extends React.Component { xblocksLoading: false, }, () => { if (res.next) { - this.fetchXblocks(library, textSearch, page+1, true); + this.fetchXblocks(library, textSearch, page + 1, true); } }); } catch (error) { From da2f67dbc073f653f7d74f6f4b97b5682e8a7c2b Mon Sep 17 00:00:00 2001 From: Syed Ali Abbas Zaidi Date: Thu, 9 Mar 2023 15:22:25 +0500 Subject: [PATCH 09/30] fix: eslint space-in-parens issue --- cms/static/js/views/pages/container.js | 4 ++-- lms/static/js/learner_analytics_dashboard/DueDates.jsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cms/static/js/views/pages/container.js b/cms/static/js/views/pages/container.js index 927219f4479a..91a973649813 100644 --- a/cms/static/js/views/pages/container.js +++ b/cms/static/js/views/pages/container.js @@ -265,7 +265,7 @@ function($, _, Backbone, gettext, BasePage, ViewUtils, ContainerView, XBlockView editXBlock: function(event, options) { event.preventDefault(); - if(!options || options.view !== 'visibility_view' ){ + if(!options || options.view !== 'visibility_view'){ const primaryHeader = $(event.target).closest('.xblock-header-primary'); var useNewTextEditor = primaryHeader.attr('use-new-editor-text'), @@ -273,7 +273,7 @@ function($, _, Backbone, gettext, BasePage, ViewUtils, ContainerView, XBlockView useNewProblemEditor = primaryHeader.attr('use-new-editor-problem'), blockType = primaryHeader.attr('data-block-type'); - if( (useNewTextEditor === 'True' && blockType === 'html') + if((useNewTextEditor === 'True' && blockType === 'html') || (useNewVideoEditor === 'True' && blockType === 'video') || (useNewProblemEditor === 'True' && blockType === 'problem') ) { diff --git a/lms/static/js/learner_analytics_dashboard/DueDates.jsx b/lms/static/js/learner_analytics_dashboard/DueDates.jsx index accda77f2a08..fa47ec9898de 100644 --- a/lms/static/js/learner_analytics_dashboard/DueDates.jsx +++ b/lms/static/js/learner_analytics_dashboard/DueDates.jsx @@ -22,7 +22,7 @@ class DueDates extends React.Component { getLabel(type) { const {assignmentCounts} = this.props; - if (assignmentCounts[type] < 2 ) { + if (assignmentCounts[type] < 2) { return type; } else { this.renderLabels[type] += 1; From 01dd648098532fe01d08ab0791b80bce872c96aa Mon Sep 17 00:00:00 2001 From: Syed Ali Abbas Zaidi Date: Thu, 9 Mar 2023 15:27:19 +0500 Subject: [PATCH 10/30] fix: eslint space before function paren issue --- cms/static/js/sock.js | 4 ++-- cms/static/js/spec/views/module_edit_spec.js | 2 +- cms/static/js/spec/views/pages/course_outline_spec.js | 8 ++++---- cms/static/js/views/pages/course_outline.js | 2 +- xmodule/js/karma_runner_webpack.js | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cms/static/js/sock.js b/cms/static/js/sock.js index 3261eaf1de01..1512ec51bc76 100644 --- a/cms/static/js/sock.js +++ b/cms/static/js/sock.js @@ -4,7 +4,7 @@ import 'jquery.smoothScroll'; 'use strict'; -var toggleSock = function (e) { +var toggleSock = function(e) { e.preventDefault(); var $btnShowSockLabel = $(this).find('.copy-show'); @@ -33,7 +33,7 @@ var toggleSock = function (e) { }); }; -domReady(function () { +domReady(function() { // toggling footer additional support $('.cta-show-sock').bind('click', toggleSock); }); diff --git a/cms/static/js/spec/views/module_edit_spec.js b/cms/static/js/spec/views/module_edit_spec.js index c46cb2b8732a..a96bbad99594 100644 --- a/cms/static/js/spec/views/module_edit_spec.js +++ b/cms/static/js/spec/views/module_edit_spec.js @@ -64,7 +64,7 @@ describe('ModuleEdit', function() { }); }); describe('render', function() { - beforeEach(function () { + beforeEach(function() { edit_helpers.installEditTemplates(true); spyOn(this.moduleEdit, 'loadDisplay'); spyOn(this.moduleEdit, 'delegateEvents'); diff --git a/cms/static/js/spec/views/pages/course_outline_spec.js b/cms/static/js/spec/views/pages/course_outline_spec.js index be5b4ceb43e4..bff86cdc1052 100644 --- a/cms/static/js/spec/views/pages/course_outline_spec.js +++ b/cms/static/js/spec/views/pages/course_outline_spec.js @@ -1458,7 +1458,7 @@ describe('CourseOutlinePage', function() { $('.wrapper-modal-window .action-save').click(); }); - it('can select the onboarding exam when a course supports onboarding', function () { + it('can select the onboarding exam when a course supports onboarding', function() { var mockCourseWithSpecialExamJSON = createMockCourseJSON({}, [ createMockSectionJSON({ has_changes: true, @@ -2191,7 +2191,7 @@ describe('CourseOutlinePage', function() { expect($modalWindow.find('.outline-subsection')).not.toExist(); }); - describe('Self Paced with Custom Personalized Learner Schedules (PLS)', function () { + describe('Self Paced with Custom Personalized Learner Schedules (PLS)', function() { beforeEach(function() { var mockCourseJSON = createMockCourseJSON({}, [ createMockSectionJSON({}, [ @@ -2235,7 +2235,7 @@ describe('CourseOutlinePage', function() { ]) ]); - it('can show correct editors for self_paced course with custom pacing', function (){ + it('can show correct editors for self_paced course with custom pacing', function(){ outlinePage.$('.outline-subsection .configure-button').click(); expect($('.edit-settings-release').length).toBe(0); // Due date input exists for custom pacing self paced courses @@ -2470,7 +2470,7 @@ describe('CourseOutlinePage', function() { expect(messages).toContainText('Contains staff only content'); }); - describe('discussion settings', function () { + describe('discussion settings', function() { it('hides discussion settings if unit level discussions are disabled', function() { getUnitStatus({}, {unit_level_discussions: false}); outlinePage.$('.outline-unit .configure-button').click(); diff --git a/cms/static/js/views/pages/course_outline.js b/cms/static/js/views/pages/course_outline.js index 78a69baa9a06..31227f4aa1d9 100644 --- a/cms/static/js/views/pages/course_outline.js +++ b/cms/static/js/views/pages/course_outline.js @@ -125,7 +125,7 @@ function($, _, gettext, BasePage, XBlockViewUtils, CourseOutlineView, ViewUtils, * at 100 millisecond intervals until element is found or * Polling is reached */ - scrollToElement: function () { + scrollToElement: function() { this.findElementPollingTimeout -= this.pollingDelay; const elementID = window.location.hash.replace('#', ''); diff --git a/xmodule/js/karma_runner_webpack.js b/xmodule/js/karma_runner_webpack.js index f821c16038d8..64cd9306668e 100644 --- a/xmodule/js/karma_runner_webpack.js +++ b/xmodule/js/karma_runner_webpack.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); }; From 3f3b352a91e55c8a2eb62f11e0cf5c80943904af Mon Sep 17 00:00:00 2001 From: Syed Ali Abbas Zaidi Date: Thu, 9 Mar 2023 15:32:44 +0500 Subject: [PATCH 11/30] fix: eslint space before blocks issue --- cms/static/js/spec/views/pages/course_outline_spec.js | 2 +- cms/static/js/views/modals/course_outline_modals.js | 4 ++-- cms/static/js/views/pages/container.js | 4 ++-- cms/static/js/views/settings/main.js | 2 +- lms/static/js/student_account/models/user_account_model.js | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cms/static/js/spec/views/pages/course_outline_spec.js b/cms/static/js/spec/views/pages/course_outline_spec.js index bff86cdc1052..732bb6df319b 100644 --- a/cms/static/js/spec/views/pages/course_outline_spec.js +++ b/cms/static/js/spec/views/pages/course_outline_spec.js @@ -2235,7 +2235,7 @@ describe('CourseOutlinePage', function() { ]) ]); - it('can show correct editors for self_paced course with custom pacing', function(){ + it('can show correct editors for self_paced course with custom pacing', function() { outlinePage.$('.outline-subsection .configure-button').click(); expect($('.edit-settings-release').length).toBe(0); // Due date input exists for custom pacing self paced courses diff --git a/cms/static/js/views/modals/course_outline_modals.js b/cms/static/js/views/modals/course_outline_modals.js index 07b2f0042f6a..492bd4b7d0bd 100644 --- a/cms/static/js/views/modals/course_outline_modals.js +++ b/cms/static/js/views/modals/course_outline_modals.js @@ -444,9 +444,9 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview', getRequestData: function() { // Grab all the sections, map them to their block_ids, then return as an Array - var sectionIds = $('.outline-section').map(function(){ return this.id; }).get(); + var sectionIds = $('.outline-section').map(function() { return this.id; }).get(); // Grab all the subsections, map them to their block_ids, then return as an Array - var subsectionIds = $('.outline-subsection').map(function(){ return this.id; }).get(); + var subsectionIds = $('.outline-subsection').map(function() { return this.id; }).get(); var relative_weeks_due = null; if (this.getValue() > 0 && $('#grading_type').val() !== 'notgraded') { relative_weeks_due = this.getValue(); diff --git a/cms/static/js/views/pages/container.js b/cms/static/js/views/pages/container.js index 91a973649813..b6afcd4b1182 100644 --- a/cms/static/js/views/pages/container.js +++ b/cms/static/js/views/pages/container.js @@ -265,7 +265,7 @@ function($, _, Backbone, gettext, BasePage, ViewUtils, ContainerView, XBlockView editXBlock: function(event, options) { event.preventDefault(); - if(!options || options.view !== 'visibility_view'){ + if (!options || options.view !== 'visibility_view') { const primaryHeader = $(event.target).closest('.xblock-header-primary'); var useNewTextEditor = primaryHeader.attr('use-new-editor-text'), @@ -476,7 +476,7 @@ function($, _, Backbone, gettext, BasePage, ViewUtils, ContainerView, XBlockView useNewProblemEditor = this.$('.xblock-header-primary').attr('use-new-editor-problem'); // find the block type in the locator if availible - if(data.hasOwnProperty('locator')){ + if(data.hasOwnProperty('locator')) { var matchBlockTypeFromLocator = /\@(.*?)\+/; var blockType = data.locator.match(matchBlockTypeFromLocator); } diff --git a/cms/static/js/views/settings/main.js b/cms/static/js/views/settings/main.js index 3876ae6f7327..ef728b616c81 100644 --- a/cms/static/js/views/settings/main.js +++ b/cms/static/js/views/settings/main.js @@ -388,7 +388,7 @@ function(ValidatingView, CodeMirror, _, $, ui, DateUtils, FileUploadModel, Hides and clears the certificate available date field if a display behavior that doesn't use it is chosen. Because we are clearing it, toggling back to "end_with_date" will require re-entering the date */ - if (!this.useV2CertDisplaySettings){ + if (!this.useV2CertDisplaySettings) { return; } let showDatepicker = this.model.get('certificates_display_behavior') == 'end_with_date'; diff --git a/lms/static/js/student_account/models/user_account_model.js b/lms/static/js/student_account/models/user_account_model.js index 842bf780f49c..77f288a3dbb9 100644 --- a/lms/static/js/student_account/models/user_account_model.js +++ b/lms/static/js/student_account/models/user_account_model.js @@ -62,7 +62,7 @@ minimumAllowedAge = this.get('parental_consent_age_limit'), enableCoppaCompliance = this.get('enable_coppa_compliance'); - if(enableCoppaCompliance){ + if (enableCoppaCompliance) { var currentYear = new Date().getFullYear(), isOlderThanMinimum = (currentYear - yearOfBirth) >= minimumAllowedAge; return isBirthDefined && isOlderThanMinimum && !(this.get('requires_parental_consent')); From 81b8290558d817db87caa5a6e732e9c2135bf019 Mon Sep 17 00:00:00 2001 From: Syed Ali Abbas Zaidi Date: Thu, 9 Mar 2023 15:38:34 +0500 Subject: [PATCH 12/30] fix: eslint arrow body style issue --- jest.config.js | 2 +- .../learner_analytics_dashboard/DueDates.jsx | 14 ++++++------- .../LearnerAnalyticsDashboard.jsx | 20 ++++++++----------- 3 files changed, 15 insertions(+), 21 deletions(-) diff --git a/jest.config.js b/jest.config.js index e9e014bd1d14..57cc9f78d3ed 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,6 +1,6 @@ module.exports = { 'globals': { - 'gettext': (t) => { return t; }, + 'gettext': (t) => t, }, 'modulePaths': [ 'common/static/common/js/components', diff --git a/lms/static/js/learner_analytics_dashboard/DueDates.jsx b/lms/static/js/learner_analytics_dashboard/DueDates.jsx index fa47ec9898de..52a2914e1f6b 100644 --- a/lms/static/js/learner_analytics_dashboard/DueDates.jsx +++ b/lms/static/js/learner_analytics_dashboard/DueDates.jsx @@ -35,14 +35,12 @@ class DueDates extends React.Component { this.renderLabels = this.initLabelTracker(assignmentCounts); return dates.sort((a, b) => new Date(a.due) > new Date(b.due)) - .map(({format, due}, index) => { - return ( -
  • -
    {this.getLabel(format)}
    -
    {this.getDate(due)}
    -
  • - ); - }); + .map(({format, due}, index) => ( +
  • +
    {this.getLabel(format)}
    +
    {this.getDate(due)}
    +
  • + )); } initLabelTracker(list) { diff --git a/lms/static/js/learner_analytics_dashboard/LearnerAnalyticsDashboard.jsx b/lms/static/js/learner_analytics_dashboard/LearnerAnalyticsDashboard.jsx index 8ad5df2e0d11..6936bf19f7c7 100644 --- a/lms/static/js/learner_analytics_dashboard/LearnerAnalyticsDashboard.jsx +++ b/lms/static/js/learner_analytics_dashboard/LearnerAnalyticsDashboard.jsx @@ -34,11 +34,9 @@ function getActiveUserString(count) { } function getAssignmentCounts(types, assignments) { - const countsArray = types.map((type) => { - return { - [type]: countByType(type, assignments) - }; - }); + const countsArray = types.map((type) => ({ + [type]: countByType(type, assignments) + })); return arrayToObject(countsArray); } @@ -64,13 +62,11 @@ export function LearnerAnalyticsDashboard(props) { const { grading_policy, grades, schedule, schedule_raw, week_streak, weekly_active_users, discussion_info, profile_images, passing_grade, percent_grade } = props; - const gradeBreakdown = grading_policy.GRADER.map(({type, weight}, index) => { - return { - value: weight, - label: type, - sliceIndex: index + 1 - }; - }); + const gradeBreakdown = grading_policy.GRADER.map(({type, weight}, index) => ({ + value: weight, + label: type, + sliceIndex: index + 1 + })); // Get a list of assignment types minus duplicates const assignments = gradeBreakdown.map(value => value['label']); From 335ab974328f2dde975fbe55df75c78e7015d54a Mon Sep 17 00:00:00 2001 From: Syed Ali Abbas Zaidi Date: Thu, 9 Mar 2023 15:45:20 +0500 Subject: [PATCH 13/30] fix: eslint dot-location issue --- .../spec/views/certificate_preview_spec.js | 12 ++++---- .../views/pages/container_subviews_spec.js | 12 ++++---- .../js/spec/views/xblock_validation_spec.js | 4 +-- common/static/js/spec/string_utils_spec.js | 12 ++++---- lms/static/js/course_survey.js | 30 +++++++++---------- .../js/instructor_dashboard/certificates.js | 6 ++-- .../js/spec/groups/views/cohorts_spec.js | 4 +-- .../js/spec/groups/views/discussions_spec.js | 16 +++++----- .../certificates_invalidation_spec.js | 8 ++--- .../js/spec_helpers/bookmark_helpers.js | 6 ++-- xmodule/js/src/capa/display.js | 4 +-- 11 files changed, 57 insertions(+), 57 deletions(-) diff --git a/cms/static/js/certificates/spec/views/certificate_preview_spec.js b/cms/static/js/certificates/spec/views/certificate_preview_spec.js index 741c7c5996ad..ed7f07895173 100644 --- a/cms/static/js/certificates/spec/views/certificate_preview_spec.js +++ b/cms/static/js/certificates/spec/views/certificate_preview_spec.js @@ -64,16 +64,16 @@ function(_, $, Course, CertificatePreview, TemplateHelpers, ViewHelpers, AjaxHel it('course mode selection updating the link successfully', function() { selectDropDownByText(this.view.$(SELECTORS.course_modes), 'test1'); - expect(this.view.$(SELECTORS.preview_certificate).attr('href')). - toEqual('/users/1/courses/orgX/009/2016?preview=test1'); + expect(this.view.$(SELECTORS.preview_certificate).attr('href')) + .toEqual('/users/1/courses/orgX/009/2016?preview=test1'); selectDropDownByText(this.view.$(SELECTORS.course_modes), 'test2'); - expect(this.view.$(SELECTORS.preview_certificate).attr('href')). - toEqual('/users/1/courses/orgX/009/2016?preview=test2'); + expect(this.view.$(SELECTORS.preview_certificate).attr('href')) + .toEqual('/users/1/courses/orgX/009/2016?preview=test2'); selectDropDownByText(this.view.$(SELECTORS.course_modes), 'test3'); - expect(this.view.$(SELECTORS.preview_certificate).attr('href')). - toEqual('/users/1/courses/orgX/009/2016?preview=test3'); + expect(this.view.$(SELECTORS.preview_certificate).attr('href')) + .toEqual('/users/1/courses/orgX/009/2016?preview=test3'); }); it('toggle certificate activation event works fine', function() { diff --git a/cms/static/js/spec/views/pages/container_subviews_spec.js b/cms/static/js/spec/views/pages/container_subviews_spec.js index d3860e853033..cde0b42d8109 100644 --- a/cms/static/js/spec/views/pages/container_subviews_spec.js +++ b/cms/static/js/spec/views/pages/container_subviews_spec.js @@ -343,15 +343,15 @@ describe('Container Subviews', function() { it('renders the last published date and user when there are no changes', function() { renderContainerPage(this, mockContainerXBlockHtml); fetch({published_on: 'Jul 01, 2014 at 12:45 UTC', published_by: 'amako'}); - expect(containerPage.$(lastDraftCss).text()). - toContain('Last published Jul 01, 2014 at 12:45 UTC by amako'); + expect(containerPage.$(lastDraftCss).text()) + .toContain('Last published Jul 01, 2014 at 12:45 UTC by amako'); }); it('renders the last saved date and user when there are changes', function() { renderContainerPage(this, mockContainerXBlockHtml); fetch({has_changes: true, edited_on: 'Jul 02, 2014 at 14:20 UTC', edited_by: 'joe'}); - expect(containerPage.$(lastDraftCss).text()). - toContain('Draft saved on Jul 02, 2014 at 14:20 UTC by joe'); + expect(containerPage.$(lastDraftCss).text()) + .toContain('Draft saved on Jul 02, 2014 at 14:20 UTC by joe'); }); describe('Release Date', function() { @@ -596,8 +596,8 @@ describe('Container Subviews', function() { fetch({ published: true, published_on: 'Jul 01, 2014 at 12:45 UTC', published_by: 'amako' }); - expect(containerPage.$(lastPublishCss).text()). - toContain('Last published Jul 01, 2014 at 12:45 UTC by amako'); + expect(containerPage.$(lastPublishCss).text()) + .toContain('Last published Jul 01, 2014 at 12:45 UTC by amako'); }); it('renders correctly when the block is published without publish info', function() { diff --git a/cms/static/js/spec/views/xblock_validation_spec.js b/cms/static/js/spec/views/xblock_validation_spec.js index 577f16eeb6ac..16473b9debc4 100644 --- a/cms/static/js/spec/views/xblock_validation_spec.js +++ b/cms/static/js/spec/views/xblock_validation_spec.js @@ -110,8 +110,8 @@ define(['jquery', 'js/models/xblock_validation', 'js/views/xblock_validation', ' it('renders action info', function() { expect(view.$('a.edit-button .action-button-text').text()).toContain('Summary Action'); - expect(view.$('a.notification-action-button .action-button-text').text()). - toContain('First Message Action'); + expect(view.$('a.notification-action-button .action-button-text').text()) + .toContain('First Message Action'); expect(view.$('a.notification-action-button').data('notification-action')).toBe('fix-up'); }); diff --git a/common/static/js/spec/string_utils_spec.js b/common/static/js/spec/string_utils_spec.js index 81b4d9fa3ae3..8d4e7c51817e 100644 --- a/common/static/js/spec/string_utils_spec.js +++ b/common/static/js/spec/string_utils_spec.js @@ -1,15 +1,15 @@ describe('interpolate_ntext', function() { it('replaces placeholder values', function() { - expect(interpolate_ntext('contains {count} student', 'contains {count} students', 1, {count: 1})). - toBe('contains 1 student'); - expect(interpolate_ntext('contains {count} student', 'contains {count} students', 5, {count: 2})). - toBe('contains 2 students'); + expect(interpolate_ntext('contains {count} student', 'contains {count} students', 1, {count: 1})) + .toBe('contains 1 student'); + expect(interpolate_ntext('contains {count} student', 'contains {count} students', 5, {count: 2})) + .toBe('contains 2 students'); }); }); describe('interpolate_text', function() { it('replaces placeholder values', function() { - expect(interpolate_text('contains {adjective} students', {adjective: 'awesome'})). - toBe('contains awesome students'); + expect(interpolate_text('contains {adjective} students', {adjective: 'awesome'})) + .toBe('contains awesome students'); }); }); diff --git a/lms/static/js/course_survey.js b/lms/static/js/course_survey.js index aca7048d8345..c92d53e3cc01 100644 --- a/lms/static/js/course_survey.js +++ b/lms/static/js/course_survey.js @@ -49,9 +49,9 @@ $(function() { }); if (cancel_submit) { - $('.status.message.submission-error'). - removeClass('is-hidden'). - focus(); + $('.status.message.submission-error') + .removeClass('is-hidden') + .focus(); $('html, body').animate({scrollTop: 0}, 'fast'); return false; } @@ -72,10 +72,10 @@ $(function() { toggleSubmitButton(true); json = $.parseJSON(jqXHR.responseText); $('.status.message.submission-error').addClass('is-shown').focus(); - $('.status.message.submission-error .message-copy'). - text(gettext('There has been an error processing your survey.')). - stop(). - css('display', 'block'); + $('.status.message.submission-error .message-copy') + .text(gettext('There has been an error processing your survey.')) + .stop() + .css('display', 'block'); }); }); @@ -83,14 +83,14 @@ function toggleSubmitButton(enable) { var $submitButton = $('form .form-actions #submit'); if (enable) { - $submitButton. - removeClass('is-disabled'). - attr('aria-disabled', false). - removeProp('disabled'); + $submitButton + .removeClass('is-disabled') + .attr('aria-disabled', false) + .removeProp('disabled'); } else { - $submitButton. - addClass('is-disabled'). - attr('aria-disabled', true). - prop('disabled', true); + $submitButton + .addClass('is-disabled') + .attr('aria-disabled', true) + .prop('disabled', true); } } diff --git a/lms/static/js/instructor_dashboard/certificates.js b/lms/static/js/instructor_dashboard/certificates.js index fcc714d9104c..6fae4573de13 100644 --- a/lms/static/js/instructor_dashboard/certificates.js +++ b/lms/static/js/instructor_dashboard/certificates.js @@ -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'); } } }); diff --git a/lms/static/js/spec/groups/views/cohorts_spec.js b/lms/static/js/spec/groups/views/cohorts_spec.js index a0ae5c7fb433..5038750a066e 100644 --- a/lms/static/js/spec/groups/views/cohorts_spec.js +++ b/lms/static/js/spec/groups/views/cohorts_spec.js @@ -262,8 +262,8 @@ function(Backbone, $, AjaxHelpers, TemplateHelpers, CohortsView, CohortCollectio // But upload form should not be visible until toggle is clicked. expect(cohortsView.$(fileUploadFormCss).length).toBe(0); uploadCsvToggle = cohortsView.$('.toggle-cohort-management-secondary'); - expect(uploadCsvToggle.text()). - toContain('Assign learners to cohorts by uploading a CSV file'); + expect(uploadCsvToggle.text()) + .toContain('Assign learners to cohorts by uploading a CSV file'); uploadCsvToggle.click(); // After toggle is clicked, it should be hidden. expect(uploadCsvToggle).toHaveClass('hidden'); diff --git a/lms/static/js/spec/groups/views/discussions_spec.js b/lms/static/js/spec/groups/views/discussions_spec.js index 378a3c791390..ca872911427d 100644 --- a/lms/static/js/spec/groups/views/discussions_spec.js +++ b/lms/static/js/spec/groups/views/discussions_spec.js @@ -133,17 +133,17 @@ function(Backbone, $, AjaxHelpers, TemplateHelpers, DiscussionsView, CourseDiscu expect($inlineDiscussionsForm.length).toBe(1); expect($courseWideDiscussionsForm.length).toBe(1); - expect($courseWideDiscussionsForm.text()). - toContain('Course-Wide Discussion Topics'); - expect($courseWideDiscussionsForm.text()). - toContain('Select the course-wide discussion topics that you want to divide.'); + expect($courseWideDiscussionsForm.text()) + .toContain('Course-Wide Discussion Topics'); + expect($courseWideDiscussionsForm.text()) + .toContain('Select the course-wide discussion topics that you want to divide.'); // Should see the inline discussions form and its content expect($inlineDiscussionsForm.length).toBe(1); - expect($inlineDiscussionsForm.text()). - toContain('Content-Specific Discussion Topics'); - expect($inlineDiscussionsForm.text()). - toContain('Specify whether content-specific discussion topics are divided.'); + expect($inlineDiscussionsForm.text()) + .toContain('Content-Specific Discussion Topics'); + expect($inlineDiscussionsForm.text()) + .toContain('Specify whether content-specific discussion topics are divided.'); }; beforeEach(function() { diff --git a/lms/static/js/spec/instructor_dashboard/certificates_invalidation_spec.js b/lms/static/js/spec/instructor_dashboard/certificates_invalidation_spec.js index edd73a4c1a9b..bedb7c970aba 100644 --- a/lms/static/js/spec/instructor_dashboard/certificates_invalidation_spec.js +++ b/lms/static/js/spec/instructor_dashboard/certificates_invalidation_spec.js @@ -182,10 +182,10 @@ function($, AjaxHelpers, CertificateInvalidationModel, CertificateInvalidationVi view.collection.add(model); expect(view.$el.find('table tbody tr').length).toBe(3); - expect(view.$el.find('table tbody tr td:contains("' + user + '")').parent().html()). - toMatch(notes); - expect(view.$el.find('table tbody tr td:contains("' + user + '")').parent().html()). - toMatch(user); + expect(view.$el.find('table tbody tr td:contains("' + user + '")').parent().html()) + .toMatch(notes); + expect(view.$el.find('table tbody tr td:contains("' + user + '")').parent().html()) + .toMatch(user); // Remove a model from collection var collection_model = view.collection.get({id: 2}); diff --git a/openedx/features/course_bookmarks/static/course_bookmarks/js/spec_helpers/bookmark_helpers.js b/openedx/features/course_bookmarks/static/course_bookmarks/js/spec_helpers/bookmark_helpers.js index 094bd1ee9fd8..ac31730fbcd8 100644 --- a/openedx/features/course_bookmarks/static/course_bookmarks/js/spec_helpers/bookmark_helpers.js +++ b/openedx/features/course_bookmarks/static/course_bookmarks/js/spec_helpers/bookmark_helpers.js @@ -43,9 +43,9 @@ define( }; var breadcrumbTrail = function(path, unitDisplayName) { - return _.pluck(path, 'display_name'). - concat([unitDisplayName]). - join(' - '); + return _.pluck(path, 'display_name') + .concat([unitDisplayName]) + .join(' - '); }; var verifyBookmarkedData = function(view, expectedData) { diff --git a/xmodule/js/src/capa/display.js b/xmodule/js/src/capa/display.js index 8afe368d4239..cce976255b6d 100644 --- a/xmodule/js/src/capa/display.js +++ b/xmodule/js/src/capa/display.js @@ -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; } From 45f5fa3edc31aa43bc2b18841a28b5072eae5f28 Mon Sep 17 00:00:00 2001 From: Syed Ali Abbas Zaidi Date: Thu, 9 Mar 2023 16:14:24 +0500 Subject: [PATCH 14/30] fix: eslint quotes issue --- .../demographics_collection/DemographicsCollectionModal.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lms/static/js/demographics_collection/DemographicsCollectionModal.jsx b/lms/static/js/demographics_collection/DemographicsCollectionModal.jsx index 036062eca160..9d1e346437a0 100644 --- a/lms/static/js/demographics_collection/DemographicsCollectionModal.jsx +++ b/lms/static/js/demographics_collection/DemographicsCollectionModal.jsx @@ -1,14 +1,14 @@ /* global gettext */ import React from 'react'; import get from 'lodash/get'; -import Wizard from './Wizard'; import Cookies from 'js-cookie'; +import StringUtils from 'edx-ui-toolkit/js/utils/string-utils'; +import FocusLock from 'react-focus-lock'; +import Wizard from './Wizard'; import {SelectWithInput} from './SelectWithInput'; import {MultiselectDropdown} from './MultiselectDropdown'; import AxiosJwtTokenService from '../jwt_auth/AxiosJwtTokenService'; -import StringUtils from 'edx-ui-toolkit/js/utils/string-utils'; import AxiosCsrfTokenService from '../jwt_auth/AxiosCsrfTokenService'; -import FocusLock from 'react-focus-lock'; const FIELD_NAMES = { CURRENT_WORK: 'current_work_sector', From 3640611f15f24dd2c83c21c0e40676db88962ad5 Mon Sep 17 00:00:00 2001 From: Syed Ali Abbas Zaidi Date: Thu, 9 Mar 2023 16:18:32 +0500 Subject: [PATCH 15/30] fix: eslint quote props issue --- .../js/components/ExperimentalCarousel.jsx | 4 ++-- jest.config.js | 14 +++++++------- .../learner_analytics_dashboard/GradeTable.jsx | 16 ++++++++-------- .../announcements/jsx/Announcements.test.jsx | 2 +- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/common/static/common/js/components/ExperimentalCarousel.jsx b/common/static/common/js/components/ExperimentalCarousel.jsx index c976aac702d0..d56ce7a7f1f0 100644 --- a/common/static/common/js/components/ExperimentalCarousel.jsx +++ b/common/static/common/js/components/ExperimentalCarousel.jsx @@ -11,7 +11,7 @@ function NextArrow(props) { } = props; const showArrow = slideCount - currentSlide > displayedSlides; const opts = { - className: classNames('js-carousel-nav', 'carousel-arrow', 'next', 'btn btn-secondary', {'active': showArrow}), + className: classNames('js-carousel-nav', 'carousel-arrow', 'next', 'btn btn-secondary', {active: showArrow}), onClick }; @@ -32,7 +32,7 @@ function PrevArrow(props) { const {currentSlide, onClick} = props; const showArrow = currentSlide > 0; const opts = { - className: classNames('js-carousel-nav', 'carousel-arrow', 'prev', 'btn btn-secondary', {'active': showArrow}), + className: classNames('js-carousel-nav', 'carousel-arrow', 'prev', 'btn btn-secondary', {active: showArrow}), onClick }; diff --git a/jest.config.js b/jest.config.js index 57cc9f78d3ed..a4e84c23509e 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,17 +1,17 @@ module.exports = { - 'globals': { - 'gettext': (t) => t, + globals: { + gettext: (t) => t, }, - 'modulePaths': [ + modulePaths: [ 'common/static/common/js/components', ], - 'setupFilesAfterEnv': ['/setupTests.js'], - 'testMatch': [ + setupFilesAfterEnv: ['/setupTests.js'], + testMatch: [ '/**/*.test.jsx', 'common/static/common/js/components/**/?(*.)+(spec|test).js?(x)', ], - 'testEnvironment': 'jsdom', - 'transform': { + testEnvironment: 'jsdom', + transform: { '^.+\\.jsx$': 'babel-jest', '^.+\\.js$': 'babel-jest', }, diff --git a/lms/static/js/learner_analytics_dashboard/GradeTable.jsx b/lms/static/js/learner_analytics_dashboard/GradeTable.jsx index 114f513b640e..8e1aca7f03bf 100644 --- a/lms/static/js/learner_analytics_dashboard/GradeTable.jsx +++ b/lms/static/js/learner_analytics_dashboard/GradeTable.jsx @@ -3,18 +3,18 @@ import classNames from 'classnames'; import PropTypes from 'prop-types'; const exGrades = [ { - 'assignment_type':'Exam', - 'total_possible':6.0, - 'total_earned':3.0 + assignment_type: 'Exam', + total_possible: 6.0, + total_earned: 3.0 }, { - 'assignment_type':'Homework', - 'total_possible':5.0, + assignment_type: 'Homework', + total_possible: 5.0, }, { - 'assignment_type':'Homework', - 'total_possible':11.0, - 'total_earned':0.0 + assignment_type: 'Homework', + total_possible: 11.0, + total_earned: 0.0 } ]; diff --git a/openedx/features/announcements/static/announcements/jsx/Announcements.test.jsx b/openedx/features/announcements/static/announcements/jsx/Announcements.test.jsx index 737d533a449a..afcec6882b44 100644 --- a/openedx/features/announcements/static/announcements/jsx/Announcements.test.jsx +++ b/openedx/features/announcements/static/announcements/jsx/Announcements.test.jsx @@ -9,7 +9,7 @@ describe('Announcements component', () => { const component = renderer.create( , ); - component.root.instance.setState({'count': 10}); + component.root.instance.setState({count: 10}); const tree = component.toJSON(); expect(tree).toMatchSnapshot(); }); From 0aff1d3e921ce30f8481063834bf53c07623ce1b Mon Sep 17 00:00:00 2001 From: Syed Ali Abbas Zaidi Date: Thu, 9 Mar 2023 16:30:29 +0500 Subject: [PATCH 16/30] fix: eslint operator assignment issue --- common/static/common/js/discussion/content.js | 2 +- .../view/discussion_thread_profile_view_spec.js | 4 ++-- lms/static/js/Markdown.Editor.js | 16 ++++++++-------- lms/static/js/groups/views/cohort_editor.js | 1 + xmodule/js/src/time.js | 4 ++-- xmodule/js/src/video/06_video_progress_slider.js | 4 ++-- 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/common/static/common/js/discussion/content.js b/common/static/common/js/discussion/content.js index 905271358f29..71bc08f0db1e 100644 --- a/common/static/common/js/discussion/content.js +++ b/common/static/common/js/discussion/content.js @@ -208,7 +208,7 @@ Content.prototype.incrementVote = function(increment) { var newVotes; newVotes = _.clone(this.get('votes')); - newVotes.up_count = newVotes.up_count + increment; + newVotes.up_count += increment; return this.set('votes', newVotes); }; diff --git a/common/static/common/js/spec/discussion/view/discussion_thread_profile_view_spec.js b/common/static/common/js/spec/discussion/view/discussion_thread_profile_view_spec.js index fa1079c74717..c18e86df39b8 100644 --- a/common/static/common/js/spec/discussion/view/discussion_thread_profile_view_spec.js +++ b/common/static/common/js/spec/discussion/view/discussion_thread_profile_view_spec.js @@ -57,9 +57,9 @@ _ref >= 0 ? _i <= _ref : _i >= _ref; i = _ref >= 0 ? ++_i : --_i ) { - threadData.body = threadData.body + imageTag; + threadData.body += imageTag; if (i === 0) { - expectedHtml = expectedHtml + imageTag; + expectedHtml += imageTag; } else { expectedHtml = expectedHtml + 'image omitted'; } diff --git a/lms/static/js/Markdown.Editor.js b/lms/static/js/Markdown.Editor.js index f24f057a9205..2d8da0c5f51e 100644 --- a/lms/static/js/Markdown.Editor.js +++ b/lms/static/js/Markdown.Editor.js @@ -123,7 +123,7 @@ this.before = this.before.replace(regex, function(match) { - chunkObj.startTag = chunkObj.startTag + match; + chunkObj.startTag += match; return ''; }); @@ -131,7 +131,7 @@ this.selection = this.selection.replace(regex, function(match) { - chunkObj.startTag = chunkObj.startTag + match; + chunkObj.startTag += match; return ''; }); } @@ -194,14 +194,14 @@ this.selection = this.selection.replace(/(^\n*)/, ''); - this.startTag = this.startTag + re.$1; + this.startTag += re.$1; this.selection = this.selection.replace(/(\n*$)/, ''); - this.endTag = this.endTag + re.$1; + this.endTag += re.$1; this.startTag = this.startTag.replace(/(^\n*)/, ''); - this.before = this.before + re.$1; + this.before += re.$1; this.endTag = this.endTag.replace(/(\n*$)/, ''); - this.after = this.after + re.$1; + this.after += re.$1; if (this.before) { regexText = replacementText = ''; @@ -737,7 +737,7 @@ // Sets the TextareaState properties given a chunk of markdown. this.setChunks = function(chunk) { - chunk.before = chunk.before + chunk.startTag; + chunk.before += chunk.startTag; chunk.after = chunk.endTag + chunk.after; this.start = chunk.before.length; @@ -1572,7 +1572,7 @@ // Add the true markup. var markup = nStars <= 1 ? '*' : '**'; // shouldn't the test be = ? - chunk.before = chunk.before + markup; + chunk.before += markup; chunk.after = markup + chunk.after; } diff --git a/lms/static/js/groups/views/cohort_editor.js b/lms/static/js/groups/views/cohort_editor.js index 02878ab765f6..43de5a88fe9b 100644 --- a/lms/static/js/groups/views/cohort_editor.js +++ b/lms/static/js/groups/views/cohort_editor.js @@ -181,6 +181,7 @@ _.each(modifiedUsers.changed, function(changedInfo) { oldCohort = changedInfo.previous_cohort; if (oldCohort in movedByCohort) { + // eslint-disable-next-line operator-assignment movedByCohort[oldCohort] = movedByCohort[oldCohort] + 1; } else { movedByCohort[oldCohort] = 1; diff --git a/xmodule/js/src/time.js b/xmodule/js/src/time.js index 10e87ad30008..b4faec3ea0ae 100644 --- a/xmodule/js/src/time.js +++ b/xmodule/js/src/time.js @@ -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); diff --git a/xmodule/js/src/video/06_video_progress_slider.js b/xmodule/js/src/video/06_video_progress_slider.js index aba6a89bcb1a..c6e7228e308c 100644 --- a/xmodule/js/src/video/06_video_progress_slider.js +++ b/xmodule/js/src/video/06_video_progress_slider.js @@ -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') + ' ' From b9337ec7efd2c70a9f299d186f11f37dfe822fd7 Mon Sep 17 00:00:00 2001 From: Syed Ali Abbas Zaidi Date: Thu, 9 Mar 2023 16:38:28 +0500 Subject: [PATCH 17/30] fix: eslint new line after import issue --- cms/static/cms/js/spec/main_webpack.js | 1 + cms/static/karma_cms.conf.js | 1 + cms/static/karma_cms_squire.conf.js | 1 + cms/static/karma_cms_webpack.conf.js | 1 + common/static/common/js/karma.common.conf.js | 2 ++ common/static/karma_common.conf.js | 1 + common/static/karma_common_requirejs.conf.js | 1 + .../static/support/jsx/entitlements/data/reducers/form.js | 1 + lms/static/js/learner_analytics_dashboard/GradeTable.jsx | 1 + lms/static/karma_lms.conf.js | 1 + xmodule/js/karma_xmodule.conf.js | 1 + xmodule/js/karma_xmodule_webpack.conf.js | 1 + 12 files changed, 13 insertions(+) diff --git a/cms/static/cms/js/spec/main_webpack.js b/cms/static/cms/js/spec/main_webpack.js index 020b4d313f5c..801fb68b504c 100644 --- a/cms/static/cms/js/spec/main_webpack.js +++ b/cms/static/cms/js/spec/main_webpack.js @@ -12,6 +12,7 @@ import _ from 'underscore'; import str from 'underscore.string'; import HtmlUtils from 'edx-ui-toolkit/js/utils/html-utils'; import StringUtils from 'edx-ui-toolkit/js/utils/string-utils'; + window._ = _; window._.str = str; window.edx = window.edx || {}; diff --git a/cms/static/karma_cms.conf.js b/cms/static/karma_cms.conf.js index 16d2cc6f4cc5..6d6451ebd45c 100644 --- a/cms/static/karma_cms.conf.js +++ b/cms/static/karma_cms.conf.js @@ -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 = { diff --git a/cms/static/karma_cms_squire.conf.js b/cms/static/karma_cms_squire.conf.js index f8c0260fde7f..9a83a189be05 100644 --- a/cms/static/karma_cms_squire.conf.js +++ b/cms/static/karma_cms_squire.conf.js @@ -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 = { diff --git a/cms/static/karma_cms_webpack.conf.js b/cms/static/karma_cms_webpack.conf.js index 91650cc5b14f..60c228e36c09 100644 --- a/cms/static/karma_cms_webpack.conf.js +++ b/cms/static/karma_cms_webpack.conf.js @@ -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 = { diff --git a/common/static/common/js/karma.common.conf.js b/common/static/common/js/karma.common.conf.js index 41936aeb9bf5..6123b5a99d68 100644 --- a/common/static/common/js/karma.common.conf.js +++ b/common/static/common/js/karma.common.conf.js @@ -40,9 +40,11 @@ var path = require('path'); var _ = require('underscore'); + var appRoot = path.join(__dirname, '../../../../'); var webdriver = require('selenium-webdriver'); var firefox = require('selenium-webdriver/firefox'); + var webpackConfig = require(path.join(appRoot, 'webpack.dev.config.js')); // The following crazy bit is to work around the webpack.optimize.CommonsChunkPlugin diff --git a/common/static/karma_common.conf.js b/common/static/karma_common.conf.js index ef8244ff7839..93dbc183bdc8 100644 --- a/common/static/karma_common.conf.js +++ b/common/static/karma_common.conf.js @@ -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 = { diff --git a/common/static/karma_common_requirejs.conf.js b/common/static/karma_common_requirejs.conf.js index f407a548d02f..4a0a18b785bb 100644 --- a/common/static/karma_common_requirejs.conf.js +++ b/common/static/karma_common_requirejs.conf.js @@ -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 = { diff --git a/lms/djangoapps/support/static/support/jsx/entitlements/data/reducers/form.js b/lms/djangoapps/support/static/support/jsx/entitlements/data/reducers/form.js index b195b4ff025e..fd1e834b1772 100644 --- a/lms/djangoapps/support/static/support/jsx/entitlements/data/reducers/form.js +++ b/lms/djangoapps/support/static/support/jsx/entitlements/data/reducers/form.js @@ -1,5 +1,6 @@ import { formActions, entitlementActions } from '../constants/actionTypes'; import { formTypes } from '../constants/formTypes'; + const clearFormState = { formType: '', isOpen: false, diff --git a/lms/static/js/learner_analytics_dashboard/GradeTable.jsx b/lms/static/js/learner_analytics_dashboard/GradeTable.jsx index 8e1aca7f03bf..c34d02e554d1 100644 --- a/lms/static/js/learner_analytics_dashboard/GradeTable.jsx +++ b/lms/static/js/learner_analytics_dashboard/GradeTable.jsx @@ -1,6 +1,7 @@ import React from 'react'; import classNames from 'classnames'; import PropTypes from 'prop-types'; + const exGrades = [ { assignment_type: 'Exam', diff --git a/lms/static/karma_lms.conf.js b/lms/static/karma_lms.conf.js index a9827dbd8040..0119d4d18ca2 100644 --- a/lms/static/karma_lms.conf.js +++ b/lms/static/karma_lms.conf.js @@ -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 = { diff --git a/xmodule/js/karma_xmodule.conf.js b/xmodule/js/karma_xmodule.conf.js index 7d62917118a8..185e1e66883a 100644 --- a/xmodule/js/karma_xmodule.conf.js +++ b/xmodule/js/karma_xmodule.conf.js @@ -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 = { diff --git a/xmodule/js/karma_xmodule_webpack.conf.js b/xmodule/js/karma_xmodule_webpack.conf.js index c1a1e63830e1..e0abad75a8ba 100644 --- a/xmodule/js/karma_xmodule_webpack.conf.js +++ b/xmodule/js/karma_xmodule_webpack.conf.js @@ -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 = { From f641a0e6158524c664d15c4a967a012ce1c60038 Mon Sep 17 00:00:00 2001 From: Syed Ali Abbas Zaidi Date: Wed, 3 May 2023 18:11:26 +0500 Subject: [PATCH 18/30] fix: indent issues --- .../models/settings/course_grading_policy.js | 2 +- .../js/views/course_video_sharing_enable.js | 111 +++++++++--------- 2 files changed, 57 insertions(+), 56 deletions(-) diff --git a/cms/static/js/models/settings/course_grading_policy.js b/cms/static/js/models/settings/course_grading_policy.js index 498815cf1356..4ed105c7ee6f 100644 --- a/cms/static/js/models/settings/course_grading_policy.js +++ b/cms/static/js/models/settings/course_grading_policy.js @@ -10,7 +10,7 @@ define(['backbone', 'js/models/location', 'js/collections/course_grader', 'edx-u grace_period: null, // either null or { hours: n, minutes: m, ...} minimum_grade_credit: null, // either null or percentage assignment_count_info: [], // Object with keys mapping assignment type names to a list of - //assignment display names + // assignment display names }, parse: function(attributes) { if (attributes.graders) { diff --git a/cms/static/js/views/course_video_sharing_enable.js b/cms/static/js/views/course_video_sharing_enable.js index 8104141a1aa6..46bc7ba75902 100644 --- a/cms/static/js/views/course_video_sharing_enable.js +++ b/cms/static/js/views/course_video_sharing_enable.js @@ -1,66 +1,67 @@ define([ - "jquery", - "underscore", - "backbone", - "js/views/utils/xblock_utils", - "js/utils/templates", - "js/views/modals/course_outline_modals", - "edx-ui-toolkit/js/utils/html-utils", -], function ($, _, Backbone, XBlockViewUtils, TemplateUtils, CourseOutlineModalsFactory, HtmlUtils) { - "use strict"; - var CourseVideoSharingEnableView = Backbone.View.extend({ - events: { - "change #video-sharing-configuration-options": "handleVideoSharingConfigurationChange", - }, + 'jquery', + 'underscore', + 'backbone', + 'js/views/utils/xblock_utils', + 'js/utils/templates', + 'js/views/modals/course_outline_modals', + 'edx-ui-toolkit/js/utils/html-utils', +], function($, _, Backbone, XBlockViewUtils, TemplateUtils, CourseOutlineModalsFactory, HtmlUtils) { + 'use strict'; - initialize: function () { - this.template = TemplateUtils.loadTemplate("course-video-sharing-enable"); - }, + var CourseVideoSharingEnableView = Backbone.View.extend({ + events: { + 'change #video-sharing-configuration-options': 'handleVideoSharingConfigurationChange', + }, + + initialize: function() { + this.template = TemplateUtils.loadTemplate('course-video-sharing-enable'); + }, - getRequestData: function (value) { - return { - metadata: { - 'video_sharing_options': value, + getRequestData: function(value) { + return { + metadata: { + video_sharing_options: value, + }, + }; }, - }; - }, - handleVideoSharingConfigurationChange: function (event) { - if (event.type === "change") { - event.preventDefault(); - this.updateVideoSharingConfiguration(event.target.value); - this.trackVideoSharingConfigurationChange(event.target.value); - } - }, + handleVideoSharingConfigurationChange: function(event) { + if (event.type === 'change') { + event.preventDefault(); + this.updateVideoSharingConfiguration(event.target.value); + this.trackVideoSharingConfigurationChange(event.target.value); + } + }, - updateVideoSharingConfiguration: function (value) { - XBlockViewUtils.updateXBlockFields(this.model, this.getRequestData(value), { - success: this.refresh.bind(this) - }); - }, + updateVideoSharingConfiguration: function(value) { + XBlockViewUtils.updateXBlockFields(this.model, this.getRequestData(value), { + success: this.refresh.bind(this) + }); + }, - trackVideoSharingConfigurationChange: function (value) { - window.analytics.track( - 'edx.social.video_sharing_options.changed', - { - course_id: this.model.id, - video_sharing_options: value - } - ); - }, + trackVideoSharingConfigurationChange: function(value) { + window.analytics.track( + 'edx.social.video_sharing_options.changed', + { + course_id: this.model.id, + video_sharing_options: value + } + ); + }, - refresh: function () { - this.model.fetch({ - success: this.render.bind(this), - }); - }, + refresh: function() { + this.model.fetch({ + success: this.render.bind(this), + }); + }, - render: function () { - var html = this.template(this.model.attributes); - HtmlUtils.setHtml(this.$el, HtmlUtils.HTML(html)); - return this; - }, - }); + render: function() { + var html = this.template(this.model.attributes); + HtmlUtils.setHtml(this.$el, HtmlUtils.HTML(html)); + return this; + }, + }); - return CourseVideoSharingEnableView; + return CourseVideoSharingEnableView; }); From 89150306a1e9792d197bd5a5b3ba2576dc80b9e9 Mon Sep 17 00:00:00 2001 From: Syed Ali Abbas Zaidi Date: Thu, 4 May 2023 12:26:55 +0500 Subject: [PATCH 19/30] fix: operator assignment issue --- lms/static/js/groups/views/cohort_editor.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lms/static/js/groups/views/cohort_editor.js b/lms/static/js/groups/views/cohort_editor.js index 43de5a88fe9b..8421ced67b9d 100644 --- a/lms/static/js/groups/views/cohort_editor.js +++ b/lms/static/js/groups/views/cohort_editor.js @@ -181,8 +181,7 @@ _.each(modifiedUsers.changed, function(changedInfo) { oldCohort = changedInfo.previous_cohort; if (oldCohort in movedByCohort) { - // eslint-disable-next-line operator-assignment - movedByCohort[oldCohort] = movedByCohort[oldCohort] + 1; + movedByCohort[oldCohort] += 1; } else { movedByCohort[oldCohort] = 1; } From 30db206649d7ea6897c96b833ffebc16ce49f73f Mon Sep 17 00:00:00 2001 From: Syed Ali Abbas Zaidi Date: Thu, 4 May 2023 15:23:01 +0500 Subject: [PATCH 20/30] fix: all autofixable eslint issues --- cms/static/js/factories/container.js | 2 +- cms/static/js/factories/edit_tabs.js | 2 +- cms/static/js/factories/library.js | 2 +- cms/static/js/factories/textbooks.js | 2 +- cms/static/js/factories/xblock_validation.js | 2 +- .../spec/views/pages/course_outline_spec.js | 4 +- cms/static/js/views/settings/grading.js | 2 +- .../components/BlockBrowser/BlockBrowser.jsx | 4 +- .../BlockBrowser/data/api/client.js | 2 +- .../js/components/ExperimentalCarousel.jsx | 2 +- common/static/js/src/CookiePolicyBanner.jsx | 3 +- .../ProblemBrowser/components/Main/Main.jsx | 2 +- .../components/Main/MainContainer.jsx | 2 +- .../components/ReportStatus/ReportStatus.jsx | 2 +- .../ProblemBrowser/data/api/client.js | 6 +-- .../components/EntitlementForm/container.jsx | 4 +- .../components/EntitlementForm/index.jsx | 8 ++-- .../Table/EntitlementSupportTable.jsx | 2 +- .../entitlements/data/actions/entitlement.js | 2 +- .../jsx/entitlements/data/api/client.js | 10 ++-- .../jsx/entitlements/data/reducers/form.js | 4 +- .../support/jsx/program_enrollments/index.jsx | 2 +- .../jsx/program_enrollments/inspector.jsx | 6 +-- .../support/jsx/single_support_form.jsx | 2 +- .../support/static/support/jsx/success.jsx | 2 +- .../completion/js/CompletionOnViewService.js | 2 +- .../accessible_components/StatusBarAlert.jsx | 2 +- .../GradeTable.jsx | 4 +- .../LearnerAnalyticsDashboard.jsx | 2 +- .../EnterpriseLearnerPortalModal.jsx | 4 +- .../spec/course_enroll_view_spec.js | 2 +- .../spec/course_entitlement_view_spec.js | 4 +- .../views/collection_list_view.js | 2 +- .../views/program_details_view.js | 2 +- .../account_settings_factory_spec.js | 7 ++- .../account_settings_fields_helpers.js | 2 +- .../account_settings_fields_spec.js | 8 ++-- .../account_settings_view_spec.js | 4 +- .../views/account_section_view.js | 3 +- .../views/account_settings_factory.js | 47 ++++++++++--------- .../views/account_settings_fields.js | 41 +++++++++------- .../views/account_settings_view.js | 11 +++-- .../js/spec/Currency_spec.js | 12 ++--- .../js/learner_profile_factory.js | 14 +++--- .../js/spec/learner_profile_factory_spec.js | 1 - .../js/spec/views/badge_list_view_spec.js | 1 - .../spec/views/learner_profile_fields_spec.js | 27 ++++++----- .../spec/views/learner_profile_view_spec.js | 4 +- .../js/spec/views/section_two_tab_spec.js | 4 +- .../js/spec_helpers/helpers.js | 18 +++---- .../js/views/learner_profile_fields.js | 4 +- .../js/views/learner_profile_view.js | 26 +++++----- 52 files changed, 175 insertions(+), 164 deletions(-) diff --git a/cms/static/js/factories/container.js b/cms/static/js/factories/container.js index 892eb6196091..b98e0f99f286 100644 --- a/cms/static/js/factories/container.js +++ b/cms/static/js/factories/container.js @@ -21,6 +21,6 @@ export default function ContainerFactory(componentTemplates, XBlockInfoJson, act var view = new ContainerPage(_.extend(main_options, options)); view.render(); }); -}; +} export {ContainerFactory}; diff --git a/cms/static/js/factories/edit_tabs.js b/cms/static/js/factories/edit_tabs.js index 5ec459e52083..cd82fd2d913e 100644 --- a/cms/static/js/factories/edit_tabs.js +++ b/cms/static/js/factories/edit_tabs.js @@ -21,6 +21,6 @@ export default function EditTabsFactory(courseLocation, explicitUrl) { mast: $('.wrapper-mast') }); }); -}; +} export {EditTabsFactory}; diff --git a/cms/static/js/factories/library.js b/cms/static/js/factories/library.js index 0e72bdb4b44d..c104b3b049d9 100644 --- a/cms/static/js/factories/library.js +++ b/cms/static/js/factories/library.js @@ -24,6 +24,6 @@ export default function LibraryFactory(componentTemplates, XBlockInfoJson, optio var view = new PagedContainerPage(_.extend(main_options, options)); view.render(); }); -}; +} export {LibraryFactory}; diff --git a/cms/static/js/factories/textbooks.js b/cms/static/js/factories/textbooks.js index a257b368863a..4c2cec3130d1 100644 --- a/cms/static/js/factories/textbooks.js +++ b/cms/static/js/factories/textbooks.js @@ -19,6 +19,6 @@ export default function TextbooksFactory(textbooksJson) { return gettext('You have unsaved changes. Do you really want to leave this page?'); } }); -}; +} export {TextbooksFactory}; diff --git a/cms/static/js/factories/xblock_validation.js b/cms/static/js/factories/xblock_validation.js index 03bee7547cba..9936208626d0 100644 --- a/cms/static/js/factories/xblock_validation.js +++ b/cms/static/js/factories/xblock_validation.js @@ -16,6 +16,6 @@ export default function XBlockValidationFactory(validationMessages, hasEditingUr if (!model.get('empty')) { new XBlockValidationView({el: validationEle, model: model, root: isRoot}).render(); } -}; +} export {XBlockValidationFactory}; diff --git a/cms/static/js/spec/views/pages/course_outline_spec.js b/cms/static/js/spec/views/pages/course_outline_spec.js index 732bb6df319b..b32ab69dcd29 100644 --- a/cms/static/js/spec/views/pages/course_outline_spec.js +++ b/cms/static/js/spec/views/pages/course_outline_spec.js @@ -14,7 +14,7 @@ describe('CourseOutlinePage', function() { selectVisibilitySettings, selectDiscussionSettings, selectAdvancedSettings, createMockCourseJSON, createMockSectionJSON, createMockSubsectionJSON, verifyTypePublishable, mockCourseJSON, mockEmptyCourseJSON, setSelfPaced, setSelfPacedCustomPLS, mockSingleSectionCourseJSON, createMockVerticalJSON, createMockIndexJSON, mockCourseEntranceExamJSON, - selectOnboardingExam, createMockCourseJSONWithReviewRules,mockCourseJSONWithReviewRules, + selectOnboardingExam, createMockCourseJSONWithReviewRules, mockCourseJSONWithReviewRules, mockOutlinePage = readFixtures('templates/mock/mock-course-outline-page.underscore'), mockRerunNotification = readFixtures('templates/mock/mock-course-rerun-notification.underscore'); @@ -2295,7 +2295,7 @@ describe('CourseOutlinePage', function() { expectShowCorrectness('never'); }); - it ('does not show relative date input when assignment is not graded', function() { + it('does not show relative date input when assignment is not graded', function() { outlinePage.$('.outline-subsection .configure-button').click(); $('#grading_type').val('Lab').trigger('change'); $('#due_in').val('').trigger('change'); diff --git a/cms/static/js/views/settings/grading.js b/cms/static/js/views/settings/grading.js index fea7dd78e016..2148466a0ed6 100644 --- a/cms/static/js/views/settings/grading.js +++ b/cms/static/js/views/settings/grading.js @@ -75,7 +75,7 @@ function(ValidatingView, _, $, ui, GraderView, StringUtils, HtmlUtils) { this); gradeCollection.each(function(gradeModel) { var graderType = gradeModel.get('type'); - var graderTypeAssignmentList = self.courseAssignmentLists[graderType] + var graderTypeAssignmentList = self.courseAssignmentLists[graderType]; if (graderTypeAssignmentList === undefined) { graderTypeAssignmentList = []; } diff --git a/common/static/common/js/components/BlockBrowser/components/BlockBrowser/BlockBrowser.jsx b/common/static/common/js/components/BlockBrowser/components/BlockBrowser/BlockBrowser.jsx index 1a7d81f336b2..4cffc617a693 100644 --- a/common/static/common/js/components/BlockBrowser/components/BlockBrowser/BlockBrowser.jsx +++ b/common/static/common/js/components/BlockBrowser/components/BlockBrowser/BlockBrowser.jsx @@ -34,7 +34,7 @@ const BlockType = PropTypes.shape({ }); export const BlockList = ({ - blocks, selectedBlock, onSelectBlock, onChangeRoot + blocks, selectedBlock, onSelectBlock, onChangeRoot, }) => (
    diff --git a/common/static/common/js/components/ExperimentalCarousel.jsx b/common/static/common/js/components/ExperimentalCarousel.jsx index bed8a6f47108..6d99d6d468c1 100644 --- a/common/static/common/js/components/ExperimentalCarousel.jsx +++ b/common/static/common/js/components/ExperimentalCarousel.jsx @@ -22,8 +22,8 @@ function NextArrow(props) { return ( ); } @@ -41,10 +41,10 @@ function PrevArrow(props) { } return ( - ); } @@ -113,7 +113,7 @@ export default class ExperimentalCarousel extends React.Component { }; return ( - + {this.getCarouselContent()} ); diff --git a/lms/djangoapps/instructor/static/instructor/ProblemBrowser/components/Main/Main.test.jsx b/lms/djangoapps/instructor/static/instructor/ProblemBrowser/components/Main/Main.test.jsx index 00c6620dbc33..4cdcf049ca90 100644 --- a/lms/djangoapps/instructor/static/instructor/ProblemBrowser/components/Main/Main.test.jsx +++ b/lms/djangoapps/instructor/static/instructor/ProblemBrowser/components/Main/Main.test.jsx @@ -44,7 +44,7 @@ describe('ProblemBrowser Main component', () => { fetchCourseBlocks={jest.fn()} problemResponsesEndpoint={problemResponsesEndpoint} onSelectBlock={jest.fn()} - selectedBlock={'some-selected-block'} + selectedBlock="some-selected-block" taskStatusEndpoint={taskStatusEndpoint} /> , @@ -64,7 +64,7 @@ describe('ProblemBrowser Main component', () => { fetchCourseBlocks={fetchCourseBlocksMock} problemResponsesEndpoint={problemResponsesEndpoint} onSelectBlock={jest.fn()} - selectedBlock={'some-selected-block'} + selectedBlock="some-selected-block" taskStatusEndpoint={taskStatusEndpoint} /> , @@ -83,7 +83,7 @@ describe('ProblemBrowser Main component', () => { fetchCourseBlocks={jest.fn()} problemResponsesEndpoint={problemResponsesEndpoint} onSelectBlock={jest.fn()} - selectedBlock={'some-selected-block'} + selectedBlock="some-selected-block" taskStatusEndpoint={taskStatusEndpoint} />, ); diff --git a/lms/djangoapps/instructor/static/instructor/ProblemBrowser/components/ReportStatus/ReportStatus.jsx b/lms/djangoapps/instructor/static/instructor/ProblemBrowser/components/ReportStatus/ReportStatus.jsx index 49fbb3a034b3..2fd77939d191 100644 --- a/lms/djangoapps/instructor/static/instructor/ProblemBrowser/components/ReportStatus/ReportStatus.jsx +++ b/lms/djangoapps/instructor/static/instructor/ProblemBrowser/components/ReportStatus/ReportStatus.jsx @@ -41,7 +41,7 @@ const ReportStatus = ({ {succeeded && successMessage} ); -}; +} ReportStatus.propTypes = { error: PropTypes.string, diff --git a/lms/djangoapps/instructor/static/instructor/ProblemBrowser/components/ReportStatus/ReportStatus.test.jsx b/lms/djangoapps/instructor/static/instructor/ProblemBrowser/components/ReportStatus/ReportStatus.test.jsx index fd5b247b924e..a3d9e06356e8 100644 --- a/lms/djangoapps/instructor/static/instructor/ProblemBrowser/components/ReportStatus/ReportStatus.test.jsx +++ b/lms/djangoapps/instructor/static/instructor/ProblemBrowser/components/ReportStatus/ReportStatus.test.jsx @@ -23,8 +23,8 @@ describe('ReportStatus component', () => { , ); @@ -35,7 +35,7 @@ describe('ReportStatus component', () => { test('render error status', () => { const component = renderer.create( - ) - } + )}
    { diff --git a/lms/djangoapps/support/static/support/jsx/program_enrollments/inspector.jsx b/lms/djangoapps/support/static/support/jsx/program_enrollments/inspector.jsx index e9eb72d92566..0996b1205057 100644 --- a/lms/djangoapps/support/static/support/jsx/program_enrollments/inspector.jsx +++ b/lms/djangoapps/support/static/support/jsx/program_enrollments/inspector.jsx @@ -152,7 +152,7 @@ export const ProgramEnrollmentsInspectorPage = props => ( dialog={props.error} /> )} -