I've got this code in a .js file that I'm running through ESLint. But it's throwing an error about this line: iFrameResize({
.
Saying: error 'iFrameResize' is not defined no-undef
.
If I define it like this: const iFrameResize()
My code no longer works, how do I make ESLint happy and keep the code working?
export default class Page extends PageManager {
before(next) {
next();
}
loaded(next) {
next();
}
after(next) {
const url = Url.parse(location.href, true);
const IC_PAGE = '/international-checkout';
const currentPageUrl = url.pathname;
if (currentPageUrl.indexOf(IC_PAGE) !== -1 && $('#icForm').length === 1) {
$(document).ready(() => {
if ($('#icForm').length === 1) {
if ($('.GiftStatus') && $('.GiftStatus').val() === '1') {
alert('Gift Certificate is not available for international orders. Please remove Gift Certificate from shopping cart before proceeding with International Checkout.');
window.parent.location.href = '/cart.php';
return false;
}
$('.icformfields').each((i, e) => {
const currentId = $(e).attr('id');
const res = currentId.split('-');
const finalId = Number(res[1]) + 1;
const finalName = $(e).attr('name') + finalId;
$(e.currentTarget).attr('name', finalName);
});
document.getElementById('icIframe').src = 'https://www.internationalcheckout.com/cart.php';
document.getElementById('icForm').submit();
$('#icIframe').load(() => {
$('#icForm').remove();
$('#loading').css('display', 'none');
$('html, body').animate({
scrollTop: $('#icIframe').offset().top,
}, 1000);
$('#icIframe').fadeIn();
});
}
});
iFrameResize({
checkOrigin: false,
enablePublicMethods: true,
});
}
next();
}
}
I want to know how to satisfy ESLint without disabling error reporting for the particular line.