Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ali abbas/apply eslint amnesty #32226

Draft
wants to merge 34 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
148ca9b
fix: eslint operator-linebreak issue
Syed-Ali-Abbas-Zaidi Mar 7, 2023
3cecf21
fix: eslint quotes issue
Syed-Ali-Abbas-Zaidi Mar 7, 2023
b2fb0e1
fix: react jsx indent and props issues
Syed-Ali-Abbas-Zaidi Mar 7, 2023
cf53f88
fix: eslint trailing spaces issues
Syed-Ali-Abbas-Zaidi Mar 7, 2023
02cf040
fix: eslint line around directives issue
Syed-Ali-Abbas-Zaidi Mar 7, 2023
aa3431a
fix: eslint semi rule
Syed-Ali-Abbas-Zaidi Mar 9, 2023
40ac89d
fix: eslint newline per chain rule
Syed-Ali-Abbas-Zaidi Mar 9, 2023
83dee98
fix: eslint space infix ops rule
Syed-Ali-Abbas-Zaidi Mar 9, 2023
da2f67d
fix: eslint space-in-parens issue
Syed-Ali-Abbas-Zaidi Mar 9, 2023
01dd648
fix: eslint space before function paren issue
Syed-Ali-Abbas-Zaidi Mar 9, 2023
3f3b352
fix: eslint space before blocks issue
Syed-Ali-Abbas-Zaidi Mar 9, 2023
81b8290
fix: eslint arrow body style issue
Syed-Ali-Abbas-Zaidi Mar 9, 2023
335ab97
fix: eslint dot-location issue
Syed-Ali-Abbas-Zaidi Mar 9, 2023
45f5fa3
fix: eslint quotes issue
Syed-Ali-Abbas-Zaidi Mar 9, 2023
3640611
fix: eslint quote props issue
Syed-Ali-Abbas-Zaidi Mar 9, 2023
0aff1d3
fix: eslint operator assignment issue
Syed-Ali-Abbas-Zaidi Mar 9, 2023
b9337ec
fix: eslint new line after import issue
Syed-Ali-Abbas-Zaidi Mar 9, 2023
f641a0e
fix: indent issues
Syed-Ali-Abbas-Zaidi May 3, 2023
8915030
fix: operator assignment issue
Syed-Ali-Abbas-Zaidi May 4, 2023
30db206
fix: all autofixable eslint issues
Syed-Ali-Abbas-Zaidi May 4, 2023
b5c7a3c
fix: all react related fixable issues
Syed-Ali-Abbas-Zaidi May 4, 2023
0d00d2d
fix: autofixable eslint issues
Syed-Ali-Abbas-Zaidi May 5, 2023
0f5078e
chore: remove all template literals
Syed-Ali-Abbas-Zaidi May 10, 2023
adc4621
fix: remaining autofixable issues
Syed-Ali-Abbas-Zaidi May 10, 2023
4d05181
chore: apply amnesty on all existing issues
Syed-Ali-Abbas-Zaidi May 5, 2023
b15f474
fix: failing xss-lint issues
Syed-Ali-Abbas-Zaidi May 5, 2023
f0da55c
refactor: apply amnesty on remaining issues
Syed-Ali-Abbas-Zaidi May 10, 2023
93422a5
chore: apply amnesty on block-scoped-var, camelcase and consistent-re…
Syed-Ali-Abbas-Zaidi May 12, 2023
18d6a25
chore: apply amnesty on eqeqeq, no-console, no-undef and radix
Syed-Ali-Abbas-Zaidi May 12, 2023
b4dde14
fix: failing xss lint
Syed-Ali-Abbas-Zaidi May 12, 2023
b3eadd2
chore: apply amnesty on no-unused-vars, no-use-before-define and no-u…
Syed-Ali-Abbas-Zaidi May 12, 2023
ec2d70a
chore: apply amnest on no-var
Syed-Ali-Abbas-Zaidi May 12, 2023
f28c16f
chore: apply amnesty
Syed-Ali-Abbas-Zaidi May 12, 2023
9030595
Merge branch 'master' of github.com:openedx/edx-platform into Ali-Abb…
Syed-Ali-Abbas-Zaidi Aug 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
17 changes: 0 additions & 17 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,39 +38,22 @@
"strict": "off",

// Temporary Rules (Will be removed one-by-one to minimize file changes)
"block-scoped-var": "off",
"camelcase": "off",
"comma-dangle": "off",
"consistent-return": "off",
"eqeqeq": "off",
"function-call-argument-newline": "off",
"function-paren-newline": "off",
"import/extensions": "off",
"import/no-amd": "off",
"import/no-dynamic-require": "off",
"import/no-unresolved": "off",
"max-len": "off",
"no-console": "off",
"no-lonely-if": "off",
"no-param-reassign": "off",
"no-proto": "off",
"no-prototype-builtins": "off",
"no-redeclare": "off",
"no-restricted-globals": "off",
"no-restricted-syntax": "off",
"no-throw-literal": "off",
"no-undef": "off",
"no-underscore-dangle": "off",
"no-unused-vars": "off",
"no-use-before-define": "off",
"no-useless-escape": "off",
"no-var": "off",
"object-shorthand": "off",
"prefer-arrow-callback": "off",
"prefer-destructuring": "off",
"prefer-rest-params": "off",
"prefer-template": "off",
"radix": "off",
"react/prop-types": "off",
"vars-on-top": "off"
}
Expand Down
6 changes: 6 additions & 0 deletions cms/djangoapps/pipeline_js/js/xmodule.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// These files assume that several libraries are available and bound to
// variables in the global context, so we load those libraries with requirejs
// and attach them to the global context manually.
// eslint-disable-next-line no-undef
define(
[
'jquery', 'underscore', 'codemirror', 'tinymce', 'scriptjs',
Expand Down Expand Up @@ -51,6 +52,7 @@ define(
window.MathJax.Hub.processSectionDelay = 0;
window.MathJax.Hub.Configured();

// eslint-disable-next-line no-use-before-define
window.addEventListener('resize', MJrenderer);

let t = -1;
Expand All @@ -65,7 +67,9 @@ define(
if (oldWidth !== document.documentElement.scrollWidth) {
t = window.setTimeout(function() {
oldWidth = document.documentElement.scrollWidth;
// eslint-disable-next-line no-undef
MathJax.Hub.Queue(
// eslint-disable-next-line no-undef
['Rerender', MathJax.Hub],
[() => $('.MathJax_SVG>svg').toArray().forEach(el => {
if ($(el).width() === 0) {
Expand All @@ -83,6 +87,7 @@ define(
window.RequireJS = {
requirejs: {}, // This is never used by current xmodules
require: $script, // $script([deps], callback) acts approximately like the require function
// eslint-disable-next-line no-undef
define: define
};
/**
Expand All @@ -92,6 +97,7 @@ define(
* @return {jQuery Promise}
* */
function requireQueue(modules) {
// eslint-disable-next-line no-var
var deferred = $.Deferred();
function loadScript(queue) {
$script.ready('mathjax', function() {
Expand Down
2 changes: 2 additions & 0 deletions cms/static/cms/js/build.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
(function() {
'use strict';

// eslint-disable-next-line no-var
var getModulesList = function(modules) {
return modules.map(function(moduleName) {
return {name: moduleName};
});
};

// eslint-disable-next-line no-var
var jsOptimize = process.env.REQUIRE_BUILD_PROFILE_OPTIMIZE !== undefined
? process.env.REQUIRE_BUILD_PROFILE_OPTIMIZE : 'uglify2';

Expand Down
5 changes: 5 additions & 0 deletions cms/static/cms/js/main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* globals AjaxPrefix */

// eslint-disable-next-line no-undef
define([
'domReady',
'jquery',
Expand All @@ -12,8 +13,10 @@ define([
], function(domReady, $, _, str, Backbone, gettext, NotificationView) {
'use strict';

// eslint-disable-next-line no-var
var main, sendJSON;
main = function() {
// eslint-disable-next-line no-undef
AjaxPrefix.addAjaxPrefix(jQuery, function() {
return $("meta[name='path_prefix']").attr('content');
});
Expand All @@ -34,6 +37,7 @@ define([
}
});
$(document).ajaxError(function(event, jqXHR, ajaxSettings) {
// eslint-disable-next-line no-var
var msg, contentType,
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
if (ajaxSettings.notifyOnError === false) {
Expand All @@ -52,6 +56,7 @@ define([
response: jqXHR.responseText,
status: jqXHR.status
});
// eslint-disable-next-line consistent-return
return msg.show();
});
sendJSON = function(url, data, callback, type) { // eslint-disable-line no-param-reassign
Expand Down
5 changes: 5 additions & 0 deletions cms/static/cms/js/require-config.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
// eslint-disable-next-line no-unused-vars
/* globals _, requirejs */
/* eslint-disable quote-props, no-console, no-plusplus */

(function(require, define) {
'use strict';

// eslint-disable-next-line no-var
var defineDependency, librarySetup;

// We do not wish to bundle common libraries (that may also be used by non-RequireJS code on the page
// into the optimized files. Therefore load these libraries through script tags and explicitly define them.
// Note that when the optimizer executes this code, window will not be defined.
if (window) {
defineDependency = function(globalName, name, noShim) {
// eslint-disable-next-line no-var
var getGlobalValue = function() {
// eslint-disable-next-line no-var
var globalNamePath = globalName.split('.'),
result = window,
i;
Expand Down Expand Up @@ -355,4 +359,5 @@
}
}
});
// eslint-disable-next-line no-undef
}).call(this, require, define);
3 changes: 3 additions & 0 deletions cms/static/cms/js/spec/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
(function(requirejs, requireSerial) {
'use strict';

// eslint-disable-next-line no-var
var i, specHelpers, testFiles;
if (window) {
// eslint-disable-next-line no-undef
define('add-a11y-deps',
[
'underscore',
Expand Down Expand Up @@ -225,6 +227,7 @@
}
});

// eslint-disable-next-line no-undef
jasmine.getFixtures().fixturesPath = '/base/templates';

testFiles = [
Expand Down
2 changes: 2 additions & 0 deletions cms/static/cms/js/spec/main_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
describe('main helper', function() {
beforeEach(function() {
this.previousAjaxSettings = $.extend(true, {}, $.ajaxSettings);
/* eslint-disable-next-line consistent-return, no-undef */
spyOn($, 'cookie').and.callFake(function(param) {
if (param === 'csrftoken') {
return 'stubCSRFToken';
Expand All @@ -33,6 +34,7 @@
});
});
describe('AJAX Errors', function() {
// eslint-disable-next-line no-var
var server;
server = null;
beforeEach(function() {
Expand Down
2 changes: 2 additions & 0 deletions cms/static/cms/js/spec/main_squire.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
(function(requirejs, requireSerial) {
'use strict';

// eslint-disable-next-line no-var
var i, specHelpers, testFiles;

requirejs.config({
Expand Down Expand Up @@ -187,6 +188,7 @@
}
});

// eslint-disable-next-line no-undef
jasmine.getFixtures().fixturesPath = '/base/templates';

testFiles = [
Expand Down
1 change: 1 addition & 0 deletions cms/static/cms/js/spec/main_webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import '../../../js/spec/views/pages/course_outline_spec.js';
import '../../../js/spec/views/xblock_editor_spec.js';
import '../../../js/spec/views/xblock_string_field_editor_spec.js';

// eslint-disable-next-line no-undef
jasmine.getFixtures().fixturesPath = '/base/templates';

window._ = _;
Expand Down
5 changes: 5 additions & 0 deletions cms/static/cms/js/spec/xblock/cms.runtime.v1_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'xblock/cms.runtime.v1';
describe('Studio Runtime v1', function() {
'use strict';

// eslint-disable-next-line no-var
var runtime;

beforeEach(function() {
Expand All @@ -13,6 +14,7 @@ describe('Studio Runtime v1', function() {
});

it('allows events to be listened to', function() {
// eslint-disable-next-line no-var
var canceled = false;
runtime.listenTo('cancel', function() {
canceled = true;
Expand All @@ -23,6 +25,7 @@ describe('Studio Runtime v1', function() {
});

it('shows save notifications', function() {
// eslint-disable-next-line no-var
var title = 'Mock saving...',
notificationSpy = EditHelpers.createNotificationSpy();
runtime.notify('save', {
Expand All @@ -37,6 +40,7 @@ describe('Studio Runtime v1', function() {
});

it('shows error messages', function() {
// eslint-disable-next-line no-var
var title = 'Mock Error',
message = 'This is a mock error.',
notificationSpy = EditHelpers.createNotificationSpy('Error');
Expand All @@ -48,6 +52,7 @@ describe('Studio Runtime v1', function() {
});

describe('Modal Dialogs', function() {
// eslint-disable-next-line no-var
var MockModal, modal, showMockModal;

MockModal = BaseModal.extend({
Expand Down
12 changes: 12 additions & 0 deletions cms/static/cms/js/xblock/cms.runtime.v1.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
// eslint-disable-next-line no-undef
define(['jquery', 'backbone', 'xblock/runtime.v1', 'URI', 'gettext', 'js/utils/modal',
'common/js/components/views/feedback_notification'],
function($, Backbone, XBlock, URI, gettext, ModalUtils, NotificationView) {
'use strict';

// eslint-disable-next-line no-var
var __hasProp = {}.hasOwnProperty,
__extends = function(child, parent) {
// eslint-disable-next-line no-var
var key;
// eslint-disable-next-line no-restricted-syntax
for (key in parent) {
if (__hasProp.call(parent, key)) {
child[key] = parent[key];
Expand All @@ -24,9 +28,12 @@ function($, Backbone, XBlock, URI, gettext, ModalUtils, NotificationView) {
StudioRuntime = {};

BaseRuntime.v1 = (function(_super) {
// eslint-disable-next-line no-use-before-define
__extends(v1, _super);

// eslint-disable-next-line no-use-before-define
v1.prototype.handlerUrl = function(element, handlerName, suffix, query) {
// eslint-disable-next-line no-var
var uri;
uri = URI(this.handlerPrefix)
.segment($(element).data('usage-id'))
Expand All @@ -43,6 +50,7 @@ function($, Backbone, XBlock, URI, gettext, ModalUtils, NotificationView) {

function v1() {
v1.__super__.constructor.call(this);
// eslint-disable-next-line no-undef
this.dispatcher = _.clone(Backbone.Events);
this.listenTo('save', this._handleSave);
this.listenTo('cancel', this._handleCancel);
Expand Down Expand Up @@ -91,6 +99,7 @@ function($, Backbone, XBlock, URI, gettext, ModalUtils, NotificationView) {
};

v1.prototype._handleError = function(data) {
// eslint-disable-next-line no-var
var message, title;
message = data.message || data.msg;
if (message) {
Expand All @@ -107,6 +116,7 @@ function($, Backbone, XBlock, URI, gettext, ModalUtils, NotificationView) {
};

v1.prototype._handleSave = function(data) {
// eslint-disable-next-line no-var
var message;
// Starting to save, so show a notification
if (data.state === 'start') {
Expand Down Expand Up @@ -152,6 +162,7 @@ function($, Backbone, XBlock, URI, gettext, ModalUtils, NotificationView) {
}(XBlock.Runtime.v1));

PreviewRuntime.v1 = (function(_super) {
// eslint-disable-next-line no-use-before-define
__extends(v1, _super);

function v1() {
Expand All @@ -164,6 +175,7 @@ function($, Backbone, XBlock, URI, gettext, ModalUtils, NotificationView) {
}(BaseRuntime.v1));

StudioRuntime.v1 = (function(_super) {
// eslint-disable-next-line no-use-before-define
__extends(v1, _super);

function v1() {
Expand Down
4 changes: 4 additions & 0 deletions cms/static/js/base.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// eslint-disable-next-line no-undef
define([
'domReady',
'jquery',
Expand Down Expand Up @@ -28,6 +29,7 @@ function(
) {
'use strict';

// eslint-disable-next-line no-var
var $body;

function smoothScrollLink(e) {
Expand Down Expand Up @@ -57,6 +59,7 @@ function(
}

domReady(function() {
// eslint-disable-next-line no-var
var dropdownMenuView;

$body = $('body');
Expand All @@ -78,6 +81,7 @@ function(
});

$('.nav-dd .nav-item, .filterable-column .nav-item').click(function(e) {
// eslint-disable-next-line no-var
var $subnav = $(this).find('.wrapper-nav-sub'),
$title = $(this).find('.title');

Expand Down
4 changes: 4 additions & 0 deletions cms/static/js/certificates/collections/certificates.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Backbone.js Application Collection: Certificates

// eslint-disable-next-line no-undef
define([
'backbone',
'gettext',
Expand All @@ -8,6 +9,7 @@ define([
function(Backbone, gettext, Certificate) {
'use strict';

// eslint-disable-next-line no-var
var CertificateCollection = Backbone.Collection.extend({
model: Certificate,

Expand All @@ -24,6 +26,7 @@ function(Backbone, gettext, Certificate) {
},

certificateArray: function(certificateInfo) {
// eslint-disable-next-line no-var
var returnArray;
try {
returnArray = JSON.parse(certificateInfo);
Expand Down Expand Up @@ -62,6 +65,7 @@ function(Backbone, gettext, Certificate) {

parse: function(certificatesJson) {
// Transforms the provided JSON into a Certificates collection
// eslint-disable-next-line no-var
var modelArray = this.certificateArray(certificatesJson);
modelArray.forEach(function(item) {
this.push(item);
Expand Down
Loading