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,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'));