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,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
},