Skip to content

Commit 78201f7

Browse files
author
Kirill Kaiumov
committed
Fix eslint warnings
1 parent 5d1b8ff commit 78201f7

File tree

9 files changed

+29
-24
lines changed

9 files changed

+29
-24
lines changed

.eslintrc

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ globals:
1111
Raphael: true
1212
SpreeAPI: true
1313
SpreePaths: true
14+
CouponManager: true
15+
ThumbnailsCarousel: true
1416

1517
env:
1618
browser: true

frontend/app/assets/javascripts/spree/frontend/cart.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Spree.ready(function ($) {
1111
$('form#update-cart input.shopping-cart-item-quantity-input').on('keyup', function(e) {
1212
var itemId = $(this).attr('data-id')
1313
var value = $(this).val()
14-
var newValue = isNaN(value) || value === "" ? value : parseInt(value, 10)
14+
var newValue = isNaN(value) || value === '' ? value : parseInt(value, 10)
1515
var targetInputs = $("form#update-cart input.shopping-cart-item-quantity-input[data-id='" + itemId + "']")
1616
$(targetInputs).val(newValue)
1717
})

frontend/app/assets/javascripts/spree/frontend/checkout.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ Spree.ready(function () {
3737
} else {
3838
return false
3939
}
40-
4140
})
41+
4242
$('form#checkout_form_confirm button#shopping-cart-remove-coupon-code-button').off('click').on('click', function(event) {
4343
var input = {
4444
appliedCouponCodeField: $('#order_applied_coupon_code'),

frontend/app/assets/javascripts/spree/frontend/product.js

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
Spree.ready(function($) {
55
$('body').on('product_add_to_cart', function(event) {
6-
76
Spree.showProductAddedModal(event.product, event.variant)
87
})
98
})

frontend/app/assets/javascripts/spree/frontend/views/spree/products/cart_form.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ Spree.ready(function($) {
264264
cart: response.attributes
265265
})
266266
},
267-
function(error) {
267+
function(_error) {
268268
document.getElementById('overlay').classList.add('shown')
269269
document.getElementById('no-product-available').classList.add('shown')
270270
window.scrollTo(0, 0)
@@ -277,6 +277,6 @@ Spree.ready(function($) {
277277
$(ADD_TO_CART_FORM_SELECTOR).each(function(_cartFormIndex, cartFormElement) {
278278
var $cartForm = $(cartFormElement)
279279

280-
new CartForm($, $cartForm)
280+
CartForm($, $cartForm)
281281
})
282282
})
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
$(function() {
2-
$('#product-description-arrow').click(function() {
3-
document.getElementById('product-description-long').classList.remove('d-none')
4-
document.getElementById('product-description-short').classList.add('d-none')
5-
document.getElementById('product-description-arrow').classList.remove('d-flex')
6-
document.getElementById('product-description-arrow').classList.add('d-none')
2+
$('#product-description-arrow').click(function() {
3+
document.getElementById('product-description-long').classList.remove('d-none')
4+
document.getElementById('product-description-short').classList.add('d-none')
5+
document.getElementById('product-description-arrow').classList.remove('d-flex')
6+
document.getElementById('product-description-arrow').classList.add('d-none')
77
})
88
})

frontend/app/assets/javascripts/spree/frontend/views/spree/products/modal_carousel.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Spree.ready(function($) {
22
var $modalCarousel = $('#productModalThumbnailsCarousel')
3-
new ThumbnailsCarousel($, $modalCarousel)
3+
ThumbnailsCarousel($, $modalCarousel)
44

55
var activeSingleImageIndex = function(sourceWrappingClass) {
66
var $activeSingleImage = $('.' + sourceWrappingClass + ' .product-details-single [data-variant-id].active')

frontend/app/assets/javascripts/spree/frontend/views/spree/shared/carousel/thumbnails.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,5 +130,5 @@ Spree.ready(function($) {
130130

131131
var $carousel = $('#productThumbnailsCarousel')
132132

133-
new ThumbnailsCarousel($, $carousel)
133+
ThumbnailsCarousel($, $carousel)
134134
})
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,27 @@
11
Spree.ready(function($) {
22
var deleteAddressLinks = document.querySelectorAll('.js-delete-address-link');
3-
if (deleteAddressLinks.length > 0) deleteAddressLinks.forEach(function(deleteLink) {
4-
deleteLink.addEventListener('click', function(e) {
5-
document.querySelector('#overlay').classList.add('shown');
6-
document.querySelector('#delete-address-popup').classList.add('shown');
7-
document.querySelector('#delete-address-popup-confirm').href = e.currentTarget.dataset.address;
8-
}, false)
9-
})
3+
if (deleteAddressLinks.length > 0) {
4+
deleteAddressLinks.forEach(function(deleteLink) {
5+
deleteLink.addEventListener('click', function(e) {
6+
document.querySelector('#overlay').classList.add('shown');
7+
document.querySelector('#delete-address-popup').classList.add('shown');
8+
document.querySelector('#delete-address-popup-confirm').href = e.currentTarget.dataset.address;
9+
}, false)
10+
})
11+
}
1012

1113
document.querySelector('#overlay').addEventListener('click', function () {
1214
var addressActionElement = document.querySelector('#delete-address-popup');
1315
if (addressActionElement) addressActionElement.classList.remove('shown');
1416
}, false);
1517

1618
var popupCloseButtons = document.querySelectorAll('.js-delete-address-popup-close-button')
17-
if (popupCloseButtons.length > 0) popupCloseButtons.forEach(function(closeButton) {
18-
closeButton.addEventListener('click', function(e) {
19-
document.querySelector('#overlay').classList.remove('shown');
20-
document.querySelector('#delete-address-popup').classList.remove('shown');
19+
if (popupCloseButtons.length > 0) {
20+
popupCloseButtons.forEach(function(closeButton) {
21+
closeButton.addEventListener('click', function(e) {
22+
document.querySelector('#overlay').classList.remove('shown');
23+
document.querySelector('#delete-address-popup').classList.remove('shown');
24+
})
2125
})
22-
})
26+
}
2327
})

0 commit comments

Comments
 (0)