Skip to content

Commit 467af6c

Browse files
authored
Merge pull request #117 from swlodarski-sumoheavy/10.1.x-eslint
SP-1082: Magento 2 ESLint
2 parents e8b91fe + f2081dc commit 467af6c

File tree

14 files changed

+78
-349
lines changed

14 files changed

+78
-349
lines changed

.github/workflows/test.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Test
2+
3+
on: [push, pull_request]
4+
5+
env:
6+
NODE_VERSION: 18
7+
8+
jobs:
9+
lint:
10+
name: ESLint
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- uses: actions/setup-node@v2
15+
with:
16+
node-version: ${{ env.NODE_VERSION }}
17+
18+
- name: Run linter
19+
run: |
20+
composer config --no-plugins allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
21+
composer require magento/magento-coding-standard --dev
22+
cd vendor/magento/magento-coding-standard
23+
npm install
24+
npm run eslint -- ../../../view

view/adminhtml/layout/sales_order_view.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-2columns-left"
33
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
44
<head>
5-
<link src="Bitpay_BPCheckout::js/send_ipn_request.js"/>
5+
<link src="Bitpay_BPCheckout::js/bootstrap/sales-order-view.js"/>
66
</head>
77
<body>
88
<referenceBlock name="order_tab_info">
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
require([
2+
'Bitpay_BPCheckout/js/send_ipn_request'
3+
]);
+17-14
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1-
function sendIpnRequest(url, orderId) {
1+
define([], function () {
2+
'use strict';
23

3-
jQuery.ajax({
4-
url: url,
5-
method: 'POST',
6-
data: {
7-
form_key: window.FORM_KEY,
8-
order_id: orderId
9-
},
10-
dataType: 'json',
11-
complete: function(response) {
12-
window.location.reload();
13-
},
14-
});
15-
}
4+
window.sendIpnRequest = function (url, orderId) {
5+
jQuery.ajax({
6+
url: url,
7+
method: 'POST',
8+
data: {
9+
form_key: window.FORM_KEY,
10+
order_id: orderId
11+
},
12+
dataType: 'json',
13+
complete: function () {
14+
window.location.reload();
15+
}
16+
});
17+
};
18+
});

view/frontend/layout/default.xml

-7
This file was deleted.

view/frontend/requirejs-config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
var config = {
22
map: {
33
'*': {
4-
bitpay: 'https://bitpay.com/bitpay.min.js',
4+
bitpay: 'https://bitpay.com/bitpay.min.js'
55
}
66
}
77
};

view/frontend/web/js/bitpay/checkout/index.js

-59
This file was deleted.

view/frontend/web/js/bitpay/config.js

-11
This file was deleted.

view/frontend/web/js/checkout.js

+16-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1-
require(['mage/storage', 'Magento_Checkout/js/checkout-data', 'uiRegistry'], function (storage, checkoutData, registry) {
1+
require([
2+
'mage/storage',
3+
'Magento_Checkout/js/checkout-data',
4+
'uiRegistry'
5+
],
6+
function (storage, checkoutData, registry) {
7+
'use strict';
8+
29
storage.get('/bitpay-invoice/customer/data').done(function (data) {
10+
var addressFormData = {};
11+
312
if (!data) {
413
return;
514
}
6-
var addressFormData = {
15+
addressFormData = {
716
'firstname': data.billingAddress.firstname,
817
'lastname': data.billingAddress.lastname,
918
'street': {'0': data.billingAddress.street},
@@ -13,12 +22,13 @@ require(['mage/storage', 'Magento_Checkout/js/checkout-data', 'uiRegistry'], fun
1322
'region_id': data.billingAddress.region_id
1423
};
1524

16-
registry.async('checkoutProvider')(function (checkoutProvider) {
25+
registry.async('checkoutProvider')(function () {
1726
var shippingAddressData = checkoutData.getShippingAddressFromData();
27+
1828
if (!shippingAddressData && window.isCustomerLoggedIn === false) {
19-
checkoutData.setShippingAddressFromData(addressFormData)
29+
checkoutData.setShippingAddressFromData(addressFormData);
2030
}
21-
checkoutData.setInputFieldEmailValue(data.email)
22-
})
31+
checkoutData.setInputFieldEmailValue(data.email);
32+
});
2333
});
2434
});

view/frontend/web/js/checkout/cart.js

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
require(['Magento_Customer/js/customer-data', 'mage/url'], function (customerData, url) {
2-
var queryString = window.location.search;
3-
var urlParams = new URLSearchParams(queryString);
4-
var reload = urlParams.get('reload')
2+
'use strict';
3+
4+
var queryString = window.location.search,
5+
urlParams = new URLSearchParams(queryString),
6+
reload = urlParams.get('reload');
7+
58
if (reload) {
6-
customerData.initStorage()
9+
customerData.initStorage();
710
customerData.invalidate(['cart']);
8-
window.history.pushState(null, null, url.build('checkout/cart'))
11+
window.history.pushState(null, null, url.build('checkout/cart'));
912
}
1013
});

view/frontend/web/js/sales/guest/form.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
require(['mage/storage'], function (storage) {
2+
'use strict';
3+
24
// autofill form guest form
35
setTimeout(function () {
46
storage.get('/bitpay-invoice/customer/data').done(function (data) {
57
if (!data) {
68
return;
79
}
8-
document.getElementById("oar-order-id").value = data.incrementId;
9-
document.getElementById("oar-billing-lastname").value = data.billingAddress.lastname;
10-
document.getElementById("oar_email").value = data.email;
10+
document.getElementById('oar-order-id').value = data.incrementId;
11+
document.getElementById('oar-billing-lastname').value = data.billingAddress.lastname;
12+
document.getElementById('oar_email').value = data.email;
1113
});
1214
},
1315
1000);

view/frontend/web/js/view/payment/bpcheckout.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* See COPYING.txt for license details.
44
*/
55
/*browser:true*/
6-
/*global define*/
76
define(
87
[
98
'uiComponent',
@@ -18,6 +17,7 @@ define(
1817
type: 'bpcheckout',
1918
component: 'Bitpay_BPCheckout/js/view/payment/method-renderer/bpcheckout-method'
2019
});
20+
2121
/** Add view logic here if needed */
2222
return Component.extend({});
2323
}

0 commit comments

Comments
 (0)