Skip to content

Commit

Permalink
refactor: apply amnesty on remaining issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Syed-Ali-Abbas-Zaidi committed May 11, 2023
1 parent b15f474 commit f0da55c
Show file tree
Hide file tree
Showing 14 changed files with 24 additions and 3 deletions.
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
1 change: 1 addition & 0 deletions cms/static/js/models/location.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ 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')) + '/'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,11 @@
var funcName, selector;
selector = event[0];
funcName = event[1];
// eslint-disable-next-line no-shadow
obj['click ' + selector] = function(event) {
return this[funcName](event);
};
// eslint-disable-next-line no-shadow
obj['keydown ' + selector] = function(event) {
return DiscussionUtil.activateOnSpace(event, this[funcName]);
};
Expand Down
1 change: 1 addition & 0 deletions common/static/common/js/spec_helpers/jasmine-stealth.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@

_.each(methodsToSpy, function(methodName) {
spies[methodName] = jasmine.createSpy('' + classToFake + '#' + methodName);
// eslint-disable-next-line no-return-assign
return fakeClass.prototype[methodName] = function() {
return spies[methodName].apply(this, arguments);
};
Expand Down
1 change: 1 addition & 0 deletions lms/static/js/Markdown.Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -1396,6 +1396,7 @@
button.removeAttribute('aria-disabled');
} else {
image.style.backgroundPosition = button.XShift + ' ' + disabledYShift;
// eslint-disable-next-line no-multi-assign
button.onmouseover = button.onmouseout = button.onclick = function() { };
// This line does not appear in vanilla WMD. It was added by edX to improve accessibility.
// It should become a separate commit applied to WMD's official HEAD if we remove this edited version
Expand Down
5 changes: 3 additions & 2 deletions lms/static/js/Markdown.Sanitizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@
tagname = tags[ctag].replace(/<\/?(\w+).*/, '$1');
// skip any already paired tags
// and skip tags in our ignore list; assume they're self-closed
if (tagpaired[ctag] || ignoredtags.search('<' + tagname + '>') > -1) { continue; } // eslint-disable-line max-len, xss-lint: disable=javascript-concat-html
// eslint-disable-next-line no-continue
if (tagpaired[ctag] || ignoredtags.search('<' + tagname + '>') > -1) { continue; } // xss-lint: disable=javascript-concat-html

tag = tags[ctag];
match = -1;
Expand All @@ -73,7 +74,7 @@
// this is an opening tag
// search forwards (next tags), look for closing tags
for (var ntag = ctag + 1; ntag < tagcount; ntag++) {
if (!tagpaired[ntag] && tags[ntag] === '</' + tagname + '>') { // eslint-disable-line max-len, xss-lint: disable=javascript-concat-html
if (!tagpaired[ntag] && tags[ntag] === '</' + tagname + '>') { // xss-lint: disable=javascript-concat-html
match = ntag;
break;
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,9 @@ describe('Program Details View', () => {
'YYYY-MM-DDTHH:mm:ss[Z]',
);
}
// eslint-disable-next-line no-use-before-define
view = initView({
// eslint-disable-next-line no-undef
programData: $.extend({}, options.programData, {
subscription_eligible: true,
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class ProgramDetailsSidebarView extends Backbone.View {
}

render() {
// eslint-disable-next-line no-undef
const data = $.extend(
{},
this.model.toJSON(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ class ProgramDetailsView extends Backbone.View {
isSubscriptionEligible: this.options.isSubscriptionEligible,
restartIcon,
};
// eslint-disable-next-line no-undef
data = $.extend(
data,
this.programModel.toJSON(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class UpgradeMessageView extends Backbone.View {
}

render() {
// eslint-disable-next-line no-undef
const data = $.extend(
{},
this.model.toJSON(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,26 +42,31 @@ describe('Currency factory', () => {
longitude: 137.737495,
},
};
// eslint-disable-next-line object-curly-spacing
$.cookie('edx-price-l10n', null, { path: '/' });
});

describe('converts price to local currency', () => {
it('when location is the default (US)', () => {
// eslint-disable-next-line object-curly-spacing
$.cookie('edx-price-l10n', '{"rate":1,"code":"USD","symbol":"$","countryCode":"US"}', { path: '/' });
currency = new Currency();
expect($('[name="verified_mode"].no-discount').filter(':visible').text()).toEqual('Pursue a Verified Certificate($100 USD)');
});
it('when cookie is set to a different country', () => {
// eslint-disable-next-line object-curly-spacing
$.cookie('edx-price-l10n', '{"rate":2.2,"code":"CAD","symbol":"$","countryCode":"CAN"}', { expires: 1 });
currency = new Currency();
expect($('[name="verified_mode"].no-discount').filter(':visible').text()).toEqual('Pursue a Verified Certificate($220 CAD)');
});
it('when cookie is set to a different country with a discount', () => {
// eslint-disable-next-line object-curly-spacing
$.cookie('edx-price-l10n', '{"rate":2.2,"code":"CAD","symbol":"$","countryCode":"CAN"}', { expires: 1 });
currency = new Currency();
expect($('[name="verified_mode"].discount').filter(':visible').text()).toEqual('Pursue a Verified Certificate($198 CAD $220 CAD)');
});
it('should send event on initial load', () => {
// eslint-disable-next-line object-curly-spacing
$.cookie('edx-price-l10n', '{"rate":1,"code":"USD","symbol":"$","countryCode":"US"}', { path: '/' });
currency = new Currency();
expect(window.analytics.track).toHaveBeenCalledWith('edx.bi.user.track_selection.local_currency_cookie_set');
Expand Down
1 change: 1 addition & 0 deletions webpack.common.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ module.exports = Merge.smart({
// https://github.com/webpack/webpack/issues/304#issuecomment-272150177
// (I've tried every other suggestion solution on that page, this
// was the only one that worked.)
// eslint-disable-next-line no-path-concat
sinon: __dirname + '/node_modules/sinon/pkg/sinon.js',
hls: 'hls.js/dist/hls.js'
},
Expand Down
2 changes: 2 additions & 0 deletions xmodule/js/src/poll/poll_main.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
// Send the data to the server as an AJAX request. Attach a callback that will
// be fired on server's response.
$.postWithPrefix(
// eslint-disable-next-line no-useless-concat
this.ajax_url + '/' + 'reset_poll',
{},
function(response) {
Expand Down Expand Up @@ -294,6 +295,7 @@
this.jsonConfig = JSON.parse(this.questionEl.children('.poll_question_div').html());

$.postWithPrefix(
// eslint-disable-next-line no-useless-concat
'' + this.questionEl.data('ajax-url') + '/' + 'get_state', {},
function(response) {
_this.jsonConfig.poll_answer = response.poll_answer;
Expand Down

0 comments on commit f0da55c

Please sign in to comment.