Replace JSHint ignore directives with ESLint ones

This commit is contained in:
Brian Jacobel
2016-07-26 15:48:19 -04:00
parent 8582da4a97
commit a32fd27d60
89 changed files with 214 additions and 206 deletions

View File

@@ -1,3 +1,23 @@
{
"extends": "eslint-config-edx"
"extends": "eslint-config-edx",
"globals": { // Try to avoid adding any new globals.
// Old compatibility things and hacks
"edx": true,
"XBlock": true,
// added by Django i18n tools
"gettext": true,
"ngettext": true,
// added by jasmine-jquery
"loadFixtures": true,
"appendLoadFixtures": true,
"readFixtures": true,
"setFixtures": true,
"appendSetFixtures": true,
"spyOnEvent": true,
// used by our requirejs implementation
"RequireJS": true
}
}

View File

@@ -1,3 +1,5 @@
/* globals AjaxPrefix */
(function(AjaxPrefix) {
'use strict';
define(['domReady', 'jquery', 'underscore.string', 'backbone', 'gettext',
@@ -34,7 +36,7 @@
message = str.truncate(jqXHR.responseText, 300);
}
} else {
message = gettext('This may be happening because of an error with our server or your internet connection. Try refreshing the page or making sure you are online.'); //jshint ignore:line
message = gettext('This may be happening because of an error with our server or your internet connection. Try refreshing the page or making sure you are online.'); // eslint-disable-line max-len
}
msg = new NotificationView.Error({
'title': gettext("Studio's having trouble saving your work"),
@@ -65,5 +67,4 @@
main();
return main;
});
}).call(this, AjaxPrefix); //jshint ignore:line
}).call(this, AjaxPrefix);

View File

@@ -94,7 +94,7 @@
// end of Annotation tool files
// externally hosted files
'mathjax': '//cdn.mathjax.org/mathjax/2.6-latest/MathJax.js?config=TeX-MML-AM_SVG&delayStartupUntil=configured', // jshint ignore:line
mathjax: '//cdn.mathjax.org/mathjax/2.6-latest/MathJax.js?config=TeX-MML-AM_SVG&delayStartupUntil=configured', // eslint-disable-line max-len
'youtube': [
// youtube URL does not end in '.js'. We add '?noext' to the path so
// that require.js adds the '.js' to the query component of the URL,

View File

@@ -1,3 +1,5 @@
/* globals requirejs, requireSerial */
(function(requirejs, requireSerial) {
'use strict';
@@ -22,9 +24,9 @@
'jquery.cookie': 'xmodule_js/common_static/js/vendor/jquery.cookie',
'jquery.qtip': 'xmodule_js/common_static/js/vendor/jquery.qtip.min',
'jquery.fileupload': 'xmodule_js/common_static/js/vendor/jQuery-File-Upload/js/jquery.fileupload',
'jquery.fileupload-process': 'xmodule_js/common_static/js/vendor/jQuery-File-Upload/js/jquery.fileupload-process', // jshint ignore:line
'jquery.fileupload-validate': 'xmodule_js/common_static/js/vendor/jQuery-File-Upload/js/jquery.fileupload-validate', // jshint ignore:line
'jquery.iframe-transport': 'xmodule_js/common_static/js/vendor/jQuery-File-Upload/js/jquery.iframe-transport', // jshint ignore:line
'jquery.fileupload-process': 'xmodule_js/common_static/js/vendor/jQuery-File-Upload/js/jquery.fileupload-process', // eslint-disable-line max-len
'jquery.fileupload-validate': 'xmodule_js/common_static/js/vendor/jQuery-File-Upload/js/jquery.fileupload-validate', // eslint-disable-line max-len
'jquery.iframe-transport': 'xmodule_js/common_static/js/vendor/jQuery-File-Upload/js/jquery.iframe-transport', // eslint-disable-line max-len
'jquery.inputnumber': 'xmodule_js/common_static/js/vendor/html5-input-polyfills/number-polyfill',
'jquery.immediateDescendents': 'xmodule_js/common_static/coffee/src/jquery.immediateDescendents',
'jquery.simulate': 'xmodule_js/common_static/js/vendor/jquery.simulate',
@@ -54,7 +56,7 @@
'domReady': 'xmodule_js/common_static/js/vendor/domReady',
'URI': 'xmodule_js/common_static/js/vendor/URI.min',
'mock-ajax': 'xmodule_js/common_static/js/vendor/mock-ajax',
'mathjax': '//cdn.mathjax.org/mathjax/2.6-latest/MathJax.js?config=TeX-MML-AM_SVG&delayStartupUntil=configured', // jshint ignore:line
mathjax: '//cdn.mathjax.org/mathjax/2.6-latest/MathJax.js?config=TeX-MML-AM_SVG&delayStartupUntil=configured', // eslint-disable-line max-len
'youtube': '//www.youtube.com/player_api?noext',
'coffee/src/ajax_prefix': 'xmodule_js/common_static/coffee/src/ajax_prefix',
'js/spec/test_utils': 'js/spec/test_utils'
@@ -290,5 +292,4 @@
requireSerial(specHelpers.concat(testFiles), function() {
return window.__karma__.start();
});
}).call(this, requirejs, requireSerial); // jshint ignore:line
}).call(this, requirejs, requireSerial);

View File

@@ -1,3 +1,5 @@
/* globals sandbox */
(function(sandbox) {
'use strict';
require(["jquery", "backbone", "cms/js/main", "edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers", "jquery.cookie"],
@@ -77,5 +79,4 @@
});
});
});
}).call(this, sandbox); //jshint ignore:line
}).call(this, sandbox);

View File

@@ -1,3 +1,5 @@
/* globals requirejs, requireSerial */
(function(requirejs, requireSerial) {
'use strict';
@@ -21,9 +23,9 @@
'jquery.cookie': 'xmodule_js/common_static/js/vendor/jquery.cookie',
'jquery.qtip': 'xmodule_js/common_static/js/vendor/jquery.qtip.min',
'jquery.fileupload': 'xmodule_js/common_static/js/vendor/jQuery-File-Upload/js/jquery.fileupload',
'jquery.fileupload-process': 'xmodule_js/common_static/js/vendor/jQuery-File-Upload/js/jquery.fileupload-process', // jshint ignore:line
'jquery.fileupload-validate': 'xmodule_js/common_static/js/vendor/jQuery-File-Upload/js/jquery.fileupload-validate', // jshint ignore:line
'jquery.iframe-transport': 'xmodule_js/common_static/js/vendor/jQuery-File-Upload/js/jquery.iframe-transport', // jshint ignore:line
'jquery.fileupload-process': 'xmodule_js/common_static/js/vendor/jQuery-File-Upload/js/jquery.fileupload-process', // eslint-disable-line max-len
'jquery.fileupload-validate': 'xmodule_js/common_static/js/vendor/jQuery-File-Upload/js/jquery.fileupload-validate', // eslint-disable-line max-len
'jquery.iframe-transport': 'xmodule_js/common_static/js/vendor/jQuery-File-Upload/js/jquery.iframe-transport', // eslint-disable-line max-len
'jquery.inputnumber': 'xmodule_js/common_static/js/vendor/html5-input-polyfills/number-polyfill',
'jquery.immediateDescendents': 'xmodule_js/common_static/coffee/src/jquery.immediateDescendents',
'datepair': 'xmodule_js/common_static/js/vendor/timepicker/datepair',
@@ -46,7 +48,7 @@
'draggabilly': 'xmodule_js/common_static/js/vendor/draggabilly',
'domReady': 'xmodule_js/common_static/js/vendor/domReady',
'URI': 'xmodule_js/common_static/js/vendor/URI.min',
'mathjax': '//cdn.mathjax.org/mathjax/2.6-latest/MathJax.js?config=TeX-MML-AM_SVG&delayStartupUntil=configured', // jshint ignore:line
mathjax: '//cdn.mathjax.org/mathjax/2.6-latest/MathJax.js?config=TeX-MML-AM_SVG&delayStartupUntil=configured', // eslint-disable-line max-len
'youtube': '//www.youtube.com/player_api?noext',
'coffee/src/ajax_prefix': 'xmodule_js/common_static/coffee/src/ajax_prefix'
},
@@ -206,5 +208,4 @@
requireSerial(specHelpers.concat(testFiles), function() {
return window.__karma__.start();
});
}).call(this, requirejs, requireSerial); // jshint ignore:line
}).call(this, requirejs, requireSerial);

View File

@@ -1,6 +1,6 @@
// Backbone.js Application Collection: Certificates
define([ // jshint ignore:line
define([
'backbone',
'gettext',
'js/certificates/models/certificate'

View File

@@ -1,6 +1,6 @@
// Backbone.js Application Collection: Certificate Signatories
define([ // jshint ignore:line
define([
'backbone',
'js/certificates/models/signatory'
],

View File

@@ -11,7 +11,7 @@ The RequireJS Optimizer is only enabled in Studio at present, so the page factor
We do intend to enable page factories on the LMS too.
*/
define([ // jshint ignore:line
define([
'jquery',
'js/certificates/collections/certificates',
'js/certificates/models/certificate',

View File

@@ -1,6 +1,6 @@
// Backbone.js Application Model: Certificate Signatory
define([ // jshint ignore:line
define([
'underscore',
'backbone',
'backbone-relational'

View File

@@ -1,7 +1,7 @@
// Custom matcher library for Jasmine test assertions
// http://tobyho.com/2012/01/30/write-a-jasmine-matcher/
define(['jquery'], function($) { // jshint ignore:line
define(['jquery'], function($) { // eslint-disable-line no-unused-vars
'use strict';
return function () {
jasmine.addMatchers({

View File

@@ -1,6 +1,6 @@
// Jasmine Test Suite: Certifiate Model
define([ // jshint ignore:line
define([
'js/certificates/models/certificate',
'js/certificates/collections/certificates'
],

View File

@@ -1,6 +1,6 @@
// Jasmine Test Suite: Certifiate Details View
define([ // jshint ignore:line
define([
'underscore',
'js/models/course',
'js/certificates/collections/certificates',
@@ -104,7 +104,7 @@ function(_, Course, CertificatesCollection, CertificateModel, CertificateDetails
model: this.model
});
appendSetFixtures(this.view.render().el);
CustomMatchers(); // jshint ignore:line
CustomMatchers();
});
afterEach(function() {
@@ -141,7 +141,7 @@ function(_, Course, CertificatesCollection, CertificateModel, CertificateDetails
});
it('should have empty certificate collection if there is an error parsing certifcate JSON', function () {
var CERTIFICATE_INVALID_JSON = '[{"course_title": Test certificate course title override, "signatories":"[]"}]'; // jshint ignore:line
var CERTIFICATE_INVALID_JSON = '[{"course_title": Test certificate course title override, "signatories":"[]"}]'; // eslint-disable-line max-len
var collection_length = this.collection.length;
this.collection.parse(CERTIFICATE_INVALID_JSON);
//collection length should remain the same since we have error parsing JSON

View File

@@ -1,6 +1,6 @@
// Jasmine Test Suite: Certifiate Editor View
define([ // jshint ignore:line
define([
'underscore',
'js/models/course',
'js/certificates/models/certificate',
@@ -119,7 +119,7 @@ function(_, Course, CertificateModel, SignatoryModel, CertificatesCollection, Ce
max_signatories_limit: MAX_SIGNATORIES_LIMIT
});
appendSetFixtures(this.view.render().el);
CustomMatchers(); // jshint ignore:line
CustomMatchers();
});
afterEach(function() {

View File

@@ -1,6 +1,6 @@
// Jasmine Test Suite: Certificate Web Preview
define([ // jshint ignore:line
define([
'underscore',
'jquery',
'js/models/course',

View File

@@ -1,6 +1,6 @@
// Jasmine Test Suite: Certificate List View
define([ // jshint ignore:line
define([
'underscore',
'js/models/course',
'js/certificates/collections/certificates',
@@ -61,7 +61,7 @@ function(_, Course, CertificatesCollection, CertificateModel, CertificateDetails
collection: this.collection
});
appendSetFixtures(this.view.render().el);
CustomMatchers(); // jshint ignore:line
CustomMatchers();
});
afterEach(function() {

View File

@@ -1,6 +1,6 @@
// Backbone Application View: Certificate Details
define([ // jshint ignore:line
define([
'jquery',
'underscore',
'underscore.string',

View File

@@ -1,6 +1,6 @@
// Backbone Application View: Certificate Editor
define([ // jshint ignore:line
define([
'jquery',
'underscore',
'backbone',
@@ -83,7 +83,7 @@ function($, _, Backbone, gettext,
addSignatory: function() {
// Append a new signatory to the certificate model's signatories collection
var signatory = new SignatoryModel({certificate: this.getSaveableModel()}); // jshint ignore:line
var signatory = new SignatoryModel({certificate: this.getSaveableModel()}); // eslint-disable-line max-len, no-unused-vars
this.render();
},

View File

@@ -1,7 +1,7 @@
// Backbone Application View: Certificate Item
// Renders an editor view or a details view depending on the state of the underlying model.
define([ // jshint ignore:line
define([
'gettext',
'js/views/list_item',
'js/certificates/views/certificate_details',

View File

@@ -2,7 +2,7 @@
// User can preview the certificate web layout/styles. 'Preview Certificate' button will open a new tab in LMS for
// the selected course mode from the drop down.
define([ // jshint ignore:line
define([
'underscore',
'gettext',
'js/views/baseview',

View File

@@ -1,6 +1,6 @@
// Backbone Application View: Certificates List
define([ // jshint ignore:line
define([
'gettext',
'js/views/list',
'js/certificates/views/certificate_item'

View File

@@ -1,6 +1,6 @@
// Backbone Application View: Certificates Page
define([ // jshint ignore:line
define([
'jquery',
'underscore',
'gettext',

View File

@@ -1,6 +1,6 @@
// Backbone Application View: Signatory Details
define([ // jshint ignore:line
define([
'jquery',
'underscore',
'underscore.string',

View File

@@ -1,6 +1,6 @@
// Backbone Application View: Signatory Editor
define([ // jshint ignore:line
define([
'jquery',
'underscore',
'backbone',

View File

@@ -37,8 +37,7 @@ define([
return PagingCollection.prototype.parse.call(this, response, options);
},
/* jshint unused:false */
parseState: function (response, queryParams, state, options) {
parseState: function(response) {
return {
totalRecords: response[0].totalCount,
totalPages: Math.ceil(response[0].totalCount / response[0].pageSize)

View File

@@ -15,7 +15,7 @@ var FileUpload = Backbone.Model.extend({
validate: function(attrs, options) {
if(attrs.selectedFile && !this.checkTypeValidity(attrs.selectedFile)) {
return {
message: _.template(gettext("Only <%= fileTypes %> files can be uploaded. Please select a file ending in <%= fileExtensions %> to upload."))( // jshint ignore:line
message: _.template(gettext('Only <%= fileTypes %> files can be uploaded. Please select a file ending in <%= fileExtensions %> to upload.'))( // eslint-disable-line max-len
this.formatValidTypes()
),
attributes: {selectedFile: true}

View File

@@ -135,7 +135,6 @@ define([
},
getModalContent: function() {
/* jshint maxlen: 300 */
return {
name: gettext('confirm'),
title: gettext('Publish this program?'),

View File

@@ -7,7 +7,6 @@ function($, LoginFactory, AjaxHelpers, ViewUtils) {
beforeEach(function() {
loadFixtures('mock/login.underscore');
/*jshint unused: false*/
var login_factory = new LoginFactory("/home/");
submitButton = $('#submit');
});

View File

@@ -10,7 +10,6 @@ define([
ProgramDetailsView, constants ) {
'use strict';
/* jshint maxlen: 300 */
describe('ProgramDetailsView', function () {
var view = {},
model = {},
@@ -36,7 +35,7 @@ define([
end: null,
enrollment_start: null,
enrollment_end: null,
blocks_url: 'http://127.0.0.1:8000/api/courses/v1/blocks/?course_id=course-v1%3AedX%2BDemoX%2BDemo_Course'
blocks_url: 'http://127.0.0.1:8000/api/courses/v1/blocks/?course_id=course-v1%3AedX%2BDemoX%2BDemo_Course' // eslint-disable-line max-len
},
{
id: 'course-v1:edx+Krampus25+2015_12_05',
@@ -59,7 +58,7 @@ define([
end: null,
enrollment_start: null,
enrollment_end: null,
blocks_url: 'http://127.0.0.1:8000/api/courses/v1/blocks/?course_id=course-v1%3Aedx%2BKrampus25%2B2015_12_05'
blocks_url: 'http://127.0.0.1:8000/api/courses/v1/blocks/?course_id=course-v1%3Aedx%2BKrampus25%2B2015_12_05' // eslint-disable-line max-len
},
{
id: 'course-v1:edx+shiaLB101+2016_01',
@@ -82,7 +81,7 @@ define([
end: null,
enrollment_start: null,
enrollment_end: null,
blocks_url: 'http://127.0.0.1:8000/api/courses/v1/blocks/?course_id=course-v1%3Aedx%2BshiaLB101%2B2016_01'
blocks_url: 'http://127.0.0.1:8000/api/courses/v1/blocks/?course_id=course-v1%3Aedx%2BshiaLB101%2B2016_01' // eslint-disable-line max-len
}
],
programData = {
@@ -381,7 +380,7 @@ define([
addCourse();
expect( view.$(runSelect).length ).toEqual(0);
view.$('.js-add-course-run').first().click();
$runSelect = view.$(runSelect);
expect( $runSelect.length ).toEqual(1);
expect( view.$('.js-remove-run').length ).toEqual(savedRunCount);
@@ -402,7 +401,7 @@ define([
$courseView = view.$('.course-container').last();
$addRunBtn = $courseView.find('.js-add-course-run');
$addRunBtn.click();
expect( view.$(runSelect).length ).toEqual(1);
expect( view.$(runSelect).find('option').length ).toEqual(courseRunOptionsCount);

View File

@@ -50,7 +50,7 @@ define(["domReady", "jquery", "underscore", "js/views/utils/create_course_utils"
// Go into creating re-run state
$('.rerun-course-save').addClass('is-disabled').attr('aria-disabled', true).addClass('is-processing').html(
'<span class="icon fa fa-refresh fa-spin" aria-hidden="true"></span>' + gettext('Processing Re-run Request') //jshint ignore:line
'<span class="icon fa fa-refresh fa-spin" aria-hidden="true"></span>' + gettext('Processing Re-run Request') // eslint-disable-line max-len
);
$('.action-cancel').addClass('is-hidden');
};

View File

@@ -1,6 +1,6 @@
// Backbone Application View: Instructor Information
define([ // jshint ignore:line
define([
'jquery',
'underscore',
'backbone',

View File

@@ -1,6 +1,6 @@
// Backbone Application View: Course Learning Information
define([ // jshint ignore:line
define([
'jquery',
'underscore',
'backbone',

View File

@@ -288,7 +288,7 @@ function(BaseView, _, MetadataModel, AbstractEditor, FileUpload, UploadDialog,
var template = _.template(
'<li class="list-settings-item">' +
'<input type="text" class="input" value="<%- ele %>">' +
'<a href="#" class="remove-action remove-setting" data-index="<%- index %>"><span class="icon fa fa-times-circle" aria-hidden="true"></span><span class="sr">' + gettext('Remove') + '</span></a>' + //jshint ignore:line
'<a href="#" class="remove-action remove-setting" data-index="<%- index %>"><span class="icon fa fa-times-circle" aria-hidden="true"></span><span class="sr">' + gettext('Remove') + '</span></a>' + // eslint-disable-line max-len
'</li>'
);
list.append($(template({'ele': ele, 'index': index})));
@@ -455,7 +455,7 @@ function(BaseView, _, MetadataModel, AbstractEditor, FileUpload, UploadDialog,
'<li class="list-settings-item">' +
'<input type="text" class="input input-key" value="<%= key %>">' +
'<input type="text" class="input input-value" value="<%= value %>">' +
'<a href="#" class="remove-action remove-setting" data-value="<%= value %>"><span class="icon fa fa-times-circle" aria-hidden="true"></span><span class="sr">Remove</span></a>' + //jshint ignore:line
'<a href="#" class="remove-action remove-setting" data-value="<%= value %>"><span class="icon fa fa-times-circle" aria-hidden="true"></span><span class="sr">Remove</span></a>' + // eslint-disable-line max-len
'</li>'
);

View File

@@ -7,7 +7,6 @@ define([
'text!templates/paging-header.underscore'
], function(_, Backbone, gettext, HtmlUtils, StringUtils, pagingHeaderTemplate) {
'use strict';
/* jshint maxlen:false */
var PagingHeader = Backbone.View.extend({
events : {
'click .next-page-link': 'nextPage',
@@ -30,7 +29,7 @@ define([
lastPage = collection.getTotalPages(),
messageHtml = this.messageHtml(),
isNextDisabled = lastPage === 0 || currentPage === lastPage;
HtmlUtils.setHtml(this.$el, HtmlUtils.template(pagingHeaderTemplate)({messageHtml: messageHtml}));
this.$('.previous-page-link')
.toggleClass('is-disabled', currentPage === 1)
@@ -50,22 +49,22 @@ define([
if (this.view.collection.sortDirection === 'asc') {
// Translators: sample result:
// "Showing 0-9 out of 25 total, filtered by Images, sorted by Date Added ascending"
message = gettext('Showing {currentItemRange} out of {totalItemsCount}, filtered by {assetType}, sorted by {sortName} ascending');
message = gettext('Showing {currentItemRange} out of {totalItemsCount}, filtered by {assetType}, sorted by {sortName} ascending'); // eslint-disable-line max-len
} else {
// Translators: sample result:
// "Showing 0-9 out of 25 total, filtered by Images, sorted by Date Added descending"
message = gettext('Showing {currentItemRange} out of {totalItemsCount}, filtered by {assetType}, sorted by {sortName} descending');
message = gettext('Showing {currentItemRange} out of {totalItemsCount}, filtered by {assetType}, sorted by {sortName} descending'); // eslint-disable-line max-len
}
assetType = this.filterNameLabel();
} else {
if (this.view.collection.sortDirection === 'asc') {
// Translators: sample result:
// "Showing 0-9 out of 25 total, sorted by Date Added ascending"
message = gettext('Showing {currentItemRange} out of {totalItemsCount}, sorted by {sortName} ascending');
message = gettext('Showing {currentItemRange} out of {totalItemsCount}, sorted by {sortName} ascending'); // eslint-disable-line max-len
} else {
// Translators: sample result:
// "Showing 0-9 out of 25 total, sorted by Date Added descending"
message = gettext('Showing {currentItemRange} out of {totalItemsCount}, sorted by {sortName} descending');
message = gettext('Showing {currentItemRange} out of {totalItemsCount}, sorted by {sortName} descending'); // eslint-disable-line max-len
}
}

View File

@@ -115,9 +115,9 @@ var AdvancedView = ValidatingView.extend({
var self = this;
this.model.save({}, {
success : function() {
self.render();
var title = gettext("Your policy changes have been saved.");
var message = gettext("No validation is performed on policy keys or value pairs. If you are having difficulties, check your formatting."); // jshint ignore:line
var message = gettext('No validation is performed on policy keys or value pairs. If you are having difficulties, check your formatting.'); // eslint-disable-line max-len
self.render();
self.showSavedBar(title, message);
analytics.track('Saved Advanced Settings', {
'course': course_location_analytics

View File

@@ -1,3 +1,5 @@
/* globals analytics, course_location_analytics */
(function(analytics, course_location_analytics) {
'use strict';
@@ -199,5 +201,4 @@
})(Backbone.View);
return TabsEdit;
});
}).call(this, analytics, course_location_analytics); //jshint ignore:line
}).call(this, analytics, course_location_analytics);

View File

@@ -95,7 +95,7 @@ define(["jquery", "underscore", "gettext", "common/js/components/utils/view_util
);
if (xblockInfo.get('is_prereq')) {
messageBody += ' ' + gettext('Any content that has listed this content as a prerequisite will also have access limitations removed.'); // jshint ignore:line
messageBody += ' ' + gettext('Any content that has listed this content as a prerequisite will also have access limitations removed.'); // eslint-disable-line max-len
ViewUtils.confirmThenRunOperation(
interpolate(
gettext('Delete this %(xblock_type)s (and prerequisite)?'),

View File

@@ -106,7 +106,7 @@ define(["jquery", "underscore", "common/js/components/utils/view_utils", "js/vie
* may have thrown JavaScript errors after rendering in which case the xblock parameter
* will be null.
*/
xblockReady: function(xblock) { // jshint ignore:line
xblockReady: function(xblock) { // eslint-disable-line no-unused-vars
// Do nothing
},

View File

@@ -1,8 +1,8 @@
/* eslint-env node */
// Karma config for cms suite.
// Docs and troubleshooting tips in common/static/common/js/karma.common.conf.js
/* jshint node: true */
/*jshint -W079 */
'use strict';
var path = require('path');
var configModule = require(path.join(__dirname, '../../common/static/common/js/karma.common.conf.js'));

View File

@@ -1,8 +1,8 @@
/* eslint-env node */
// Karma config for cms-squire suite.
// Docs and troubleshooting tips in common/static/common/js/karma.common.conf.js
/* jshint node: true */
/*jshint -W079 */
'use strict';
var path = require('path');
var configModule = require(path.join(__dirname, '../../common/static/common/js/karma.common.conf.js'));

View File

@@ -1,7 +1,8 @@
/* eslint-env node */
// overwrite the loaded method and manually start the karma after a delay
// Somehow the code initialized in jQuery's onready doesn't get called before karma auto starts
/* jshint node: true */
'use strict';
window.__karma__.loaded = function () {
setTimeout(function () {

View File

@@ -1,9 +1,8 @@
/* eslint-env node */
// Karma config for xmodule suite.
// Docs and troubleshooting tips in common/static/common/js/karma.common.conf.js
/* jshint node: true */
/*jshint -W079 */
'use strict';
var path = require('path');
var configModule = require(path.join(__dirname, 'common_static/common/js/karma.common.conf.js'));

View File

@@ -64,7 +64,7 @@ function (HtmlUtils) {
'</div>',
'</div>'].join('')),
{
volumeInstructions: gettext('Click on this button to mute or unmute this video or press UP or DOWN buttons to increase or decrease volume level.'), // jshint ignore: line
volumeInstructions: gettext('Click on this button to mute or unmute this video or press UP or DOWN buttons to increase or decrease volume level.'), // eslint-disable-line max-len
adjustVideoVolume: gettext('Adjust video volume'),
volumeText: gettext('Volume')
}
@@ -130,7 +130,7 @@ function (HtmlUtils) {
*/
render: function() {
var container = this.el.find('.volume-slider');
HtmlUtils.append(container, HtmlUtils.HTML('<div class="ui-slider-handle volume-handle"></div>'));
this.volumeSlider = container.slider({

View File

@@ -32,7 +32,7 @@ define(
template: [
'<div class="speeds menu-container" role="application">',
'<p class="sr instructions" id="speed-instructions">',
gettext('Press UP to enter the speed menu then use the UP and DOWN arrow keys to navigate the different speeds, then press ENTER to change to the selected speed.'), // jshint ignore: line
gettext('Press UP to enter the speed menu then use the UP and DOWN arrow keys to navigate the different speeds, then press ENTER to change to the selected speed.'), // eslint-disable-line max-len, indent
'</p>',
'<button class="control speed-button" aria-disabled="false" aria-expanded="false"',
'title="',
@@ -242,20 +242,20 @@ define(
this.resetActiveSpeed();
this.setActiveSpeed(speed);
},
resetActiveSpeed: function() {
var speedOptions = this.speedsContainer.find('li');
$(speedOptions).each(function(index, el) {
$(el).removeClass('is-active')
.find('.speed-option')
.attr('aria-pressed', 'false');
});
},
setActiveSpeed: function(speed) {
var speedOption = this.speedsContainer.find('li[data-speed="' + speed + '"]');
speedOption.addClass('is-active')
.find('.speed-option')
.attr('aria-pressed', 'true');
@@ -280,7 +280,7 @@ define(
clickLinkHandler: function (event) {
var el = $(event.currentTarget).parent(),
speed = $(el).data('speed');
this.resetActiveSpeed();
this.setActiveSpeed(speed);
this.state.videoCommands.execute('speed', speed);

View File

@@ -580,22 +580,22 @@ function (Component) {
},
options = {
items: [{
label: i18n['Play'], // jshint ignore:line
label: i18n.Play,
callback: function () {
state.videoCommands.execute('togglePlayback');
},
initialize: function (menuitem) {
state.el.on({
'play': function () {
menuitem.setLabel(i18n['Pause']); // jshint ignore:line
menuitem.setLabel(i18n.Pause);
},
'pause': function () {
menuitem.setLabel(i18n['Play']); // jshint ignore:line
menuitem.setLabel(i18n.Play);
}
});
}
}, {
label: state.videoVolumeControl.getMuteStatus() ? i18n['Unmute'] : i18n['Mute'], // jshint ignore:line
label: state.videoVolumeControl.getMuteStatus() ? i18n.Unmute : i18n.Mute,
callback: function () {
state.videoCommands.execute('toggleMute');
},
@@ -603,9 +603,9 @@ function (Component) {
state.el.on({
'volumechange': function () {
if (state.videoVolumeControl.getMuteStatus()) {
menuitem.setLabel(i18n['Unmute']); // jshint ignore:line
menuitem.setLabel(i18n.Unmute);
} else {
menuitem.setLabel(i18n['Mute']); // jshint ignore:line
menuitem.setLabel(i18n.Mute);
}
}
});
@@ -627,7 +627,7 @@ function (Component) {
});
}
}, {
label: i18n['Speed'], // jshint ignore:line
label: i18n.Speed,
items: _.map(state.speeds, function (speed) {
var isSelected = speed === state.speed;
return {label: speed + 'x', callback: speedCallback, speed: speed, isSelected: isSelected};

View File

@@ -102,7 +102,7 @@
langTitle: gettext('Open language menu')
}
)
);
var subtitlesHtml = HtmlUtils.interpolateHtml(
@@ -693,7 +693,7 @@
$li.append($link);
$menu.append($li);
});
HtmlUtils.append(
this.languageChooserEl,
HtmlUtils.HTML($menu)
@@ -711,15 +711,15 @@
.removeClass('is-active')
.find('.control-lang')
.attr('aria-pressed', 'false');
$(e.currentTarget).attr('aria-pressed', 'true');
state.el.trigger('language_menu:change', [langCode]);
self.fetchCaption();
// update the closed-captions lang attribute
self.captionDisplayEl.attr('lang', langCode);
// update the transcript lang attribute
self.subtitlesMenuEl.attr('lang', langCode);
self.closeLanguageMenu(e);
@@ -794,7 +794,7 @@
self.state.el.addClass('is-captions-rendered');
self.subtitlesEl
.attr('aria-label', gettext('Activating a link in this group will skip to the corresponding point in the video.')); // jshint ignore:line
.attr('aria-label', gettext('Activating a link in this group will skip to the corresponding point in the video.')); // eslint-disable-line max-len
self.subtitlesEl.find('.transcript-title')
.text(gettext('Video transcript'));
@@ -808,7 +808,7 @@
.attr('lang', $('html').attr('lang'));
self.container.find('.menu-container .instructions')
.text(gettext('Press the UP arrow key to enter the language menu then use UP and DOWN arrow keys to navigate language options. Press ENTER to change to the selected language.')); // jshint ignore:line
.text(gettext('Press the UP arrow key to enter the language menu then use UP and DOWN arrow keys to navigate language options. Press ENTER to change to the selected language.')); // eslint-disable-line max-len
};
@@ -827,7 +827,7 @@
var topSpacer = HtmlUtils.interpolateHtml(
HtmlUtils.HTML([
'<li class="spacing" style="height: {height}px">',
'<a href="#transcript-end-{id}" id="transcript-start-{id}" class="transcript-start"></a>', // jshint ignore:line
'<a href="#transcript-end-{id}" id="transcript-start-{id}" class="transcript-start"></a>', // eslint-disable-line max-len, indent
'</li>'
].join('')),
{
@@ -839,7 +839,7 @@
var bottomSpacer = HtmlUtils.interpolateHtml(
HtmlUtils.HTML([
'<li class="spacing" style="height: {height}px">',
'<a href="#transcript-start-{id}" id="transcript-end-{id}" class="transcript-end"></a>', // jshint ignore:line
'<a href="#transcript-start-{id}" id="transcript-end-{id}" class="transcript-end"></a>', // eslint-disable-line max-len, indent
'</li>'
].join('')),
{
@@ -852,7 +852,7 @@
this.subtitlesMenuEl,
topSpacer
);
HtmlUtils.append(
this.subtitlesMenuEl,
bottomSpacer
@@ -1194,7 +1194,7 @@
this.captionDisplayEl
.text(gettext('(Caption will be displayed when you start playing the video.)'));
}
this.state.el.trigger('captions:show');
},

View File

@@ -72,7 +72,7 @@
renderError: function () {
this.$el.text(
gettext('Your request could not be completed. Reload the page and try again. If the issue persists, click the Help tab to report the problem.') // jshint ignore: line
gettext('Your request could not be completed. Reload the page and try again. If the issue persists, click the Help tab to report the problem.') // eslint-disable-line max-len
);
},

View File

@@ -1,4 +1,4 @@
/* globals DiscussionUtil */
/* globals DiscussionUtil, Comments */
(function() {
'use strict';
@@ -105,7 +105,7 @@
Content.prototype.resetComments = function(children) {
var comment, _i, _len, _ref, _results;
this.set('children', []);
this.set('comments', new Comments()); // jshint ignore:line
this.set('comments', new Comments());
_ref = children || [];
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {

View File

@@ -27,13 +27,10 @@
sort: sort_preference
});
course_settings = new DiscussionCourseSettings(element.data("course-settings"));
// suppressing Do not use 'new' for side effects.
/* jshint -W031*/
new DiscussionRouter({
new DiscussionRouter({ // eslint-disable-line no-new
discussion: discussion,
course_settings: course_settings
});
/* jshint +W031*/
if (!Backbone.History.started) {
Backbone.history.start({pushState: true, root: "/courses/" + $$course_id + "/discussion/forum/"});
} else {

View File

@@ -378,8 +378,7 @@
});
htmlString = $div.html();
htmlString = htmlString.replace(/\\\$/g, ESCAPED_DOLLAR);
// suppressing Don't make functions within a loop.
/* jshint -W083 */
/* eslint-disable no-loop-func */
while (true) {
if (RE_INLINEMATH.test(htmlString)) {
htmlString = htmlString.replace(RE_INLINEMATH, function($0, $1, $2, $3) {
@@ -400,7 +399,7 @@
break;
}
}
/* jshint +W083 */
/* eslint-enable no-loop-func */
htmlString = processedHtmlString;
htmlString = htmlString.replace(new RegExp(ESCAPED_DOLLAR, 'g'), '\\$');
htmlString = htmlString.replace(/\\\\\\\\/g, ESCAPED_BACKSLASH);

View File

@@ -111,4 +111,4 @@
}
});
}
}).call(window); // jshint ignore:line
}).call(window);

View File

@@ -1,4 +1,4 @@
/* jshint node: true */
/* eslint-env node */
'use strict';
// By default, fixtures are loaded from spec/javascripts/fixtures but in karma everything gets served from /base

View File

@@ -33,9 +33,8 @@
// does not use graceful-fs and tries to read files simultaneously.
//
/* eslint-env node */
/* jshint node: true */
/*jshint -W079 */
'use strict';
var path = require('path');

View File

@@ -12,9 +12,7 @@
DiscussionSpecHelper.setUpGlobals();
DiscussionSpecHelper.setUnderscoreFixtures();
// suppressing Line is too long (4272 characters!)
/* jshint -W101 */
appendSetFixtures("<script type=\"text/template\" id=\"thread-list-template\">\n <div class=\"forum-nav-header\">\n <button type=\"button\" class=\"forum-nav-browse\" id=\"forum-nav-browse\" aria-haspopup=\"true\">\n <span class=\"icon fa fa-bars\" aria-hidden=\"true\"></span>\n <span class=\"sr\">Discussion topics; currently listing: </span>\n <span class=\"forum-nav-browse-current\">All Discussions</span>\n ▾\n </button>\n <form class=\"forum-nav-search\">\n <label>\n <span class=\"sr\">Search all posts</span>\n <input class=\"forum-nav-search-input\" id=\"forum-nav-search\" type=\"text\" placeholder=\"Search all posts\">\n <span class=\"icon fa fa-search\" aria-hidden=\"true\"></span>\n </label>\n </form>\n </div>\n <div class=\"forum-nav-browse-menu-wrapper\" style=\"display: none\">\n <form class=\"forum-nav-browse-filter\">\n <label>\n <span class=\"sr\">Filter Topics</span>\n <input type=\"text\" class=\"forum-nav-browse-filter-input\" placeholder=\"filter topics\">\n </label>\n </form>\n <ul class=\"forum-nav-browse-menu\">\n <li class=\"forum-nav-browse-menu-item forum-nav-browse-menu-all\">\n <a href=\"#\" class=\"forum-nav-browse-title\">All Discussions</a>\n </li>\n <li class=\"forum-nav-browse-menu-item forum-nav-browse-menu-following\">\n <a href=\"#\" class=\"forum-nav-browse-title\"><span class=\"icon fa fa-star\" aria-hidden=\"true\"></span>Posts I'm Following</a>\n </li>\n <li class=\"forum-nav-browse-menu-item\">\n <a href=\"#\" class=\"forum-nav-browse-title\">Parent</a>\n <ul class=\"forum-nav-browse-submenu\">\n <li class=\"forum-nav-browse-menu-item\">\n <a href=\"#\" class=\"forum-nav-browse-title\">Target</a>\n <ul class=\"forum-nav-browse-submenu\">\n <li\n class=\"forum-nav-browse-menu-item\"\n data-discussion-id=\"child\"\n data-cohorted=\"false\"\n >\n <a href=\"#\" class=\"forum-nav-browse-title\">Child</a>\n </li>\n </ul>\n <li\n class=\"forum-nav-browse-menu-item\"\n data-discussion-id=\"sibling\"\n data-cohorted=\"false\"\n >\n <a href=\"#\" class=\"forum-nav-browse-title\">Sibling</a>\n </li>\n </ul>\n </li>\n <li\n class=\"forum-nav-browse-menu-item\"\n data-discussion-id=\"other\"\n data-cohorted=\"true\"\n >\n <a href=\"#\" class=\"forum-nav-browse-title\">Other Category</a>\n </li>\n </ul>\n </div>\n <div class=\"forum-nav-thread-list-wrapper\" id=\"sort-filter-wrapper\" tabindex=\"-1\">\n <div class=\"forum-nav-refine-bar\">\n <label class=\"forum-nav-filter-main\">\n <select class=\"forum-nav-filter-main-control\">\n <option value=\"all\">Show all</option>\n <option value=\"unread\">Unread</option>\n <option value=\"unanswered\">Unanswered</option>\n <option value=\"flagged\">Flagged</option>\n </select>\n </label>\n <% if (isCohorted && isPrivilegedUser) { %>\n <label class=\"forum-nav-filter-cohort\">\n <span class=\"sr\">Cohort:</span>\n <select class=\"forum-nav-filter-cohort-control\">\n <option value=\"\">in all cohorts</option>\n <option value=\"1\">Cohort1</option>\n <option value=\"2\">Cohort2</option>\n </select>\n </label>\n <% } %>\n <label class=\"forum-nav-sort\">\n <select class=\"forum-nav-sort-control\">\n <option value=\"activity\">by recent activity</option>\n <option value=\"comments\">by most activity</option>\n <option value=\"votes\">by most votes</option>\n </select>\n </label>\n </div>\n </div>\n <div class=\"search-alerts\"></div>\n <ul class=\"forum-nav-thread-list\"></ul>\n</script>");
/* jshint +W101 */
appendSetFixtures("<script type=\"text/template\" id=\"thread-list-template\">\n <div class=\"forum-nav-header\">\n <button type=\"button\" class=\"forum-nav-browse\" id=\"forum-nav-browse\" aria-haspopup=\"true\">\n <span class=\"icon fa fa-bars\" aria-hidden=\"true\"></span>\n <span class=\"sr\">Discussion topics; currently listing: </span>\n <span class=\"forum-nav-browse-current\">All Discussions</span>\n ▾\n </button>\n <form class=\"forum-nav-search\">\n <label>\n <span class=\"sr\">Search all posts</span>\n <input class=\"forum-nav-search-input\" id=\"forum-nav-search\" type=\"text\" placeholder=\"Search all posts\">\n <span class=\"icon fa fa-search\" aria-hidden=\"true\"></span>\n </label>\n </form>\n </div>\n <div class=\"forum-nav-browse-menu-wrapper\" style=\"display: none\">\n <form class=\"forum-nav-browse-filter\">\n <label>\n <span class=\"sr\">Filter Topics</span>\n <input type=\"text\" class=\"forum-nav-browse-filter-input\" placeholder=\"filter topics\">\n </label>\n </form>\n <ul class=\"forum-nav-browse-menu\">\n <li class=\"forum-nav-browse-menu-item forum-nav-browse-menu-all\">\n <a href=\"#\" class=\"forum-nav-browse-title\">All Discussions</a>\n </li>\n <li class=\"forum-nav-browse-menu-item forum-nav-browse-menu-following\">\n <a href=\"#\" class=\"forum-nav-browse-title\"><span class=\"icon fa fa-star\" aria-hidden=\"true\"></span>Posts I'm Following</a>\n </li>\n <li class=\"forum-nav-browse-menu-item\">\n <a href=\"#\" class=\"forum-nav-browse-title\">Parent</a>\n <ul class=\"forum-nav-browse-submenu\">\n <li class=\"forum-nav-browse-menu-item\">\n <a href=\"#\" class=\"forum-nav-browse-title\">Target</a>\n <ul class=\"forum-nav-browse-submenu\">\n <li\n class=\"forum-nav-browse-menu-item\"\n data-discussion-id=\"child\"\n data-cohorted=\"false\"\n >\n <a href=\"#\" class=\"forum-nav-browse-title\">Child</a>\n </li>\n </ul>\n <li\n class=\"forum-nav-browse-menu-item\"\n data-discussion-id=\"sibling\"\n data-cohorted=\"false\"\n >\n <a href=\"#\" class=\"forum-nav-browse-title\">Sibling</a>\n </li>\n </ul>\n </li>\n <li\n class=\"forum-nav-browse-menu-item\"\n data-discussion-id=\"other\"\n data-cohorted=\"true\"\n >\n <a href=\"#\" class=\"forum-nav-browse-title\">Other Category</a>\n </li>\n </ul>\n </div>\n <div class=\"forum-nav-thread-list-wrapper\" id=\"sort-filter-wrapper\" tabindex=\"-1\">\n <div class=\"forum-nav-refine-bar\">\n <label class=\"forum-nav-filter-main\">\n <select class=\"forum-nav-filter-main-control\">\n <option value=\"all\">Show all</option>\n <option value=\"unread\">Unread</option>\n <option value=\"unanswered\">Unanswered</option>\n <option value=\"flagged\">Flagged</option>\n </select>\n </label>\n <% if (isCohorted && isPrivilegedUser) { %>\n <label class=\"forum-nav-filter-cohort\">\n <span class=\"sr\">Cohort:</span>\n <select class=\"forum-nav-filter-cohort-control\">\n <option value=\"\">in all cohorts</option>\n <option value=\"1\">Cohort1</option>\n <option value=\"2\">Cohort2</option>\n </select>\n </label>\n <% } %>\n <label class=\"forum-nav-sort\">\n <select class=\"forum-nav-sort-control\">\n <option value=\"activity\">by recent activity</option>\n <option value=\"comments\">by most activity</option>\n <option value=\"votes\">by most votes</option>\n </select>\n </label>\n </div>\n </div>\n <div class=\"search-alerts\"></div>\n <ul class=\"forum-nav-thread-list\"></ul>\n</script>"); // eslint-disable-line max-len
this.threads = [
DiscussionViewSpecHelper.makeThreadWithProps({
id: "1",

View File

@@ -135,12 +135,11 @@
it(
"body with " + numImages + " images and " + (truncatedText ? "truncated" : "untruncated") +
" text",
// suppressing Don't make functions within a loop.
/* jshint -W083 */
// eslint-disable no-loop-func
function() {
return checkPostWithImages(numImages, truncatedText, this.threadData, this.imageTag);
}
/* jshint +W083 */
// eslint-enable no-loop-func
);
}
}

View File

@@ -1,3 +1,5 @@
/* eslint-env node */
// Extensions to Jasmine.
//
// This file adds the following:
@@ -9,7 +11,6 @@
// jQuery has been loaded, we set these matchers up again in this module.
(function(root, factory) {
/* jshint strict: false */
if (typeof define === 'function' && define.amd) {
require(['jquery'], function ($) {
factory(root, $);
@@ -18,7 +19,6 @@
factory(root, root.jQuery);
}
}((function() {
/* jshint strict: false */
return this;
}()), function(window, $) {
'use strict';
@@ -91,7 +91,7 @@
});
});
/* jshint ignore:start */
/* eslint-disable */
// All the code below is taken from:
// https://github.com/velesin/jasmine-jquery/blob/2.1.1/lib/jasmine-jquery.js
beforeEach(function() {
@@ -271,5 +271,5 @@
data.handlers = [];
}
};
/* jshint ignore:end */
/* eslint-enable */
}));

View File

@@ -1,5 +1,6 @@
/* eslint-env node */
// Custom library to replace the legacy non jasmine 2.0 compatible jasmine-stealth
// jshint ignore: start
(function (root, factory) {
factory(root, root.jasmine, root._);
}((function () {
@@ -61,4 +62,4 @@
spyOnConstructor: spyOnConstructor,
clearSpies: clearSpies
};
}));
}));

View File

@@ -1,12 +1,11 @@
/* eslint-env node */
// Takes a latch function and optionally timeout and error message.
// Polls the latch function until the it returns true or the maximum timeout expires
// whichever comes first.
(function(root, factory) {
/* jshint strict: false */
factory(root, root.jQuery);
}((function() {
/* jshint strict: false */
return this;
}()), function(window, $) {
'use strict';
@@ -30,7 +29,7 @@
} else {
if (elapsedTimeInMs >= maxTimeout) {
// explicitly fail the spec with the given message
fail(message); // jshint ignore:line
fail(message);
// clear timeout and reject the promise
realClearTimeout(timeout);

View File

@@ -107,7 +107,6 @@ describe("Formula Equation Preview", function () {
});
it('does not request again if the initial request has already been made', function (done) {
// jshint undef:false
expect(window.Problem.inputAjax.calls.count()).toEqual(1);
// Reset the spy in order to check calls again.

View File

@@ -1,8 +1,7 @@
// Karma config for common suite.
// Docs and troubleshooting tips in common/static/common/js/karma.common.conf.js
/* jshint node: true */
/*jshint -W079 */
/* eslint-env node */
'use strict';
var path = require('path');
var configModule = require(path.join(__dirname, '../../common/static/common/js/karma.common.conf.js'));

View File

@@ -1,8 +1,7 @@
// Karma config for common-requirejs suite.
// Docs and troubleshooting tips in common/static/common/js/karma.common.conf.js
/* jshint node: true */
/*jshint -W079 */
/* eslint-env node */
'use strict';
var path = require('path');

View File

@@ -46,7 +46,7 @@
gettext('View Teams in the %(topic_name)s Topic'),
{ topic_name: this.model.get('name') }, true
));
return '<span class="sr">' + screenReaderText + '</span><span class="icon fa fa-arrow-right" aria-hidden="true"></span>'; // jshint ignore:line
return '<span class="sr">' + screenReaderText + '</span><span class="icon fa fa-arrow-right" aria-hidden="true"></span>'; // eslint-disable-line max-len
}
});

View File

@@ -35,16 +35,16 @@
// The text that appears on the dialog box when entering Images.
var imageDialogText = gettext("Insert Image (upload file or type URL)"),
imageUrlHelpText = gettext("Type in a URL or use the \"Choose File\" button to upload a file from your machine. (e.g. 'http://example.com/img/clouds.jpg')"), // jshint ignore:line
imageUrlHelpText = gettext("Type in a URL or use the \"Choose File\" button to upload a file from your machine. (e.g. 'http://example.com/img/clouds.jpg')"), // eslint-disable-line max-len
imageDescriptionLabel = gettext("Image Description"),
imageDefaultText = "http://", // The default text that appears in input
imageDescError = gettext("Please describe this image or agree that it has no contextual value by checking the checkbox."), // jshint ignore:line
imageDescriptionHelpText = gettext("e.g. 'Sky with clouds'. The description is helpful for users who cannot see the image."), // jshint ignore:line
imageDescError = gettext('Please describe this image or agree that it has no contextual value by checking the checkbox.'), // eslint-disable-line max-len
imageDescriptionHelpText = gettext("e.g. 'Sky with clouds'. The description is helpful for users who cannot see the image."), // eslint-disable-line max-len
imageDescriptionHelpLink = {
href: 'http://www.w3.org/TR/html5/embedded-content-0.html#alt',
text: gettext("How to create useful text alternatives.")
},
imageIsDecorativeLabel = gettext("This image is for decorative purposes only and does not require a description."); // jshint ignore:line
imageIsDecorativeLabel = gettext('This image is for decorative purposes only and does not require a description.'); // eslint-disable-line max-len
// Text that is shared between both link and image dialog boxes.
var defaultHelpHoverTitle = gettext("Markdown Editing Help"),

View File

@@ -20,7 +20,7 @@
!function ($) {
"use strict"; // jshint ;_;
"use strict";
/* ALERT CLASS DEFINITION
@@ -87,4 +87,4 @@
$('body').on('click.alert.data-api', dismiss, Alert.prototype.close)
})
}(window.jQuery);
}(window.jQuery);

View File

@@ -20,7 +20,7 @@
!function ($) {
"use strict"; // jshint ;_;
"use strict";
/* COLLAPSE PUBLIC CLASS DEFINITION
@@ -154,4 +154,4 @@
})
})
}(window.jQuery);
}(window.jQuery);

View File

@@ -20,7 +20,7 @@
!function ($) {
"use strict"; // jshint ;_;
'use strict';
/* MODAL CLASS DEFINITION
@@ -215,4 +215,4 @@
})
})
}(window.jQuery);
}(window.jQuery);

View File

@@ -22,7 +22,7 @@
$(function () {
"use strict"; // jshint ;_;
'use strict';
/* CSS TRANSITION SUPPORT (http://www.modernizr.com/)
@@ -58,4 +58,4 @@
})
}(window.jQuery);
}(window.jQuery);

View File

@@ -46,7 +46,7 @@
);
if (this.collection.findWhere({user: user})) {
message = gettext("Certificate of <%= user %> has already been invalidated. Please check your spelling and retry."); // jshint ignore:line
message = gettext('Certificate of <%= user %> has already been invalidated. Please check your spelling and retry.'); // eslint-disable-line max-len
this.escapeAndShowMessage(_.template(message)({user: user}));
}
else if (certificate_invalidation.isValid()) {
@@ -88,7 +88,7 @@
model.destroy({
success: function() {
self.escapeAndShowMessage(
gettext('The certificate for this learner has been re-validated and the system is re-running the grade for this learner.') // jshint ignore:line
gettext('The certificate for this learner has been re-validated and the system is re-running the grade for this learner.') // eslint-disable-line max-len
);
},
error: function(model, response) {
@@ -108,7 +108,7 @@
}
else {
self.escapeAndShowMessage(
gettext('Could not find Certificate Invalidation in the list. Please refresh the page and try again') // jshint ignore:line
gettext('Could not find Certificate Invalidation in the list. Please refresh the page and try again') // eslint-disable-line max-len
);
}
},
@@ -126,4 +126,4 @@
});
}
);
}).call(this, define || RequireJS.define);
}).call(this, define || RequireJS.define);

View File

@@ -67,7 +67,7 @@
}
else{
this.escapeAndShowMessage(
gettext('Could not find Certificate Exception in white list. Please refresh the page and try again') // jshint ignore:line
gettext('Could not find Certificate Exception in white list. Please refresh the page and try again') // eslint-disable-line max-len
);
}
},

View File

@@ -64,7 +64,7 @@
);
}
else if(certificate_exception.isValid()){
message = gettext("<%= user %> has been successfully added to the exception list. Click Generate Exception Certificate below to send the certificate."); // jshint ignore:line
message = gettext('<%= user %> has been successfully added to the exception list. Click Generate Exception Certificate below to send the certificate.'); // eslint-disable-line max-len
certificate_exception.save(
null,
{
@@ -118,4 +118,4 @@
});
}
);
}).call(this, define || RequireJS.define);
}).call(this, define || RequireJS.define);

View File

@@ -1,6 +1,8 @@
/**
* View for the receipt page.
*/
/* globals _, Backbone */
var edx = edx || {};
(function ($, _, Backbone) {
@@ -319,10 +321,10 @@ var edx = edx || {};
new edx.commerce.ReceiptView({
el: $('#receipt-container')
});
})(jQuery, _, Backbone);
})(jQuery, _, Backbone); // jshint ignore:line
function completeOrder(event) { // jshint ignore:line
function completeOrder(event) {
'use strict';
var courseKey = $(event).data("course-key"),
username = $(event).data("username"),
providerId = $(event).data("provider"),

View File

@@ -20,7 +20,7 @@
});
// 2. instantiating this button attaches events to all buttons in the courseware.
new BookmarksListButton(); // jshint ignore:line
new BookmarksListButton(); // eslint-disable-line no-new
};
}
);

View File

@@ -5,6 +5,9 @@
* for the dashboard should be implemented as self-contained
* modules with unit tests.
*/
/* globals Logger, accessible_modal, interpolate */
var edx = edx || {};
(function($, gettext, Logger, accessibleModal, interpolate) {
@@ -180,5 +183,4 @@
$("#unenroll_course_name").text($(event.target).data("course-name"));
});
};
})(jQuery, gettext, Logger, accessible_modal, interpolate); // jshint undef:false
})(jQuery, gettext, Logger, accessible_modal, interpolate);

View File

@@ -32,7 +32,7 @@
this.showNotification({
type: 'confirmation',
title: StringUtils.interpolate(
gettext("This course uses automatic cohorting for verified track learners. You cannot disable cohorts, and you cannot rename the manual cohort named '{verifiedCohortName}'. To change the configuration for verified track cohorts, contact your edX partner manager."), // jshint ignore:line
gettext("This course uses automatic cohorting for verified track learners. You cannot disable cohorts, and you cannot rename the manual cohort named '{verifiedCohortName}'. To change the configuration for verified track cohorts, contact your edX partner manager."), // eslint-disable-line max-len
{verifiedCohortName: verifiedCohortName}
)
});
@@ -42,7 +42,7 @@
this.showNotification({
type: 'error',
title: StringUtils.interpolate(
gettext("This course has automatic cohorting enabled for verified track learners, but the required cohort does not exist. You must create a manually-assigned cohort named '{verifiedCohortName}' for the feature to work."), // jshint ignore:line
gettext("This course has automatic cohorting enabled for verified track learners, but the required cohort does not exist. You must create a manually-assigned cohort named '{verifiedCohortName}' for the feature to work."), // eslint-disable-line max-len
{verifiedCohortName: verifiedCohortName}
)
});
@@ -52,7 +52,7 @@
else {
this.showNotification({
type: 'error',
title: gettext('This course has automatic cohorting enabled for verified track learners, but cohorts are disabled. You must enable cohorts for the feature to work.') // jshint ignore:line
title: gettext('This course has automatic cohorting enabled for verified track learners, but cohorts are disabled. You must enable cohorts for the feature to work.') // eslint-disable-line max-len
});
enableCohortsCheckbox.prop('disabled', false);
}

View File

@@ -6,9 +6,7 @@ define(['jquery', 'logger', 'js/courseware/toggle_element_visibility', 'moment']
beforeEach(function() {
loadFixtures('js/fixtures/courseware/course_updates.html');
/*jshint newcap: false */
ToggleElementVisibility();
/*jshint newcap: true */
spyOn(Logger, 'log');
});

View File

@@ -7,7 +7,7 @@ define(['edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers', 'js/shoppingcart/sh
var requests = null;
beforeEach(function() {
setFixtures('<section class="wrapper confirm-enrollment shopping-cart cart-view"><form action="" method="post"><input type="hidden" name="" value="" /><span class="icon fa fa-caret-right"></span><input type="submit" value="Payment"/></form></section>'); // jshint ignore:line
setFixtures('<section class="wrapper confirm-enrollment shopping-cart cart-view"><form action="" method="post"><input type="hidden" name="" value="" /><span class="icon fa fa-caret-right"></span><input type="submit" value="Payment"/></form></section>'); // eslint-disable-line max-len
view = new edx.shoppingcart.showcart.CartView({
el: $('.confirm-enrollment.cart-view form')

View File

@@ -39,7 +39,7 @@
var fields = html || '';
this.successMessage = HtmlUtils.interpolateHtml(
// eslint-disable-next-line
gettext('We have sent an email message with password reset instructions to the email address you provided. If you do not receive this message, {anchorStart}contact technical support{anchorEnd}.'), { // jshint ignore:line
gettext('We have sent an email message with password reset instructions to the email address you provided. If you do not receive this message, {anchorStart}contact technical support{anchorEnd}.'), { // eslint-disable-line max-len
anchorStart: HtmlUtils.HTML('<a href="' + this.supportURL + '">'),
anchorEnd: HtmlUtils.HTML('</a>')
}
@@ -151,4 +151,3 @@
});
});
}).call(this, define || RequireJS.define);

View File

@@ -34,7 +34,7 @@
aboutSectionsData = [
{
title: gettext('Basic Account Information'),
subtitle: gettext('These settings include basic information about your account. You can also specify additional information and see your linked social accounts on this page.'), /* jshint ignore:line */
subtitle: gettext('These settings include basic information about your account. You can also specify additional information and see your linked social accounts on this page.'), // eslint-disable-line max-len
fields: [
{
view: new AccountSettingsFieldViews.ReadonlyFieldView({
@@ -42,7 +42,7 @@
title: gettext('Username'),
valueAttribute: 'username',
helpMessage: StringUtils.interpolate(
gettext('The name that identifies you throughout {platform_name}. You cannot change your username.'), /* jshint ignore:line */
gettext('The name that identifies you throughout {platform_name}. You cannot change your username.'), // eslint-disable-line max-len
{platform_name: platformName}
)
})
@@ -53,7 +53,7 @@
title: gettext('Full Name'),
valueAttribute: 'name',
helpMessage: gettext(
'The name that is used for ID verification and appears on your certificates. Other learners never see your full name. Make sure to enter your name exactly as it appears on your government-issued photo ID, including any non-Roman characters.' /* jshint ignore:line */
'The name that is used for ID verification and appears on your certificates. Other learners never see your full name. Make sure to enter your name exactly as it appears on your government-issued photo ID, including any non-Roman characters.' // eslint-disable-line max-len
),
persistChanges: true
})
@@ -64,7 +64,7 @@
title: gettext('Email Address'),
valueAttribute: 'email',
helpMessage: StringUtils.interpolate(
gettext('The email address you use to sign in. Communications from {platform_name} and your courses are sent to this address.'), /* jshint ignore:line */
gettext('The email address you use to sign in. Communications from {platform_name} and your courses are sent to this address.'), // eslint-disable-line max-len
{platform_name: platformName}
),
persistChanges: true
@@ -80,7 +80,7 @@
linkTitle: gettext('Reset Your Password'),
linkHref: fieldsData.password.url,
helpMessage: StringUtils.interpolate(
gettext('When you select "Reset Your Password", a message will be sent to the email address for your {platform_name} account. Click the link in the message to reset your password.'), /* jshint ignore:line */
gettext('When you select "Reset Your Password", a message will be sent to the email address for your {platform_name} account. Click the link in the message to reset your password.'), // eslint-disable-line max-len
{platform_name: platformName}
)
})
@@ -93,7 +93,7 @@
required: true,
refreshPageOnSave: true,
helpMessage: StringUtils.interpolate(
gettext('The language used throughout this site. This site is currently available in a limited number of languages.'), /* jshint ignore:line */
gettext('The language used throughout this site. This site is currently available in a limited number of languages.'), // eslint-disable-line max-len
{platform_name: platformName}
),
options: fieldsData.language.options,
@@ -207,7 +207,7 @@
{
title: gettext('My Orders'),
subtitle: StringUtils.interpolate(
gettext('This page contains information about orders that you have placed with {platform_name}.'), /* jshint ignore:line */
gettext('This page contains information about orders that you have placed with {platform_name}.'), // eslint-disable-line max-len
{platform_name: platformName}
),
fields: _.map(ordersHistoryData, function(order) {

View File

@@ -44,7 +44,7 @@
return HtmlUtils.joinHtml(
this.indicators.success,
StringUtils.interpolate(
gettext('We\'ve sent a confirmation message to {new_email_address}. Click the link in the message to update your email address.'), /* jshint ignore:line */
gettext('We\'ve sent a confirmation message to {new_email_address}. Click the link in the message to update your email address.'), // eslint-disable-line max-len
{'new_email_address': this.fieldValue()}
)
);
@@ -70,7 +70,7 @@
view.showNotificationMessage(
HtmlUtils.joinHtml(
view.indicators.error,
gettext('You must sign out and sign back in before your language changes take effect.') // jshint ignore:line
gettext('You must sign out and sign back in before your language changes take effect.') // eslint-disable-line max-len
)
);
}
@@ -114,7 +114,7 @@
return HtmlUtils.joinHtml(
this.indicators.success,
StringUtils.interpolate(
gettext('We\'ve sent a message to {email_address}. Click the link in the message to reset your password.'), /* jshint ignore:line */
gettext('We\'ve sent a message to {email_address}. Click the link in the message to reset your password.'), // eslint-disable-line max-len
{'email_address': this.model.get(this.options.emailAttribute)}
)
);
@@ -161,7 +161,7 @@
linkTitle = gettext('Unlink This Account');
linkClass = 'social-field-linked';
subTitle = StringUtils.interpolate(
gettext('You can use your {accountName} account to sign in to your {platformName} account.'), /* jshint ignore:line */
gettext('You can use your {accountName} account to sign in to your {platformName} account.'), // eslint-disable-line max-len
{accountName: this.options.title, platformName: this.options.platformName}
);
screenReaderTitle = StringUtils.interpolate(
@@ -172,7 +172,7 @@
linkTitle = gettext('Link Your Account');
linkClass = 'social-field-unlinked';
subTitle = StringUtils.interpolate(
gettext('Link your {accountName} account to your {platformName} account and use {accountName} to sign in to {platformName}.'), /* jshint ignore:line */
gettext('Link your {accountName} account to your {platformName} account and use {accountName} to sign in to {platformName}.'), // eslint-disable-line max-len
{accountName: this.options.title, platformName: this.options.platformName}
);
}
@@ -236,7 +236,7 @@
return HtmlUtils.joinHtml(this.indicators.success, gettext('Successfully unlinked.'));
}
}),
OrderHistoryFieldView: FieldViews.ReadonlyFieldView.extend({
fieldType: 'orderHistory',
fieldTemplate: field_order_history_template,

View File

@@ -27,21 +27,21 @@
if (this.profileIsPrivate) {
this._super(
HtmlUtils.interpolateHtml(
gettext("You must specify your birth year before you can share your full profile. To specify your birth year, go to the {account_settings_page_link}"), // jshint ignore:line
gettext('You must specify your birth year before you can share your full profile. To specify your birth year, go to the {account_settings_page_link}'), // eslint-disable-line max-len
{'account_settings_page_link':accountSettingsLink}
)
);
} else if (this.requiresParentalConsent) {
this._super(
HtmlUtils.interpolateHtml(
gettext('You must be over 13 to share a full profile. If you are over 13, make sure that you have specified a birth year on the {account_settings_page_link}'), // jshint ignore:line
gettext('You must be over 13 to share a full profile. If you are over 13, make sure that you have specified a birth year on the {account_settings_page_link}'), // eslint-disable-line max-len
{'account_settings_page_link': accountSettingsLink}
)
);
}
else {
this._super('');
}
}
},
updateFieldValue: function() {

View File

@@ -1,7 +1,7 @@
;(function (define, undefined) {
'use strict';
define([
'gettext', 'jquery', 'underscore', 'backbone',
'gettext', 'jquery', 'underscore', 'backbone',
'edx-ui-toolkit/js/utils/html-utils',
'text!templates/fields/field_readonly.underscore',
'text!templates/fields/field_dropdown.underscore',
@@ -21,7 +21,7 @@
var FieldViews = {};
FieldViews.FieldView = Backbone.View.extend({
fieldType: 'generic',
className: function () {
@@ -32,27 +32,27 @@
indicators: {
'canEdit': HtmlUtils.joinHtml(
HtmlUtils.HTML('<span class="icon fa fa-pencil message-can-edit" aria-hidden="true"></span><span class="sr">'), // jshint ignore:line
HtmlUtils.HTML('<span class="icon fa fa-pencil message-can-edit" aria-hidden="true"></span><span class="sr">'), // eslint-disable-line max-len
gettext("Editable"),
HtmlUtils.HTML('</span>')
),
'error': HtmlUtils.joinHtml(
HtmlUtils.HTML('<span class="fa fa-exclamation-triangle message-error" aria-hidden="true"></span><span class="sr">'), // jshint ignore:line
HtmlUtils.HTML('<span class="fa fa-exclamation-triangle message-error" aria-hidden="true"></span><span class="sr">'), // eslint-disable-line max-len
gettext("Error"),
HtmlUtils.HTML('</span>')
),
'validationError': HtmlUtils.joinHtml(
HtmlUtils.HTML('<span class="fa fa-exclamation-triangle message-validation-error" aria-hidden="true"></span><span class="sr">'), // jshint ignore:line
HtmlUtils.HTML('<span class="fa fa-exclamation-triangle message-validation-error" aria-hidden="true"></span><span class="sr">'), // eslint-disable-line max-len
gettext("Validation Error"),
HtmlUtils.HTML('</span>')
),
'inProgress': HtmlUtils.joinHtml(
HtmlUtils.HTML('<span class="fa fa-spinner fa-pulse message-in-progress" aria-hidden="true"></span><span class="sr">'), // jshint ignore:line
HtmlUtils.HTML('<span class="fa fa-spinner fa-pulse message-in-progress" aria-hidden="true"></span><span class="sr">'), // eslint-disable-line max-len
gettext("In Progress"),
HtmlUtils.HTML('</span>')
),
'success': HtmlUtils.joinHtml(
HtmlUtils.HTML('<span class="fa fa-check message-success" aria-hidden="true"></span><span class="sr">'), // jshint ignore:line
HtmlUtils.HTML('<span class="fa fa-check message-success" aria-hidden="true"></span><span class="sr">'), // eslint-disable-line max-len
gettext("Success"),
HtmlUtils.HTML('</span>')
),

View File

@@ -1,8 +1,7 @@
// Karma config for lms suite.
// Docs and troubleshooting tips in common/static/common/js/karma.common.conf.js
/* jshint node: true */
/*jshint -W079 */
/* eslint-env node */
'use strict';
var path = require('path');
var configModule = require(path.join(__dirname, '../../common/static/common/js/karma.common.conf.js'));

View File

@@ -1,8 +1,7 @@
// Karma config for lms-coffee suite.
// Docs and troubleshooting tips in common/static/common/js/karma.common.conf.js
/* jshint node: true */
/*jshint -W079 */
/* eslint-env node */
'use strict';
var path = require('path');
var configModule = require(path.join(__dirname, '../../common/static/common/js/karma.common.conf.js'));

View File

@@ -22,7 +22,7 @@
$selectElement.change(function() {
var selectedOption;
if ($selectElement.attr('disabled')) {
return alert(gettext('You cannot view the course as a student or beta tester before the course release date.')); // jshint ignore:line
return alert(gettext('You cannot view the course as a student or beta tester before the course release date.')); // eslint-disable-line max-len, no-alert
}
selectedOption = $selectElement.find('option:selected');
if (selectedOption.val() === 'specific student') {

View File

@@ -51,7 +51,7 @@
'squire': 'xmodule_js/common_static/js/vendor/Squire',
'jasmine-imagediff': 'xmodule_js/common_static/js/vendor/jasmine-imagediff',
'domReady': 'xmodule_js/common_static/js/vendor/domReady',
'mathjax': '//cdn.mathjax.org/mathjax/2.6-latest/MathJax.js?config=TeX-MML-AM_SVG&delayStartupUntil=configured', // jshint ignore:line
mathjax: '//cdn.mathjax.org/mathjax/2.6-latest/MathJax.js?config=TeX-MML-AM_SVG&delayStartupUntil=configured', // eslint-disable-line max-len
'youtube': '//www.youtube.com/player_api?noext',
'coffee/src/ajax_prefix': 'xmodule_js/common_static/coffee/src/ajax_prefix',
'coffee/src/instructor_dashboard/student_admin': 'coffee/src/instructor_dashboard/student_admin',

View File

@@ -1,3 +1,5 @@
/* globals URI */
(function(URI) {
'use strict';
@@ -51,5 +53,4 @@
return v1;
})(XBlock.Runtime.v1);
}).call(this, URI); // jshint ignore:line
}).call(this, URI);

View File

@@ -22,7 +22,6 @@ var $$course_id = "${course_id | n, js_escaped_string}";
function DiscussionInlineBlock(runtime, element) {
'use strict';
var el = $(element).find('.discussion-module');
/* jshint nonew:false */
new DiscussionModuleView({ el: el });
}
</script>

View File

@@ -19,7 +19,7 @@
"devDependencies": {
"edx-custom-a11y-rules": "0.1.2",
"eslint": "^2.13.1",
"eslint-config-edx": "^1.2.0",
"eslint-config-edx": "^1.2.1",
"jasmine-core": "^2.4.1",
"jasmine-jquery": "^2.1.1",
"jquery": "^2.1.4",

View File

@@ -12,7 +12,7 @@ set -e
# Violations thresholds for failing the build
export PYLINT_THRESHOLD=3750
export ESLINT_THRESHOLD=49019
export ESLINT_THRESHOLD=48129
SAFELINT_THRESHOLDS=`cat scripts/safelint_thresholds.json`
export SAFELINT_THRESHOLDS=${SAFELINT_THRESHOLDS//[[:space:]]/}