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

chore: apply amnesty on existing not fixable issues #32215

Merged
merged 37 commits into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 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
497875d
Merge branch 'master' of github.com:openedx/edx-platform into Ali-Abb…
Syed-Ali-Abbas-Zaidi May 18, 2023
b7955cc
refactor: apply amnesty on new issues
Syed-Ali-Abbas-Zaidi May 18, 2023
bf40b45
Merge branch 'master' into Ali-Abbas/eslint-amnesty
Syed-Ali-Abbas-Zaidi May 22, 2023
6eb5cc4
fix: remove file level suppressions
Syed-Ali-Abbas-Zaidi Aug 2, 2023
1f88360
Merge branch 'master' of github.com:openedx/edx-platform into Ali-Abb…
Syed-Ali-Abbas-Zaidi Aug 2, 2023
53f5c03
refactor: apply amnesty on new issues
Syed-Ali-Abbas-Zaidi Aug 2, 2023
70b8191
Merge branch 'master' of github.com:openedx/edx-platform into Ali-Abb…
Syed-Ali-Abbas-Zaidi Aug 7, 2023
8f593bb
Merge branch 'master' into Ali-Abbas/eslint-amnesty
Syed-Ali-Abbas-Zaidi Aug 7, 2023
7515d08
Merge branch 'master' into Ali-Abbas/eslint-amnesty
Syed-Ali-Abbas-Zaidi Aug 7, 2023
b60d93c
Merge branch 'master' into Ali-Abbas/eslint-amnesty
Syed-Ali-Abbas-Zaidi Aug 7, 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
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"func-names": "off",
"indent": ["error", 4],
"react/jsx-indent": ["error", 4],
"react/jsx-indent-props": ["error", 4],
"new-cap": "off",
"no-else-return": "off",
"no-shadow": "error",
Expand Down Expand Up @@ -70,7 +71,6 @@
"prefer-rest-params": "off",
"prefer-template": "off",
"radix": "off",
"react/jsx-indent-props": ["error", 4],
"react/prop-types": "off",
"vars-on-top": "off"
}
Expand Down
35 changes: 18 additions & 17 deletions cms/djangoapps/pipeline_js/js/xmodule.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ define(
function() {
window.MathJax.Hub.Config({
styles: {
'.MathJax_SVG>svg': { 'max-width': '100%' },
'.MathJax_SVG>svg': {'max-width': '100%'},
// This is to resolve for people who use center mathjax with tables
'table>tbody>tr>td>.MathJax_SVG>svg': { 'max-width': 'inherit'},
'table>tbody>tr>td>.MathJax_SVG>svg': {'max-width': 'inherit'},
},
tex2jax: {
inlineMath: [
Expand All @@ -38,9 +38,9 @@ define(
['[mathjax]', '[/mathjax]']
]
},
CommonHTML: { linebreaks: { automatic: true } },
SVG: { linebreaks: { automatic: true } },
"HTML-CSS": { linebreaks: { automatic: true } },
CommonHTML: {linebreaks: {automatic: true}},
SVG: {linebreaks: {automatic: true}},
'HTML-CSS': {linebreaks: {automatic: true}},
});

// In order to eliminate all flashing during interactive
Expand All @@ -54,28 +54,29 @@ define(
window.addEventListener('resize', MJrenderer);

let t = -1;
// eslint-disable-next-line prefer-const
let delay = 1000;
let oldWidth = document.documentElement.scrollWidth;
function MJrenderer() {
// don't rerender if the window is the same size as before
if (t >= 0) {
window.clearTimeout(t);
window.clearTimeout(t);
}
if (oldWidth !== document.documentElement.scrollWidth) {
t = window.setTimeout(function() {
oldWidth = document.documentElement.scrollWidth;
MathJax.Hub.Queue(
["Rerender", MathJax.Hub],
[() => $('.MathJax_SVG>svg').toArray().forEach(el => {
if ($(el).width() === 0) {
$(el).css('max-width', 'inherit');
}
})]
);
t = -1;
oldWidth = document.documentElement.scrollWidth;
MathJax.Hub.Queue(
['Rerender', MathJax.Hub],
[() => $('.MathJax_SVG>svg').toArray().forEach(el => {
if ($(el).width() === 0) {
$(el).css('max-width', 'inherit');
}
})]
);
t = -1;
}, delay);
}
};
}
}
);
window.CodeMirror = CodeMirror;
Expand Down
1 change: 1 addition & 0 deletions cms/static/cms/js/spec/main_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
(function(sandbox) {
'use strict';

// eslint-disable-next-line global-require
require(['jquery', 'backbone', 'cms/js/main', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers', 'jquery.cookie'],
function($, Backbone, main, AjaxHelpers) {
describe('CMS', function() {
Expand Down
1 change: 1 addition & 0 deletions cms/static/js/certificates/spec/custom_matchers.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Custom matcher library for Jasmine test assertions
// http://tobyho.com/2012/01/30/write-a-jasmine-matcher/

// eslint-disable-next-line padded-blocks
define(['jquery'], function($) { // eslint-disable-line no-unused-vars

'use strict';
Expand Down
1 change: 1 addition & 0 deletions cms/static/js/factories/container.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import './base';
import 'cms/js/main';
import 'xblock/cms.runtime.v1';

// eslint-disable-next-line no-unused-expressions
'use strict';
export default function ContainerFactory(componentTemplates, XBlockInfoJson, action, options) {
var main_options = {
Expand Down
1 change: 1 addition & 0 deletions cms/static/js/factories/context_course.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as ContextCourse from 'js/models/course';

// eslint-disable-next-line import/prefer-default-export
export {ContextCourse};
1 change: 1 addition & 0 deletions cms/static/js/factories/edit_tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'cms/js/main';
import 'xblock/cms.runtime.v1';
import 'xmodule/js/src/xmodule'; // Force the XBlockToXModuleShim to load for Static Tabs

// eslint-disable-next-line no-unused-expressions
'use strict';
export default function EditTabsFactory(courseLocation, explicitUrl) {
xmoduleLoader.done(function() {
Expand Down
1 change: 1 addition & 0 deletions cms/static/js/factories/library.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import './base';
import 'cms/js/main';
import 'xblock/cms.runtime.v1';

// eslint-disable-next-line no-unused-expressions
'use strict';
export default function LibraryFactory(componentTemplates, XBlockInfoJson, options) {
var main_options = {
Expand Down
1 change: 1 addition & 0 deletions cms/static/js/factories/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ define([
model.useV2CertDisplaySettings = useV2CertDisplaySettings;
model.set('upgrade_deadline', upgradeDeadline);
model.fetch({
// eslint-disable-next-line no-shadow
success: function(model) {
var editor = new MainView({
el: $('.settings-details'),
Expand Down
1 change: 1 addition & 0 deletions cms/static/js/factories/textbooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as TextbookCollection from 'js/collections/textbook';
import * as ListTextbooksView from 'js/views/list_textbooks';
import './base';

// eslint-disable-next-line no-unused-expressions
'use strict';
export default function TextbooksFactory(textbooksJson) {
var textbooks = new TextbookCollection(textbooksJson, {parse: true}),
Expand Down
1 change: 1 addition & 0 deletions cms/static/js/factories/xblock_validation.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as XBlockValidationView from 'js/views/xblock_validation';
import * as XBlockValidationModel from 'js/models/xblock_validation';

// eslint-disable-next-line no-unused-expressions
'use strict';
export default function XBlockValidationFactory(validationMessages, hasEditingUrl, isRoot, isUnit, validationEle) {
var model, response;
Expand Down
1 change: 1 addition & 0 deletions cms/static/js/features/import/factories/import.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ define([
},

progressall: function(e, data) {
// eslint-disable-next-line no-mixed-operators
var percentInt = data.loaded / data.total * 100,
percentVal = parseInt(percentInt, 10) + '%',
doneAt;
Expand Down
6 changes: 6 additions & 0 deletions cms/static/js/features_jsx/studio/CourseOrLibraryListing.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@

import PropTypes from 'prop-types';
import React from 'react';
// eslint-disable-next-line no-unused-vars
import ReactDOM from 'react-dom';

// eslint-disable-next-line import/prefer-default-export
export function CourseOrLibraryListing(props) {
// eslint-disable-next-line prefer-destructuring
const allowReruns = props.allowReruns;
// eslint-disable-next-line prefer-destructuring
const linkClass = props.linkClass;
// eslint-disable-next-line prefer-destructuring
const idBase = props.idBase;

const renderCourseMetadata = (item, i) => (
Expand Down Expand Up @@ -84,6 +89,7 @@ export function CourseOrLibraryListing(props) {
CourseOrLibraryListing.propTypes = {
allowReruns: PropTypes.bool.isRequired,
idBase: PropTypes.string.isRequired,
// eslint-disable-next-line react/forbid-prop-types
items: PropTypes.arrayOf(PropTypes.object).isRequired,
linkClass: PropTypes.string.isRequired,
};
2 changes: 2 additions & 0 deletions cms/static/js/models/location.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ define(['backbone', 'underscore'], function(Backbone, _) {
},
toUrl: function(overrides) {
return;
/* eslint-disable-next-line no-unused-expressions, no-unreachable */
(overrides && overrides.tag ? overrides.tag : this.get('tag')) + '://'
+ (overrides && overrides.org ? overrides.org : this.get('org')) + '/'
+ (overrides && overrides.course ? overrides.course : this.get('course')) + '/'
+ (overrides && overrides.category ? overrides.category : this.get('category')) + '/'
+ (overrides && overrides.name ? overrides.name : this.get('name')) + '/';
},
_tagPattern: /[^:]+/g,
// eslint-disable-next-line prefer-regex-literals
_fieldPattern: new RegExp('[^/]+', 'g'),

parse: function(payload) {
Expand Down
3 changes: 3 additions & 0 deletions cms/static/js/sock.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import * as domReady from 'domReady';
import * as $ from 'jquery';
import 'jquery.smoothScroll';

// eslint-disable-next-line no-unused-expressions
'use strict';

// eslint-disable-next-line import/no-mutable-exports
var toggleSock = function(e) {
e.preventDefault();

Expand Down Expand Up @@ -38,4 +40,5 @@ domReady(function() {
$('.cta-show-sock').bind('click', toggleSock);
});

// eslint-disable-next-line import/prefer-default-export
export {toggleSock};
6 changes: 6 additions & 0 deletions cms/static/js/spec/models/group_configuration_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ define([
var collection, injector, mockGettext, initializeGroupModel, cleanUp;

mockGettext = function(returnedValue) {
// eslint-disable-next-line no-shadow
var injector = new Squire();

injector.mock('gettext', function() {
Expand All @@ -258,6 +259,7 @@ define([

injector = mockGettext(dict);
injector.require(['js/collections/group'],
// eslint-disable-next-line no-shadow
function(GroupCollection) {
collection = new GroupCollection();
deferred.resolve(collection);
Expand All @@ -273,6 +275,7 @@ define([
};

it('returns correct ids', function() {
// eslint-disable-next-line no-shadow
var collection = new GroupCollection();

expect(collection.getGroupId(0)).toBe('A');
Expand All @@ -287,6 +290,7 @@ define([

it('just 1 character in the dictionary', function(done) {
initializeGroupModel('1')
// eslint-disable-next-line no-shadow
.then(function(collection) {
expect(collection.getGroupId(0)).toBe('1');
expect(collection.getGroupId(1)).toBe('11');
Expand All @@ -300,6 +304,7 @@ define([

it('allow to use unicode characters in the dict', function(done) {
initializeGroupModel('ö诶úeœ')
// eslint-disable-next-line no-shadow
.then(function(collection) {
expect(collection.getGroupId(0)).toBe('ö');
expect(collection.getGroupId(1)).toBe('诶');
Expand All @@ -316,6 +321,7 @@ define([

it('return initial value if dictionary is empty', function(done) {
initializeGroupModel('')
// eslint-disable-next-line no-shadow
.then(function(collection) {
expect(collection.getGroupId(0)).toBe('0');
expect(collection.getGroupId(5)).toBe('5');
Expand Down
1 change: 1 addition & 0 deletions cms/static/js/spec/utils/handle_iframe_binding_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ define(
});

it('does nothing on tinymce iframe', function() {
// eslint-disable-next-line no-script-url
verify_no_modification('javascript:');
});
});
Expand Down
4 changes: 4 additions & 0 deletions cms/static/js/spec/video/transcripts/message_manager_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ define(
describe('processCommand', function() {
var action = 'replace',
errorMessage = 'errorMessage',
// eslint-disable-next-line no-void
videoList = void 0,
extraParamas = 'video_id';

Expand All @@ -175,6 +176,7 @@ define(
var defaults = {
action: 'replace',
errorMessage: 'errorMessage',
// eslint-disable-next-line no-void
extraParamas: void 0
};
var args = $.extend({}, defaults, config);
Expand All @@ -201,6 +203,7 @@ define(
action,
view.component_locator,
videoList,
// eslint-disable-next-line no-void
void 0
);
expect(view.showError).not.toHaveBeenCalled();
Expand Down Expand Up @@ -251,6 +254,7 @@ define(
action,
view.component_locator,
videoList,
// eslint-disable-next-line no-void
void 0
);
expect(view.showError).toHaveBeenCalled();
Expand Down
2 changes: 2 additions & 0 deletions cms/static/js/spec/video/transcripts/utils_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ define(
});

it('Method: getYoutubeLink', function() {
// eslint-disable-next-line no-shadow
var videoId = 'video_id',
result = Utils.getYoutubeLink(videoId),
expectedResult = 'http://youtu.be/' + videoId;
Expand Down Expand Up @@ -262,6 +263,7 @@ define(

describe('Wrong arguments ', function() {
it('youtube videoId is wrong', function() {
// eslint-disable-next-line no-shadow
var videoId = 'wrong_id',
link = 'http://youtu.be/' + videoId,
result = Utils.parseLink(link);
Expand Down
2 changes: 2 additions & 0 deletions cms/static/js/spec/views/module_edit_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ describe('ModuleEdit', function() {
+ '<li class="component" id="stub-id" data-locator="stub-id">\n'
+ ' <div class="component-editor">\n'
+ ' <div class="module-editor">\n'
// eslint-disable-next-line no-template-curly-in-string
+ ' ${editor}\n'
+ ' </div>\n'
+ ' <a href="#" class="save-button">Save</a>\n'
Expand Down Expand Up @@ -73,6 +74,7 @@ describe('ModuleEdit', function() {
window.MockXBlock = function() {
return {};
};
// eslint-disable-next-line no-void
window.loadedXBlockResources = void 0;
this.moduleEdit.render();
return $.ajax.calls.mostRecent().args[0].success({
Expand Down
2 changes: 2 additions & 0 deletions cms/static/js/spec/views/move_xblock_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import XBlockInfo from 'js/models/xblock_info';
import Course from 'js/models/course';
import 'mock-ajax';

// eslint-disable-next-line padded-blocks
describe('MoveXBlock', function() {

'use strict';
Expand Down Expand Up @@ -396,6 +397,7 @@ describe('MoveXBlock', function() {
expectedData,
sourceIndex = sourceIndex || 0; // eslint-disable-line no-redeclare

// eslint-disable-next-line no-multi-assign
responseData = expectedData = {
move_source_locator: xblockLocator,
parent_locator: modal.targetParentXBlockInfo.id
Expand Down
3 changes: 3 additions & 0 deletions cms/static/js/spec/views/pages/container_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ function parameterized_suite(label, globalPageOptions) {
AjaxHelpers.respondWithJson(requests, options || {});
};

// eslint-disable-next-line no-shadow
handleContainerPageRefresh = function(requests) {
var request = AjaxHelpers.currentRequest(requests);
expect(str.startsWith(request.url,
Expand Down Expand Up @@ -551,10 +552,12 @@ function parameterized_suite(label, globalPageOptions) {
describe('Previews', function() {
var getButtonIcon, getButtonText;

// eslint-disable-next-line no-shadow
getButtonIcon = function(containerPage) {
return containerPage.$('.action-toggle-preview .fa');
};

// eslint-disable-next-line no-shadow
getButtonText = function(containerPage) {
return containerPage.$('.action-toggle-preview .preview-text').text().trim();
};
Expand Down
Loading