Skip to content

Commit

Permalink
Merge pull request #16843 from edx/why_did_we_not_do_this_sooner
Browse files Browse the repository at this point in the history
fix some eslint ish
  • Loading branch information
Eric Fischer committed Dec 11, 2017
2 parents 831eae6 + f63cf61 commit 25eb318
Show file tree
Hide file tree
Showing 416 changed files with 3,570 additions and 3,744 deletions.
2 changes: 1 addition & 1 deletion cms/static/cms/js/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
* inlined in the build config.
*/
shim: {
'xmodule': {
xmodule: {
deps: [
'jquery', 'underscore', 'codemirror', 'tinymce',
'jquery.tinymce', 'jquery.qtip', 'jquery.scrollTo', 'jquery.flot',
Expand Down
4 changes: 2 additions & 2 deletions cms/static/cms/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
message = JSON.parse(jqXHR.responseText).error;
}
msg = new NotificationView.Error({
'title': gettext("Studio's having trouble saving your work"),
'message': message
title: gettext("Studio's having trouble saving your work"),
message: message
});
console.log('Studio AJAX Error', { // eslint-disable-line no-console
url: event.currentTarget.URL,
Expand Down
8 changes: 4 additions & 4 deletions cms/static/cms/js/xblock/cms.runtime.v1.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
define(['jquery', 'backbone', 'xblock/runtime.v1', 'URI', 'gettext', 'js/utils/modal',
'common/js/components/views/feedback_notification'],
'common/js/components/views/feedback_notification'],
function($, Backbone, XBlock, URI, gettext, ModalUtils, NotificationView) {
'use strict';

Expand Down Expand Up @@ -149,7 +149,7 @@ define(['jquery', 'backbone', 'xblock/runtime.v1', 'URI', 'gettext', 'js/utils/m
};

return v1;
})(XBlock.Runtime.v1);
}(XBlock.Runtime.v1));

PreviewRuntime.v1 = (function(_super) {
__extends(v1, _super);
Expand All @@ -161,7 +161,7 @@ define(['jquery', 'backbone', 'xblock/runtime.v1', 'URI', 'gettext', 'js/utils/m
v1.prototype.handlerPrefix = '/preview/xblock';

return v1;
})(BaseRuntime.v1);
}(BaseRuntime.v1));

StudioRuntime.v1 = (function(_super) {
__extends(v1, _super);
Expand All @@ -173,7 +173,7 @@ define(['jquery', 'backbone', 'xblock/runtime.v1', 'URI', 'gettext', 'js/utils/m
v1.prototype.handlerPrefix = '/xblock';

return v1;
})(BaseRuntime.v1);
}(BaseRuntime.v1));

// Install the runtime's into the global namespace
window.BaseRuntime = BaseRuntime;
Expand Down
3 changes: 1 addition & 2 deletions cms/static/js/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ require([
ModuleUtils,
IframeUtils,
DropdownMenuView
)
{
) {
var $body;

domReady(function() {
Expand Down
3 changes: 1 addition & 2 deletions cms/static/js/certificates/collections/certificates.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ function(Backbone, gettext, Certificate) {
// otherwise return empty array
if (typeof certificate_info === 'object') {
return_array = certificate_info;
}
else {
} else {
console.error(
interpolate(
gettext('Could not parse certificate JSON. %(message)s'), {message: ex.message}, true
Expand Down
2 changes: 1 addition & 1 deletion cms/static/js/certificates/spec/custom_matchers.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ define(['jquery'], function($) { // eslint-disable-line no-unused-vars
compare: function(actual, values) {
var passed = _.every(values, function(value, key) {
return actual.get(key) === value;
}.bind(this));
});

return {
pass: passed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ function(_, Course, CertificatesCollection, CertificateModel, CertificateDetails
it('should parse a JSON object collection into a Backbone model collection', function() {
var course_title = 'Test certificate course title override 2';
var CERTIFICATE_JSON_OBJECT = [{
'course_title': course_title,
'signatories': '[]'
course_title: course_title,
signatories: '[]'
}];
this.collection.parse(CERTIFICATE_JSON_OBJECT);
var model = this.collection.at(1);
Expand Down
3 changes: 1 addition & 2 deletions cms/static/js/certificates/views/certificate_details.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ function($, _, str, gettext, BaseView, SignatoryModel, SignatoryDetailsView, Vie
return self.model.set('editing', true);
}
);
}
else {
} else {
this.model.set('editing', true);
}
},
Expand Down
2 changes: 1 addition & 1 deletion cms/static/js/certificates/views/certificate_editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function($, _, Backbone, gettext,
'change .certificate-course-title-input': 'setCourseTitle',
'focus .input-text': 'onFocus',
'blur .input-text': 'onBlur',
'submit': 'setAndClose',
submit: 'setAndClose',
'click .action-cancel': 'cancel',
'click .action-add-signatory': 'addSignatory'
},
Expand Down
4 changes: 2 additions & 2 deletions cms/static/js/certificates/views/certificate_item.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ function(gettext, ListItemView, CertificateDetailsView, CertificateEditorView) {
attributes: function() {
// Retrieves the defined attribute set
return {
'id': this.model.get('id'),
'tabindex': -1
id: this.model.get('id'),
tabindex: -1
};
},

Expand Down
4 changes: 2 additions & 2 deletions cms/static/js/certificates/views/signatory_details.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ function($, _, str, Backbone, gettext, TemplateUtils, ViewUtils, BaseView, Signa
actionableModel.setOriginalAttributes();
dfd.resolve();
self.closeSignatoryEditView();
}.bind(this)
}
});
return dfd;
}.bind(this));
});
},

closeSignatoryEditView: function(event) {
Expand Down
6 changes: 2 additions & 4 deletions cms/static/js/certificates/views/signatory_editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,7 @@ function($, _, Backbone, gettext,
if (model.isNew()) {
model.collection.remove(model);
self.eventAgg.trigger('onSignatoryRemoved', model);
}
else {
} else {
deleting.show();
model.destroy({
wait: true,
Expand Down Expand Up @@ -200,8 +199,7 @@ function($, _, Backbone, gettext,
$(selector).addClass('error');
$(selector).append("<span class='message-error'>" + errorMessage + '</span>');
}
}
else {
} else {
// Remove the error message.
$(selector).removeClass('error');
$(selector + '>span.message-error').remove();
Expand Down
2 changes: 1 addition & 1 deletion cms/static/js/factories/base.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
define(['js/base', 'cms/js/main', 'js/src/logger', 'datepair', 'accessibility',
'ieshim', 'tooltip_manager', 'lang_edx', 'js/models/course']);
'ieshim', 'tooltip_manager', 'lang_edx', 'js/models/course']);
4 changes: 2 additions & 2 deletions cms/static/js/factories/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ define(['jquery.cookie', 'utility', 'common/js/components/utils/view_utils'], fu

$('form#login_form').submit(function(event) {
event.preventDefault();
var submitButton = $('#submit'),
var $submitButton = $('#submit'),
deferred = new $.Deferred(),
promise = deferred.promise();
ViewUtils.disableElementWhileRunning(submitButton, function() { return promise; });
ViewUtils.disableElementWhileRunning($submitButton, function() { return promise; });
var submit_data = $('#login_form').serialize();

postJSON('/login_post', submit_data, function(json) {
Expand Down
2 changes: 1 addition & 1 deletion cms/static/js/factories/manage_users.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function(_, gettext, ManageUsersAndRoles) {
// Roles order are important: first role is considered initial role (the role added to user when (s)he's added
// Last role is considered an admin role (unrestricted access + ability to manage other users' permissions)
// Changing roles is performed in promote-demote fashion, so moves only to adjacent roles is allowed
var roles = [{key: 'staff', name: gettext('Staff')}, {key: 'instructor', 'name': gettext('Admin')}];
var roles = [{key: 'staff', name: gettext('Staff')}, {key: 'instructor', name: gettext('Admin')}];

var options = {
el: $('#content'),
Expand Down
2 changes: 1 addition & 1 deletion cms/static/js/factories/manage_users_lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function(_, gettext, ManageUsersAndRoles) {
var roles = [
{key: 'library_user', name: gettext('Library User')},
{key: 'staff', name: gettext('Staff')},
{key: 'instructor', 'name': gettext('Admin')}
{key: 'instructor', name: gettext('Admin')}
];

var options = {
Expand Down
15 changes: 7 additions & 8 deletions cms/static/js/factories/settings_advanced.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,16 @@ define([
editor.render();

$('#deprecated-settings').click(function() {
var wrapperDeprecatedSetting = $('.wrapper-deprecated-setting'),
deprecatedSettingsLabel = $('.deprecated-settings-label');
var $wrapperDeprecatedSetting = $('.wrapper-deprecated-setting'),
$deprecatedSettingsLabel = $('.deprecated-settings-label');

if ($(this).is(':checked')) {
wrapperDeprecatedSetting.addClass('is-set');
deprecatedSettingsLabel.text(gettext('Hide Deprecated Settings'));
$wrapperDeprecatedSetting.addClass('is-set');
$deprecatedSettingsLabel.text(gettext('Hide Deprecated Settings'));
editor.render_deprecated = true;
}
else {
wrapperDeprecatedSetting.removeClass('is-set');
deprecatedSettingsLabel.text(gettext('Show Deprecated Settings'));
} else {
$wrapperDeprecatedSetting.removeClass('is-set');
$deprecatedSettingsLabel.text(gettext('Show Deprecated Settings'));
editor.render_deprecated = false;
}

Expand Down
2 changes: 1 addition & 1 deletion cms/static/js/models/course.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
define(['backbone'], function(Backbone) {
var Course = Backbone.Model.extend({
defaults: {
'name': ''
name: ''
},
validate: function(attrs, options) {
if (!attrs.name) {
Expand Down
4 changes: 2 additions & 2 deletions cms/static/js/models/course_info.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ define(['backbone'], function(Backbone) {
url: '',

defaults: {
'updates': null, // UpdateCollection
'handouts': null // HandoutCollection
updates: null, // UpdateCollection
handouts: null // HandoutCollection
}
});
return CourseInfo;
Expand Down
10 changes: 5 additions & 5 deletions cms/static/js/models/course_update.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ define(['backbone', 'jquery', 'jquery.ui'], function(Backbone, $) {
// course update -- biggest kludge here is the lack of a real id to map updates to originals
var CourseUpdate = Backbone.Model.extend({
defaults: {
'date': $.datepicker.formatDate('MM d, yy', new Date()),
'content': '',
'push_notification_enabled': false,
'push_notification_selected': false
date: $.datepicker.formatDate('MM d, yy', new Date()),
content: '',
push_notification_enabled: false,
push_notification_selected: false
},
validate: function(attrs) {
var date_exists = (attrs.date !== null && attrs.date !== '');
var date_is_valid_string = ($.datepicker.formatDate('MM d, yy', new Date(attrs.date)) === attrs.date);
if (!(date_exists && date_is_valid_string)) {
return {'date_required': gettext('Action required: Enter a valid date.')};
return {date_required: gettext('Action required: Enter a valid date.')};
}
}
});
Expand Down
2 changes: 1 addition & 1 deletion cms/static/js/models/explicit_url.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
define(['backbone'], function(Backbone) {
return Backbone.Model.extend({
defaults: {
'explicit_url': ''
explicit_url: ''
},
url: function() {
return this.get('explicit_url');
Expand Down
20 changes: 10 additions & 10 deletions cms/static/js/models/license.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
define(['backbone', 'underscore'], function(Backbone, _) {
var LicenseModel = Backbone.Model.extend({
defaults: {
'type': null,
'options': {},
'custom': false // either `false`, or a string
type: null,
options: {},
custom: false // either `false`, or a string
},

initialize: function(attributes) {
Expand Down Expand Up @@ -55,16 +55,16 @@ define(['backbone', 'underscore'], function(Backbone, _) {
if (spaceIndex == -1) {
// if there's no space, it's a license type without options
return this.set({
'type': string,
'options': {},
'custom': false
type: string,
options: {},
custom: false
}, options);
} else {
// if there is a space, it's a custom license
return this.set({
'type': null,
'options': {},
'custom': string
type: null,
options: {},
custom: string
}, options);
}
}
Expand All @@ -91,7 +91,7 @@ define(['backbone', 'underscore'], function(Backbone, _) {
});

return this.set({
'type': type, 'options': optionsObj, 'custom': false
type: type, options: optionsObj, custom: false
}, options);
}
});
Expand Down
22 changes: 9 additions & 13 deletions cms/static/js/models/location.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ define(['backbone', 'underscore'], function(Backbone, _) {
},
toUrl: function(overrides) {
return;
(overrides && overrides['tag'] ? overrides['tag'] : this.get('tag')) + '://' +
(overrides && overrides['org'] ? overrides['org'] : this.get('org')) + '/' +
(overrides && overrides['course'] ? overrides['course'] : this.get('course')) + '/' +
(overrides && overrides['category'] ? overrides['category'] : this.get('category')) + '/' +
(overrides && overrides['name'] ? overrides['name'] : this.get('name')) + '/';
(overrides && overrides.tag ? overrides.tag : this.get('tag')) + '://' +
(overrides && overrides.org ? overrides.org : this.get('org')) + '/' +
(overrides && overrides.course ? overrides.course : this.get('course')) + '/' +
(overrides && overrides.category ? overrides.category : this.get('category')) + '/' +
(overrides && overrides.name ? overrides.name : this.get('name')) + '/';
},
_tagPattern: /[^:]+/g,
_fieldPattern: new RegExp('[^/]+', 'g'),
Expand All @@ -27,8 +27,7 @@ define(['backbone', 'underscore'], function(Backbone, _) {
category: payload[3],
name: payload[4]
};
}
else if (_.isString(payload)) {
} else if (_.isString(payload)) {
this._tagPattern.lastIndex = 0; // odd regex behavior requires this to be reset sometimes
var foundTag = this._tagPattern.exec(payload);
if (foundTag) {
Expand All @@ -40,18 +39,15 @@ define(['backbone', 'underscore'], function(Backbone, _) {
category: this.getNextField(payload),
name: this.getNextField(payload)
};
}
else return null;
}
else {
} else return null;
} else {
return payload;
}
},
getNextField: function(payload) {
try {
return this._fieldPattern.exec(payload)[0];
}
catch (err) {
} catch (err) {
return '';
}
}
Expand Down
14 changes: 7 additions & 7 deletions cms/static/js/models/metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ define(['backbone'], function(Backbone) {
*/
var Metadata = Backbone.Model.extend({
defaults: {
'field_name': null,
'display_name': null,
'value': null,
'explicitly_set': null,
'default_value': null,
'options': null,
'type': null
field_name: null,
display_name: null,
value: null,
explicitly_set: null,
default_value: null,
options: null,
type: null
},

initialize: function() {
Expand Down
8 changes: 4 additions & 4 deletions cms/static/js/models/module_info.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ define(['backbone', 'js/utils/module'], function(Backbone, ModuleUtils) {
urlRoot: ModuleUtils.urlRoot,

defaults: {
'id': null,
'data': null,
'metadata': null,
'children': null
id: null,
data: null,
metadata: null,
children: null
}
});
return ModuleInfo;
Expand Down

0 comments on commit 25eb318

Please sign in to comment.