diff --git a/.eslintrc.json b/.eslintrc.json index f858880c0f..36d4a7a626 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -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 + } } diff --git a/cms/static/cms/js/main.js b/cms/static/cms/js/main.js index 0cae898de3..219f362a7f 100644 --- a/cms/static/cms/js/main.js +++ b/cms/static/cms/js/main.js @@ -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); diff --git a/cms/static/cms/js/require-config.js b/cms/static/cms/js/require-config.js index 7f9e526e51..ebce5dc0f1 100644 --- a/cms/static/cms/js/require-config.js +++ b/cms/static/cms/js/require-config.js @@ -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, diff --git a/cms/static/cms/js/spec/main.js b/cms/static/cms/js/spec/main.js index 223a25b564..a74bf1cb9f 100644 --- a/cms/static/cms/js/spec/main.js +++ b/cms/static/cms/js/spec/main.js @@ -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); diff --git a/cms/static/cms/js/spec/main_spec.js b/cms/static/cms/js/spec/main_spec.js index 235ce31e96..e61d25d444 100644 --- a/cms/static/cms/js/spec/main_spec.js +++ b/cms/static/cms/js/spec/main_spec.js @@ -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); diff --git a/cms/static/cms/js/spec/main_squire.js b/cms/static/cms/js/spec/main_squire.js index 867047263d..b4eb462775 100644 --- a/cms/static/cms/js/spec/main_squire.js +++ b/cms/static/cms/js/spec/main_squire.js @@ -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); diff --git a/cms/static/js/certificates/collections/certificates.js b/cms/static/js/certificates/collections/certificates.js index 234dd0098b..778a43f7ed 100644 --- a/cms/static/js/certificates/collections/certificates.js +++ b/cms/static/js/certificates/collections/certificates.js @@ -1,6 +1,6 @@ // Backbone.js Application Collection: Certificates -define([ // jshint ignore:line +define([ 'backbone', 'gettext', 'js/certificates/models/certificate' diff --git a/cms/static/js/certificates/collections/signatories.js b/cms/static/js/certificates/collections/signatories.js index 3205fab41f..cd76e1c502 100644 --- a/cms/static/js/certificates/collections/signatories.js +++ b/cms/static/js/certificates/collections/signatories.js @@ -1,6 +1,6 @@ // Backbone.js Application Collection: Certificate Signatories -define([ // jshint ignore:line +define([ 'backbone', 'js/certificates/models/signatory' ], diff --git a/cms/static/js/certificates/factories/certificates_page_factory.js b/cms/static/js/certificates/factories/certificates_page_factory.js index a3943dfe78..39d7941f42 100644 --- a/cms/static/js/certificates/factories/certificates_page_factory.js +++ b/cms/static/js/certificates/factories/certificates_page_factory.js @@ -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', diff --git a/cms/static/js/certificates/models/signatory.js b/cms/static/js/certificates/models/signatory.js index 445743cfc5..499ff3467a 100644 --- a/cms/static/js/certificates/models/signatory.js +++ b/cms/static/js/certificates/models/signatory.js @@ -1,6 +1,6 @@ // Backbone.js Application Model: Certificate Signatory -define([ // jshint ignore:line +define([ 'underscore', 'backbone', 'backbone-relational' diff --git a/cms/static/js/certificates/spec/custom_matchers.js b/cms/static/js/certificates/spec/custom_matchers.js index 43b11bff37..38e21459e0 100644 --- a/cms/static/js/certificates/spec/custom_matchers.js +++ b/cms/static/js/certificates/spec/custom_matchers.js @@ -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({ diff --git a/cms/static/js/certificates/spec/models/certificate_spec.js b/cms/static/js/certificates/spec/models/certificate_spec.js index 5197209e2a..bfd229feab 100644 --- a/cms/static/js/certificates/spec/models/certificate_spec.js +++ b/cms/static/js/certificates/spec/models/certificate_spec.js @@ -1,6 +1,6 @@ // Jasmine Test Suite: Certifiate Model -define([ // jshint ignore:line +define([ 'js/certificates/models/certificate', 'js/certificates/collections/certificates' ], diff --git a/cms/static/js/certificates/spec/views/certificate_details_spec.js b/cms/static/js/certificates/spec/views/certificate_details_spec.js index 7c02d4ef14..863fac166f 100644 --- a/cms/static/js/certificates/spec/views/certificate_details_spec.js +++ b/cms/static/js/certificates/spec/views/certificate_details_spec.js @@ -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 diff --git a/cms/static/js/certificates/spec/views/certificate_editor_spec.js b/cms/static/js/certificates/spec/views/certificate_editor_spec.js index 0cee81f0f7..f674a9d56b 100644 --- a/cms/static/js/certificates/spec/views/certificate_editor_spec.js +++ b/cms/static/js/certificates/spec/views/certificate_editor_spec.js @@ -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() { diff --git a/cms/static/js/certificates/spec/views/certificate_preview_spec.js b/cms/static/js/certificates/spec/views/certificate_preview_spec.js index ae2d40009d..f0d8e3e990 100644 --- a/cms/static/js/certificates/spec/views/certificate_preview_spec.js +++ b/cms/static/js/certificates/spec/views/certificate_preview_spec.js @@ -1,6 +1,6 @@ // Jasmine Test Suite: Certificate Web Preview -define([ // jshint ignore:line +define([ 'underscore', 'jquery', 'js/models/course', diff --git a/cms/static/js/certificates/spec/views/certificates_list_spec.js b/cms/static/js/certificates/spec/views/certificates_list_spec.js index 3deb6a1cb9..1f39ebb512 100644 --- a/cms/static/js/certificates/spec/views/certificates_list_spec.js +++ b/cms/static/js/certificates/spec/views/certificates_list_spec.js @@ -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() { diff --git a/cms/static/js/certificates/views/certificate_details.js b/cms/static/js/certificates/views/certificate_details.js index 44823c59f6..04c1da58c9 100644 --- a/cms/static/js/certificates/views/certificate_details.js +++ b/cms/static/js/certificates/views/certificate_details.js @@ -1,6 +1,6 @@ // Backbone Application View: Certificate Details -define([ // jshint ignore:line +define([ 'jquery', 'underscore', 'underscore.string', diff --git a/cms/static/js/certificates/views/certificate_editor.js b/cms/static/js/certificates/views/certificate_editor.js index cff8eb14c4..9105ebc211 100644 --- a/cms/static/js/certificates/views/certificate_editor.js +++ b/cms/static/js/certificates/views/certificate_editor.js @@ -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(); }, diff --git a/cms/static/js/certificates/views/certificate_item.js b/cms/static/js/certificates/views/certificate_item.js index 9398d53ed7..9ba1e3b8b3 100644 --- a/cms/static/js/certificates/views/certificate_item.js +++ b/cms/static/js/certificates/views/certificate_item.js @@ -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', diff --git a/cms/static/js/certificates/views/certificate_preview.js b/cms/static/js/certificates/views/certificate_preview.js index 70bf9977ee..410501f9c3 100644 --- a/cms/static/js/certificates/views/certificate_preview.js +++ b/cms/static/js/certificates/views/certificate_preview.js @@ -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', diff --git a/cms/static/js/certificates/views/certificates_list.js b/cms/static/js/certificates/views/certificates_list.js index c6871ac00f..fe4e1d9d6a 100644 --- a/cms/static/js/certificates/views/certificates_list.js +++ b/cms/static/js/certificates/views/certificates_list.js @@ -1,6 +1,6 @@ // Backbone Application View: Certificates List -define([ // jshint ignore:line +define([ 'gettext', 'js/views/list', 'js/certificates/views/certificate_item' diff --git a/cms/static/js/certificates/views/certificates_page.js b/cms/static/js/certificates/views/certificates_page.js index 0fc7401a05..8105d4fc38 100644 --- a/cms/static/js/certificates/views/certificates_page.js +++ b/cms/static/js/certificates/views/certificates_page.js @@ -1,6 +1,6 @@ // Backbone Application View: Certificates Page -define([ // jshint ignore:line +define([ 'jquery', 'underscore', 'gettext', diff --git a/cms/static/js/certificates/views/signatory_details.js b/cms/static/js/certificates/views/signatory_details.js index 1f2385a276..d9a0fc3b27 100644 --- a/cms/static/js/certificates/views/signatory_details.js +++ b/cms/static/js/certificates/views/signatory_details.js @@ -1,6 +1,6 @@ // Backbone Application View: Signatory Details -define([ // jshint ignore:line +define([ 'jquery', 'underscore', 'underscore.string', diff --git a/cms/static/js/certificates/views/signatory_editor.js b/cms/static/js/certificates/views/signatory_editor.js index e1166adc3d..7548fe9c50 100644 --- a/cms/static/js/certificates/views/signatory_editor.js +++ b/cms/static/js/certificates/views/signatory_editor.js @@ -1,6 +1,6 @@ // Backbone Application View: Signatory Editor -define([ // jshint ignore:line +define([ 'jquery', 'underscore', 'backbone', diff --git a/cms/static/js/collections/asset.js b/cms/static/js/collections/asset.js index 7e31a3c4f7..db32082608 100644 --- a/cms/static/js/collections/asset.js +++ b/cms/static/js/collections/asset.js @@ -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) diff --git a/cms/static/js/models/uploads.js b/cms/static/js/models/uploads.js index 6eaf020f60..4ffb4177ee 100644 --- a/cms/static/js/models/uploads.js +++ b/cms/static/js/models/uploads.js @@ -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} diff --git a/cms/static/js/programs/views/program_details_view.js b/cms/static/js/programs/views/program_details_view.js index 2fb9fafc6a..3d0f72ae5f 100644 --- a/cms/static/js/programs/views/program_details_view.js +++ b/cms/static/js/programs/views/program_details_view.js @@ -135,7 +135,6 @@ define([ }, getModalContent: function() { - /* jshint maxlen: 300 */ return { name: gettext('confirm'), title: gettext('Publish this program?'), diff --git a/cms/static/js/spec/views/login_studio_spec.js b/cms/static/js/spec/views/login_studio_spec.js index c3cb2aa3dd..ad5ed53352 100644 --- a/cms/static/js/spec/views/login_studio_spec.js +++ b/cms/static/js/spec/views/login_studio_spec.js @@ -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'); }); diff --git a/cms/static/js/spec/views/programs/program_details_spec.js b/cms/static/js/spec/views/programs/program_details_spec.js index 1aacbfb5d4..0c083a949d 100644 --- a/cms/static/js/spec/views/programs/program_details_spec.js +++ b/cms/static/js/spec/views/programs/program_details_spec.js @@ -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); diff --git a/cms/static/js/views/course_rerun.js b/cms/static/js/views/course_rerun.js index b256e158e5..3cde2c09b5 100644 --- a/cms/static/js/views/course_rerun.js +++ b/cms/static/js/views/course_rerun.js @@ -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( - '' + gettext('Processing Re-run Request') //jshint ignore:line + '' + gettext('Processing Re-run Request') // eslint-disable-line max-len ); $('.action-cancel').addClass('is-hidden'); }; diff --git a/cms/static/js/views/instructor_info.js b/cms/static/js/views/instructor_info.js index 7501deb17a..2ef9127b1a 100644 --- a/cms/static/js/views/instructor_info.js +++ b/cms/static/js/views/instructor_info.js @@ -1,6 +1,6 @@ // Backbone Application View: Instructor Information -define([ // jshint ignore:line +define([ 'jquery', 'underscore', 'backbone', diff --git a/cms/static/js/views/learning_info.js b/cms/static/js/views/learning_info.js index f39478a408..a3c8cbabd2 100644 --- a/cms/static/js/views/learning_info.js +++ b/cms/static/js/views/learning_info.js @@ -1,6 +1,6 @@ // Backbone Application View: Course Learning Information -define([ // jshint ignore:line +define([ 'jquery', 'underscore', 'backbone', diff --git a/cms/static/js/views/metadata.js b/cms/static/js/views/metadata.js index f9148b3f7e..1c805171b9 100644 --- a/cms/static/js/views/metadata.js +++ b/cms/static/js/views/metadata.js @@ -288,7 +288,7 @@ function(BaseView, _, MetadataModel, AbstractEditor, FileUpload, UploadDialog, var template = _.template( '
  • ' + '' + - '' + gettext('Remove') + '' + //jshint ignore:line + '' + gettext('Remove') + '' + // eslint-disable-line max-len '
  • ' ); list.append($(template({'ele': ele, 'index': index}))); @@ -455,7 +455,7 @@ function(BaseView, _, MetadataModel, AbstractEditor, FileUpload, UploadDialog, '
  • ' + '' + '' + - 'Remove' + //jshint ignore:line + 'Remove' + // eslint-disable-line max-len '
  • ' ); diff --git a/cms/static/js/views/paging_header.js b/cms/static/js/views/paging_header.js index 0a544e73a8..57d657dd80 100644 --- a/cms/static/js/views/paging_header.js +++ b/cms/static/js/views/paging_header.js @@ -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 } } diff --git a/cms/static/js/views/settings/advanced.js b/cms/static/js/views/settings/advanced.js index 3c1eba2fb2..6ac1beb4f1 100644 --- a/cms/static/js/views/settings/advanced.js +++ b/cms/static/js/views/settings/advanced.js @@ -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 diff --git a/cms/static/js/views/tabs.js b/cms/static/js/views/tabs.js index 04ace25d7e..2c60b28b76 100644 --- a/cms/static/js/views/tabs.js +++ b/cms/static/js/views/tabs.js @@ -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); diff --git a/cms/static/js/views/utils/xblock_utils.js b/cms/static/js/views/utils/xblock_utils.js index c99ab1ad44..2623698467 100644 --- a/cms/static/js/views/utils/xblock_utils.js +++ b/cms/static/js/views/utils/xblock_utils.js @@ -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)?'), diff --git a/cms/static/js/views/xblock.js b/cms/static/js/views/xblock.js index 6456f9b347..83eea1a5a0 100644 --- a/cms/static/js/views/xblock.js +++ b/cms/static/js/views/xblock.js @@ -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 }, diff --git a/cms/static/karma_cms.conf.js b/cms/static/karma_cms.conf.js index f2ef478cd3..fefda5da29 100644 --- a/cms/static/karma_cms.conf.js +++ b/cms/static/karma_cms.conf.js @@ -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')); diff --git a/cms/static/karma_cms_squire.conf.js b/cms/static/karma_cms_squire.conf.js index a5c81fceae..97361e1a71 100644 --- a/cms/static/karma_cms_squire.conf.js +++ b/cms/static/karma_cms_squire.conf.js @@ -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')); diff --git a/common/lib/xmodule/xmodule/js/karma_runner.js b/common/lib/xmodule/xmodule/js/karma_runner.js index 8d416281b7..d6c84a8576 100644 --- a/common/lib/xmodule/xmodule/js/karma_runner.js +++ b/common/lib/xmodule/xmodule/js/karma_runner.js @@ -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 () { diff --git a/common/lib/xmodule/xmodule/js/karma_xmodule.conf.js b/common/lib/xmodule/xmodule/js/karma_xmodule.conf.js index 3f72dcb7b0..a4cf459b23 100644 --- a/common/lib/xmodule/xmodule/js/karma_xmodule.conf.js +++ b/common/lib/xmodule/xmodule/js/karma_xmodule.conf.js @@ -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')); diff --git a/common/lib/xmodule/xmodule/js/src/video/07_video_volume_control.js b/common/lib/xmodule/xmodule/js/src/video/07_video_volume_control.js index a1932138df..58c4958d11 100644 --- a/common/lib/xmodule/xmodule/js/src/video/07_video_volume_control.js +++ b/common/lib/xmodule/xmodule/js/src/video/07_video_volume_control.js @@ -64,7 +64,7 @@ function (HtmlUtils) { '', ''].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('
    ')); this.volumeSlider = container.slider({ diff --git a/common/lib/xmodule/xmodule/js/src/video/08_video_speed_control.js b/common/lib/xmodule/xmodule/js/src/video/08_video_speed_control.js index 0dc653c122..914896293b 100644 --- a/common/lib/xmodule/xmodule/js/src/video/08_video_speed_control.js +++ b/common/lib/xmodule/xmodule/js/src/video/08_video_speed_control.js @@ -32,7 +32,7 @@ define( template: [ '