\n'
+ '
\n'
+ // eslint-disable-next-line no-template-curly-in-string
+ ' ${editor}\n'
+ '
\n'
+ '
Save\n'
@@ -73,6 +74,7 @@ describe('ModuleEdit', function() {
window.MockXBlock = function() {
return {};
};
+ // eslint-disable-next-line no-void
window.loadedXBlockResources = void 0;
this.moduleEdit.render();
return $.ajax.calls.mostRecent().args[0].success({
diff --git a/cms/static/js/spec/views/move_xblock_spec.js b/cms/static/js/spec/views/move_xblock_spec.js
index fa1eaba99b4..e32f8a043fc 100644
--- a/cms/static/js/spec/views/move_xblock_spec.js
+++ b/cms/static/js/spec/views/move_xblock_spec.js
@@ -12,6 +12,7 @@ import XBlockInfo from 'js/models/xblock_info';
import Course from 'js/models/course';
import 'mock-ajax';
+// eslint-disable-next-line padded-blocks
describe('MoveXBlock', function() {
'use strict';
@@ -396,6 +397,7 @@ describe('MoveXBlock', function() {
expectedData,
sourceIndex = sourceIndex || 0; // eslint-disable-line no-redeclare
+ // eslint-disable-next-line no-multi-assign
responseData = expectedData = {
move_source_locator: xblockLocator,
parent_locator: modal.targetParentXBlockInfo.id
diff --git a/cms/static/js/spec/views/pages/container_spec.js b/cms/static/js/spec/views/pages/container_spec.js
index 642d092de45..f84efdca89b 100644
--- a/cms/static/js/spec/views/pages/container_spec.js
+++ b/cms/static/js/spec/views/pages/container_spec.js
@@ -97,6 +97,7 @@ function parameterized_suite(label, globalPageOptions) {
AjaxHelpers.respondWithJson(requests, options || {});
};
+ // eslint-disable-next-line no-shadow
handleContainerPageRefresh = function(requests) {
var request = AjaxHelpers.currentRequest(requests);
expect(str.startsWith(request.url,
@@ -551,10 +552,12 @@ function parameterized_suite(label, globalPageOptions) {
describe('Previews', function() {
var getButtonIcon, getButtonText;
+ // eslint-disable-next-line no-shadow
getButtonIcon = function(containerPage) {
return containerPage.$('.action-toggle-preview .fa');
};
+ // eslint-disable-next-line no-shadow
getButtonText = function(containerPage) {
return containerPage.$('.action-toggle-preview .preview-text').text().trim();
};
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 195e5702d09..ed1124d4658 100644
--- a/cms/static/js/spec/views/pages/course_outline_spec.js
+++ b/cms/static/js/spec/views/pages/course_outline_spec.js
@@ -241,6 +241,7 @@ describe('CourseOutlinePage', function() {
};
it('can be published', function() {
+ // eslint-disable-next-line no-shadow
var mockCourseJSON = getMockCourseJSON({
has_changes: true
});
@@ -256,6 +257,7 @@ describe('CourseOutlinePage', function() {
});
it('should show publish button if it is not published and not changed', function() {
+ // eslint-disable-next-line no-shadow
var mockCourseJSON = getMockCourseJSON({
has_changes: false,
published: false
@@ -264,6 +266,7 @@ describe('CourseOutlinePage', function() {
});
it('should show publish button if it is published and changed', function() {
+ // eslint-disable-next-line no-shadow
var mockCourseJSON = getMockCourseJSON({
has_changes: true,
published: true
@@ -272,6 +275,7 @@ describe('CourseOutlinePage', function() {
});
it('should show publish button if it is not published, but changed', function() {
+ // eslint-disable-next-line no-shadow
var mockCourseJSON = getMockCourseJSON({
has_changes: true,
published: false
@@ -280,6 +284,7 @@ describe('CourseOutlinePage', function() {
});
it('should hide publish button if it is not changed, but published', function() {
+ // eslint-disable-next-line no-shadow
var mockCourseJSON = getMockCourseJSON({
has_changes: false,
published: true
@@ -589,6 +594,7 @@ describe('CourseOutlinePage', function() {
setSelfPaced();
});
+ // eslint-disable-next-line prefer-const
createCourse = function(sectionOptions, courseOptions) {
createCourseOutlinePage(this,
createMockCourseJSON(courseOptions, [
@@ -597,14 +603,17 @@ describe('CourseOutlinePage', function() {
);
};
+ // eslint-disable-next-line prefer-const
createCourseWithHighlights = function(highlights) {
createCourse({highlights: highlights});
};
+ // eslint-disable-next-line prefer-const
clickSaveOnModal = function() {
$('.wrapper-modal-window .action-save').click();
};
+ // eslint-disable-next-line prefer-const
clickCancelOnModal = function() {
$('.wrapper-modal-window .action-cancel').click();
};
@@ -1043,6 +1052,7 @@ describe('CourseOutlinePage', function() {
});
it('can display a publish modal with a list of unpublished subsections and units', function() {
+ // eslint-disable-next-line no-shadow
var mockCourseJSON = createMockCourseJSON({}, [
createMockSectionJSON({has_changes: true}, [
createMockSubsectionJSON({has_changes: true}, [
@@ -1319,6 +1329,7 @@ describe('CourseOutlinePage', function() {
});
it('can show correct editors for self_paced course', function() {
+ // eslint-disable-next-line no-shadow
var mockCourseJSON = createMockCourseJSON({}, [
createMockSectionJSON({}, [
createMockSubsectionJSON({}, [])
@@ -2166,6 +2177,7 @@ describe('CourseOutlinePage', function() {
});
it('can display a publish modal with a list of unpublished units', function() {
+ // eslint-disable-next-line no-shadow
var mockCourseJSON = createMockCourseJSON({}, [
createMockSectionJSON({has_changes: true}, [
createMockSubsectionJSON({has_changes: true}, [
@@ -2193,6 +2205,7 @@ describe('CourseOutlinePage', function() {
describe('Self Paced with Custom Personalized Learner Schedules (PLS)', function() {
beforeEach(function() {
+ // eslint-disable-next-line no-shadow
var mockCourseJSON = createMockCourseJSON({}, [
createMockSectionJSON({}, [
createMockSubsectionJSON({}, [])
diff --git a/cms/static/js/spec/views/xblock_editor_spec.js b/cms/static/js/spec/views/xblock_editor_spec.js
index 00ed6c98544..5791572ddde 100644
--- a/cms/static/js/spec/views/xblock_editor_spec.js
+++ b/cms/static/js/spec/views/xblock_editor_spec.js
@@ -98,6 +98,7 @@ describe('XBlockEditorView', function() {
it('can render a module with only settings', function() {
var requests = AjaxHelpers.requests(this),
+ // eslint-disable-next-line no-shadow
mockXModuleEditorHtml;
mockXModuleEditorHtml = readFixtures('templates/mock/mock-xmodule-settings-only-editor.underscore');
diff --git a/cms/static/js/spec_helpers/edit_helpers.js b/cms/static/js/spec_helpers/edit_helpers.js
index 0fa81b1e5a0..acfdeff3234 100644
--- a/cms/static/js/spec_helpers/edit_helpers.js
+++ b/cms/static/js/spec_helpers/edit_helpers.js
@@ -12,6 +12,7 @@ import XModule from 'xmodule/js/src/xmodule';
import 'cms/js/main';
import 'xblock/cms.runtime.v1';
+// eslint-disable-next-line import/no-mutable-exports
var installMockXBlock, uninstallMockXBlock, installMockXModule, uninstallMockXModule,
mockComponentTemplates, installEditTemplates, showEditModal, verifyXBlockRequest;
@@ -116,6 +117,7 @@ verifyXBlockRequest = function(requests, expectedJson) {
expect(actualJson).toEqual(expectedJson);
};
+// eslint-disable-next-line import/no-mutable-exports
var editHelpers = $.extend(modal_helpers, {
installMockXBlock: installMockXBlock,
uninstallMockXBlock: uninstallMockXBlock,
diff --git a/cms/static/js/utils/drag_and_drop.js b/cms/static/js/utils/drag_and_drop.js
index 88c1301999c..900523d3709 100644
--- a/cms/static/js/utils/drag_and_drop.js
+++ b/cms/static/js/utils/drag_and_drop.js
@@ -287,6 +287,7 @@ function($, ui, _, gettext, Draggabilly, ModuleUtils, NotificationView) {
oldParentLocator = element.data('parent'),
oldParentEle, saving, refreshParent;
+ // eslint-disable-next-line no-shadow
refreshParent = function(element) {
var refresh = element.data('refresh');
// If drop was into a collapsed parent, the parent will have been
diff --git a/cms/static/js/utils/handle_iframe_binding.js b/cms/static/js/utils/handle_iframe_binding.js
index b4527afd85d..b7e904c47db 100644
--- a/cms/static/js/utils/handle_iframe_binding.js
+++ b/cms/static/js/utils/handle_iframe_binding.js
@@ -33,6 +33,7 @@ define(['jquery'], function($) {
// The TinyMCE editor is hosted in an iframe, and before the iframe is
// removed we execute this code. To avoid throwing an error when setting the
// attr, check that the source doesn't start with the value specified by TinyMCE ('javascript:""').
+ // eslint-disable-next-line no-script-url
else if (ifr_source.lastIndexOf('javascript:', 0) !== 0) {
$(this).attr('src', ifr_source + '?' + wmode);
}
diff --git a/cms/static/js/views/assets.js b/cms/static/js/views/assets.js
index 5aaccda82f9..6d480641879 100644
--- a/cms/static/js/views/assets.js
+++ b/cms/static/js/views/assets.js
@@ -183,15 +183,18 @@ function($, _, gettext, HtmlUtils, BaseView, AssetModel, PagingView, AssetView,
type: 'POST',
maxChunkSize: self.uploadChunkSizeInBytes,
autoUpload: true,
+ // eslint-disable-next-line no-shadow
progressall: function(event, data) {
var percentComplete = parseInt((100 * data.loaded) / data.total, 10);
self.showUploadFeedback(event, percentComplete);
},
maxFileSize: self.maxFileSizeInBytes,
maxNumberofFiles: 100,
+ // eslint-disable-next-line no-shadow
done: function(event, data) {
self.displayFinishedUpload(data.result);
},
+ // eslint-disable-next-line no-shadow
processfail: function(event, data) {
var filename = data.files[data.index].name;
var error = gettext('File {filename} exceeds maximum size of {maxFileSizeInMBs} MB')
@@ -216,6 +219,7 @@ function($, _, gettext, HtmlUtils, BaseView, AssetModel, PagingView, AssetView,
msg: gettext('Max file size exceeded')
});
},
+ // eslint-disable-next-line no-shadow
processdone: function(event, data) {
self.largeFileErrorMsg = null;
}
diff --git a/cms/static/js/views/baseview.js b/cms/static/js/views/baseview.js
index c7da2bac660..3893269e6fb 100644
--- a/cms/static/js/views/baseview.js
+++ b/cms/static/js/views/baseview.js
@@ -38,6 +38,7 @@ function($, _, Backbone, gettext, IframeUtils, TemplateUtils, ViewUtils) {
if (!Math.trunc) {
Math.trunc = function(v) {
v = +v; // eslint-disable-line no-param-reassign
+ // eslint-disable-next-line no-mixed-operators, no-nested-ternary
return (v - v % 1) || (!isFinite(v) || v === 0 ? v : v < 0 ? -0 : 0);
};
}
@@ -45,7 +46,7 @@ function($, _, Backbone, gettext, IframeUtils, TemplateUtils, ViewUtils) {
var _this = this;
// xss-lint: disable=javascript-jquery-insertion
- this.render = _.wrap(this.render, function(render, options) {
+ this.render = _.wrap(this.render, function(render, options) { // eslint-disable-line no-shadow
_this.beforeRender();
render(options);
_this.afterRender();
diff --git a/cms/static/js/views/course_info_edit.js b/cms/static/js/views/course_info_edit.js
index aab15d4f91f..840ebf8939b 100644
--- a/cms/static/js/views/course_info_edit.js
+++ b/cms/static/js/views/course_info_edit.js
@@ -12,12 +12,14 @@ define(['js/views/baseview', 'js/views/course_info_update', 'js/views/course_inf
render: function() {
// instantiate the ClassInfoUpdateView and delegate the proper dom to it
+ // eslint-disable-next-line no-new
new CourseInfoUpdateView({
el: $('body.updates'),
collection: this.model.get('updates'),
base_asset_url: this.model.get('base_asset_url')
});
+ // eslint-disable-next-line no-new
new CourseInfoHandoutView({
el: this.$('#course-handouts-view'),
model: this.model.get('handouts'),
diff --git a/cms/static/js/views/course_outline.js b/cms/static/js/views/course_outline.js
index 3eeeff5b1e0..72647d3edb5 100644
--- a/cms/static/js/views/course_outline.js
+++ b/cms/static/js/views/course_outline.js
@@ -48,6 +48,7 @@ function(
refresh: function(viewState) {
var getViewToRefresh, view, expandedLocators;
+ // eslint-disable-next-line no-shadow
getViewToRefresh = function(view) {
if (view.model.isChapter() || !view.parentView) {
return view;
diff --git a/cms/static/js/views/course_video_settings.js b/cms/static/js/views/course_video_settings.js
index 4fe5586e120..265efa45cf8 100644
--- a/cms/static/js/views/course_video_settings.js
+++ b/cms/static/js/views/course_video_settings.js
@@ -153,6 +153,7 @@ function($, Backbone, _, gettext, moment, ViewUtils, HtmlUtils, StringUtils, Tra
this.clearPreferenceErrorState($fidelityContainer);
// Clear active and selected languages.
+ // eslint-disable-next-line no-multi-assign
this.selectedLanguages = this.activeLanguages = [];
// Also clear selected language.
this.selectedVideoSourceLanguage = '';
@@ -167,6 +168,7 @@ function($, Backbone, _, gettext, moment, ViewUtils, HtmlUtils, StringUtils, Tra
this.clearPreferenceErrorState($videoSourceLanguageContainer);
// Clear active and selected languages.
+ // eslint-disable-next-line no-multi-assign
this.selectedLanguages = this.activeLanguages = [];
this.renderTargetLanguages();
},
@@ -236,6 +238,7 @@ function($, Backbone, _, gettext, moment, ViewUtils, HtmlUtils, StringUtils, Tra
$(event.target.parentElement).parent().remove();
// Remove language from selected languages.
+ // eslint-disable-next-line no-multi-assign
this.selectedLanguages = this.activeLanguages = _.without(this.selectedLanguages, selectedLanguage);
// Populate menu again to reflect latest changes.
diff --git a/cms/static/js/views/list.js b/cms/static/js/views/list.js
index 714eb5f10a1..4d411845242 100644
--- a/cms/static/js/views/list.js
+++ b/cms/static/js/views/list.js
@@ -50,6 +50,7 @@ define([
});
edx.HtmlUtils.setHtml(this.$el, edx.HtmlUtils.HTML(template));
+ // eslint-disable-next-line no-shadow
this.collection.each(function(model) {
this.$(this.listContainerCss).append(
this.createItemView({model: model, restrictEditing: this.restrictEditing}).render().el
diff --git a/cms/static/js/views/manage_users_and_roles.js b/cms/static/js/views/manage_users_and_roles.js
index fd34945c67b..e83453a62b0 100644
--- a/cms/static/js/views/manage_users_and_roles.js
+++ b/cms/static/js/views/manage_users_and_roles.js
@@ -105,6 +105,7 @@ function($, _, gettext, BaseView, PromptView, ViewUtils, HtmlUtils) {
var role_name = self.options.roles[i].key;
var role_selector = 'click .user-actions .make-' + role_name;
+ // eslint-disable-next-line no-loop-func
(function(role) {
roleEvents[role_selector] = function(event) { self.handleRoleButtonClick(event.target, role); };
}(role_name));
@@ -169,6 +170,7 @@ function($, _, gettext, BaseView, PromptView, ViewUtils, HtmlUtils) {
getPossibleRoleChangesForRole: function(role, adminRoleCount) {
var result = [],
+ // eslint-disable-next-line no-shadow
role_names = _.map(this.roles, function(role) { return role.key; });
if (role === this.admin_role.key && adminRoleCount === 1) {
result.push({notoggle: true});
@@ -177,6 +179,7 @@ function($, _, gettext, BaseView, PromptView, ViewUtils, HtmlUtils) {
// in reverse order to show "Add" buttons to the left, "Remove" to the right
for (var i = this.roles.length - 1; i >= 0; i--) {
var other_role = this.roles[i];
+ // eslint-disable-next-line no-continue
if (Math.abs(currentRoleIdx - i) !== 1) { continue; } // allows moving only to adjacent roles
result.push({
to_role: other_role.key,
diff --git a/cms/static/js/views/metadata.js b/cms/static/js/views/metadata.js
index 3c5fa598117..1dda68b3094 100644
--- a/cms/static/js/views/metadata.js
+++ b/cms/static/js/views/metadata.js
@@ -189,6 +189,7 @@ define(
this.max = Number(options[max]);
this.$el.find('input').attr(max, numToString(this.max));
}
+ // eslint-disable-next-line no-undef-init
var stepValue = undefined;
if (options.hasOwnProperty(step)) {
// Parse step and convert to String. Polyfill doesn't like float values like ".1" (expects "0.1").
@@ -234,7 +235,9 @@ define(
// This first filtering if statement is take from polyfill to prevent
// non-numeric input (for browsers that don't use polyfill because they DO have a number input type).
var _ref, _ref1;
+ // eslint-disable-next-line no-cond-assign
if (((_ref = e.keyCode) !== 8 && _ref !== 9 && _ref !== 35 && _ref !== 36 && _ref !== 37 && _ref !== 39)
+ // eslint-disable-next-line no-cond-assign
&& ((_ref1 = e.which) !== 45 && _ref1 !== 46 && _ref1 !== 48 && _ref1 !== 49 && _ref1 !== 50 && _ref1 !== 51
&& _ref1 !== 52 && _ref1 !== 53 && _ref1 !== 54 && _ref1 !== 55 && _ref1 !== 56 && _ref1 !== 57)) {
e.preventDefault();
@@ -444,6 +447,7 @@ define(
}).reverse();
seconds = _.reduce(list, function(memo, num, index) {
+ // eslint-disable-next-line prefer-exponentiation-operator, no-restricted-properties
return memo + num * Math.pow(60, index);
}, 0);
@@ -515,6 +519,7 @@ define(
var list = this.$el.find('ol'),
frag = document.createDocumentFragment();
+ // eslint-disable-next-line no-shadow
_.each(value, function(value, key) {
var template = _.template(
HtmlUtils.joinHtml(
diff --git a/cms/static/js/views/modals/course_outline_modals.js b/cms/static/js/views/modals/course_outline_modals.js
index 492bd4b7d0b..d00af0a537f 100644
--- a/cms/static/js/views/modals/course_outline_modals.js
+++ b/cms/static/js/views/modals/course_outline_modals.js
@@ -133,6 +133,7 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
tabsTemplate = this.loadTemplate('settings-modal-tabs');
HtmlUtils.setHtml(this.$('.modal-section'), HtmlUtils.HTML(tabsTemplate({tabs: tabs})));
_.each(this.options.tabs, function(tab) {
+ // eslint-disable-next-line prefer-spread
this.options.editors.push.apply(
this.options.editors,
_.map(tab.editors, function(Editor) {
@@ -606,6 +607,7 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
this.$('.field-exam-review-rules textarea').val(value);
},
isValidTimeLimit: function(timeLimit) {
+ // eslint-disable-next-line prefer-regex-literals
var pattern = new RegExp('^\\d{1,2}:[0-5][0-9]$');
return pattern.test(timeLimit) && timeLimit !== '00:00';
},
@@ -948,6 +950,7 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
} else {
$('.un-published-tip').show();
}
+ // eslint-disable-next-line prefer-const
let enabledForGraded = course.get('discussions_settings').enable_graded_units;
if (this.model.get('graded') && !enabledForGraded) {
$('#discussion_enabled').prop('disabled', true);
@@ -1032,6 +1035,7 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
} else {
display = 'none';
}
+ // eslint-disable-next-line no-shadow
$.each(warning, function(_, element) {
element.style.display = display;
});
diff --git a/cms/static/js/views/module_edit.js b/cms/static/js/views/module_edit.js
index fe3bba58212..f58f02a9c94 100644
--- a/cms/static/js/views/module_edit.js
+++ b/cms/static/js/views/module_edit.js
@@ -23,6 +23,7 @@
var ModuleEdit = (function(_super) {
__extends(ModuleEdit, _super);
+ // eslint-disable-next-line no-shadow
function ModuleEdit() {
return ModuleEdit.__super__.constructor.apply(this, arguments);
}
diff --git a/cms/static/js/views/pages/course_outline.js b/cms/static/js/views/pages/course_outline.js
index 31227f4aa1d..1d10fb63752 100644
--- a/cms/static/js/views/pages/course_outline.js
+++ b/cms/static/js/views/pages/course_outline.js
@@ -66,6 +66,7 @@ function($, _, gettext, BasePage, XBlockViewUtils, CourseOutlineView, ViewUtils,
},
renderPage: function() {
+ // eslint-disable-next-line no-shadow
var setInitialExpandState = function(xblockInfo, expandedLocators) {
if (xblockInfo.isCourse() || xblockInfo.isChapter()) {
expandedLocators.add(xblockInfo.get('id'));
diff --git a/cms/static/js/views/settings/advanced.js b/cms/static/js/views/settings/advanced.js
index 0a3eaf82ae3..14f054bb37c 100644
--- a/cms/static/js/views/settings/advanced.js
+++ b/cms/static/js/views/settings/advanced.js
@@ -82,6 +82,7 @@ function(ValidatingView, $, _, gettext, CodeMirror, ValidationErrorModal, HtmlUt
var stringValue = $.trim(mirror.getValue());
// update CodeMirror to show the trimmed value.
mirror.setValue(stringValue);
+ // eslint-disable-next-line no-undef-init
var JSONValue = undefined;
try {
JSONValue = JSON.parse(stringValue);
diff --git a/cms/static/js/views/settings/grading.js b/cms/static/js/views/settings/grading.js
index 2148466a0ed..ac4d170352a 100644
--- a/cms/static/js/views/settings/grading.js
+++ b/cms/static/js/views/settings/grading.js
@@ -229,6 +229,7 @@ function(ValidatingView, _, $, ui, GraderView, StringUtils, HtmlUtils) {
// set min/max widths
var cachethis = this;
var widthPerPoint = cachethis.gradeBarWidth / 100;
+ // eslint-disable-next-line no-shadow
return function(event, ui) {
var barIndex = ui.element.index();
var offset = 1;
@@ -245,6 +246,7 @@ function(ValidatingView, _, $, ui, GraderView, StringUtils, HtmlUtils) {
moveBarClosure: function() {
// 0th ele doesn't have a bar; so, will never invoke this
var cachethis = this;
+ // eslint-disable-next-line no-shadow
return function(event, ui) {
var barIndex = ui.element.index();
var offset = 1;
@@ -254,6 +256,7 @@ function(ValidatingView, _, $, ui, GraderView, StringUtils, HtmlUtils) {
: offset);
// minus 2 b/c minus 1 is the element we're effecting. It's max is just shy of the next one above it
var max = (barIndex >= 2 ? cachethis.descendingCutoffs[barIndex - 2].cutoff - offset : 100);
+ // eslint-disable-next-line no-mixed-operators
var percentage = Math.min(Math.max(ui.size.width / cachethis.gradeBarWidth * 100, min), max);
cachethis.descendingCutoffs[barIndex - 1].cutoff = Math.round(percentage);
cachethis.renderGradeRanges();
@@ -272,6 +275,7 @@ function(ValidatingView, _, $, ui, GraderView, StringUtils, HtmlUtils) {
stopDragClosure: function() {
var cachethis = this;
+ // eslint-disable-next-line no-shadow
return function(event, ui) {
// for some reason the resize is setting height to 0
cachethis.saveCutoffs();
@@ -388,6 +392,7 @@ function(ValidatingView, _, $, ui, GraderView, StringUtils, HtmlUtils) {
// Instrument grading scale
// convert cutoffs to inversely ordered list
var modelCutoffs = this.model.get('grade_cutoffs');
+ // eslint-disable-next-line guard-for-in
for (var cutoff in modelCutoffs) {
this.descendingCutoffs.push({designation: cutoff, cutoff: Math.round(modelCutoffs[cutoff] * 100)});
}
diff --git a/cms/static/js/views/settings/main.js b/cms/static/js/views/settings/main.js
index ef728b616c8..4f3bf0bb273 100644
--- a/cms/static/js/views/settings/main.js
+++ b/cms/static/js/views/settings/main.js
@@ -391,8 +391,11 @@ function(ValidatingView, CodeMirror, _, $, ui, DateUtils, FileUploadModel,
if (!this.useV2CertDisplaySettings) {
return;
}
+ // eslint-disable-next-line prefer-const
let showDatepicker = this.model.get('certificates_display_behavior') == 'end_with_date';
+ // eslint-disable-next-line prefer-const
let datepicker = this.$el.find('#certificate-available-date');
+ // eslint-disable-next-line prefer-const
let certificateAvailableDateField = this.$el.find('#field-certificate-available-date');
if (showDatepicker) {
@@ -451,6 +454,7 @@ function(ValidatingView, CodeMirror, _, $, ui, DateUtils, FileUploadModel,
selector = '',
image_key = '',
image_path_key = '';
+ // eslint-disable-next-line default-case
switch (event.currentTarget.id) {
case 'upload-course-image':
title = gettext('Upload your course image.');
diff --git a/cms/static/js/views/tabs.js b/cms/static/js/views/tabs.js
index 70be63f9257..129bec4d2b4 100644
--- a/cms/static/js/views/tabs.js
+++ b/cms/static/js/views/tabs.js
@@ -28,6 +28,7 @@
TabsEdit = (function(_super) {
__extends(TabsEdit, _super);
+ // eslint-disable-next-line no-shadow
function TabsEdit() {
var self = this;
this.deleteTab = function() {
diff --git a/cms/static/js/views/utils/create_library_utils.js b/cms/static/js/views/utils/create_library_utils.js
index 3b8782f152c..ad32a9e0afd 100644
--- a/cms/static/js/views/utils/create_library_utils.js
+++ b/cms/static/js/views/utils/create_library_utils.js
@@ -27,6 +27,7 @@ define(['jquery', 'gettext', 'common/js/components/utils/view_utils', 'js/views/
if (detailedReason) {
reason = detailedReason;
}
+ // eslint-disable-next-line no-empty
} catch (e) {}
}
errorHandler(reason);
diff --git a/cms/static/js/views/validation.js b/cms/static/js/views/validation.js
index 1cc8635ffb3..e193294ddd2 100644
--- a/cms/static/js/views/validation.js
+++ b/cms/static/js/views/validation.js
@@ -37,6 +37,7 @@ function(HtmlUtils, BaseView, _, $, gettext, NotificationView, AlertView) {
handleValidationError: function(model, error) {
this.clearValidationErrors();
// error is object w/ fields and error strings
+ // eslint-disable-next-line guard-for-in
for (var field in error) {
var ele = this.$el.find('#' + this.fieldToSelectorMap[field]);
this._cacheValidationErrors.push(ele);
diff --git a/cms/static/js/views/video/transcripts/file_uploader.js b/cms/static/js/views/video/transcripts/file_uploader.js
index 5c635fdc4db..e1fba9a9a8d 100644
--- a/cms/static/js/views/video/transcripts/file_uploader.js
+++ b/cms/static/js/views/video/transcripts/file_uploader.js
@@ -130,6 +130,7 @@ define(
checkExtValidity: function(file) {
var fileExtension;
if (!file.name) {
+ // eslint-disable-next-line no-void
return void 0;
}
diff --git a/cms/static/js/views/video/transcripts/metadata_videolist.js b/cms/static/js/views/video/transcripts/metadata_videolist.js
index 1cbf37467db..961e9fd2590 100644
--- a/cms/static/js/views/video/transcripts/metadata_videolist.js
+++ b/cms/static/js/views/video/transcripts/metadata_videolist.js
@@ -223,8 +223,10 @@ define(
}
if (this.$extraVideosBar.hasClass('is-visible')) {
+ // eslint-disable-next-line prefer-spread
this.closeExtraVideosBar.apply(this, arguments);
} else {
+ // eslint-disable-next-line prefer-spread
this.openExtraVideosBar.apply(this, arguments);
}
},
diff --git a/cms/static/js/views/video/transcripts/utils.js b/cms/static/js/views/video/transcripts/utils.js
index fae39400bd6..e339626eb91 100644
--- a/cms/static/js/views/video/transcripts/utils.js
+++ b/cms/static/js/views/video/transcripts/utils.js
@@ -84,6 +84,7 @@ define(['jquery', 'underscore', 'jquery.ajaxQueue'], function($) {
return function(url) {
if (typeof url !== 'string') {
+ // eslint-disable-next-line no-void
return void 0;
}
@@ -92,6 +93,7 @@ define(['jquery', 'underscore', 'jquery.ajaxQueue'], function($) {
}
var match = url.match(regExp);
+ // eslint-disable-next-line no-void
cache[url] = (match) ? match[1] : void 0;
return cache[url];
@@ -114,6 +116,7 @@ define(['jquery', 'underscore', 'jquery.ajaxQueue'], function($) {
return function(url) {
if (typeof url !== 'string') {
+ // eslint-disable-next-line no-void
return void 0;
}
@@ -169,6 +172,7 @@ define(['jquery', 'underscore', 'jquery.ajaxQueue'], function($) {
result;
if (typeof url !== 'string') {
+ // eslint-disable-next-line no-void
return void 0;
}
diff --git a/cms/static/js/views/video/translations_editor.js b/cms/static/js/views/video/translations_editor.js
index 89df139e7b9..26d0ee23909 100644
--- a/cms/static/js/views/video/translations_editor.js
+++ b/cms/static/js/views/video/translations_editor.js
@@ -56,6 +56,7 @@ define(
getDropdown: (function() {
var dropdown,
disableOptions = function(element, values) {
+ // eslint-disable-next-line no-shadow
var dropdown = $(element).clone();
_.each(values, function(value, key) {
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 9012703ce8a..2433db20d7a 100644
--- a/common/static/common/js/components/BlockBrowser/components/BlockBrowser/BlockBrowser.jsx
+++ b/common/static/common/js/components/BlockBrowser/components/BlockBrowser/BlockBrowser.jsx
@@ -26,6 +26,7 @@ const BLOCK_TYPE_NAME = {
};
const BlockType = PropTypes.shape({
+ // eslint-disable-next-line react/forbid-prop-types
children: PropTypes.array,
display_name: PropTypes.string.isRequired,
id: PropTypes.string.isRequired,
@@ -33,6 +34,7 @@ const BlockType = PropTypes.shape({
type: PropTypes.string.isRequired,
});
+// eslint-disable-next-line react/function-component-definition
export const BlockList = ({
blocks, selectedBlock, onSelectBlock, onChangeRoot,
}) => (
@@ -71,7 +73,9 @@ BlockList.defaultProps = {
selectedBlock: null,
};
+// eslint-disable-next-line react/function-component-definition
export const BlockBrowser = ({
+ // eslint-disable-next-line react/prop-types
blocks, selectedBlock, onSelectBlock, onChangeRoot, className,
}) => !!blocks && (
diff --git a/common/static/common/js/components/BlockBrowser/components/BlockBrowser/BlockBrowser.test.jsx b/common/static/common/js/components/BlockBrowser/components/BlockBrowser/BlockBrowser.test.jsx
index db4f47d6564..84a3e7a1930 100644
--- a/common/static/common/js/components/BlockBrowser/components/BlockBrowser/BlockBrowser.test.jsx
+++ b/common/static/common/js/components/BlockBrowser/components/BlockBrowser/BlockBrowser.test.jsx
@@ -1,3 +1,4 @@
+// eslint-disable-next-line no-redeclare
/* global jest,test,describe,expect */
import React from 'react';
import renderer from 'react-test-renderer';
diff --git a/common/static/common/js/components/BlockBrowser/data/reducers/index.js b/common/static/common/js/components/BlockBrowser/data/reducers/index.js
index 64e0bdca88a..b5c9a8420dc 100644
--- a/common/static/common/js/components/BlockBrowser/data/reducers/index.js
+++ b/common/static/common/js/components/BlockBrowser/data/reducers/index.js
@@ -4,6 +4,7 @@ import courseBlocksActions from '../actions/constants';
export const buildBlockTree = (blocks, excludeBlockTypes) => {
if (!(blocks && blocks.root)) { return null; }
const blockTree = (root, parent) => {
+ // eslint-disable-next-line prefer-object-spread
const tree = Object.assign({ parent }, blocks.blocks[root]);
if (tree.children) {
tree.children = tree.children.map(block => blockTree(block, root));
@@ -18,6 +19,7 @@ export const buildBlockTree = (blocks, excludeBlockTypes) => {
return blockTree(blocks.root, null);
};
+// eslint-disable-next-line default-param-last
export const blocks = (state = {}, action) => {
switch (action.type) {
case courseBlocksActions.fetch.SUCCESS:
@@ -27,6 +29,7 @@ export const blocks = (state = {}, action) => {
}
};
+// eslint-disable-next-line default-param-last
export const selectedBlock = (state = '', action) => {
switch (action.type) {
case courseBlocksActions.SELECT_BLOCK:
@@ -36,6 +39,7 @@ export const selectedBlock = (state = '', action) => {
}
};
+// eslint-disable-next-line default-param-last
export const rootBlock = (state = null, action) => {
switch (action.type) {
case courseBlocksActions.fetch.SUCCESS:
diff --git a/common/static/common/js/components/BlockBrowser/index.jsx b/common/static/common/js/components/BlockBrowser/index.jsx
index 0ac85c289bb..fa498e9a25a 100644
--- a/common/static/common/js/components/BlockBrowser/index.jsx
+++ b/common/static/common/js/components/BlockBrowser/index.jsx
@@ -3,6 +3,7 @@ import { Provider } from 'react-redux';
import BlockBrowserContainer from './components/BlockBrowser/BlockBrowserContainer';
import store from './data/store';
+// eslint-disable-next-line react/function-component-definition
export const BlockBrowser = props => (
diff --git a/common/static/common/js/components/ExperimentalCarousel.jsx b/common/static/common/js/components/ExperimentalCarousel.jsx
index 6d99d6d468c..ba239ae63e6 100644
--- a/common/static/common/js/components/ExperimentalCarousel.jsx
+++ b/common/static/common/js/components/ExperimentalCarousel.jsx
@@ -20,6 +20,7 @@ function NextArrow(props) {
}
return (
+ // eslint-disable-next-line react/button-has-type