Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Remove semicolons

Marcin Gębala0d83efbab987
diff --git a/saleor/static/js/components/variantPicker/AttributeSelectionWidget.js b/saleor/static/js/components/variantPicker/AttributeSelectionWidget.js
index f296142582..c0a8760de3 100644
--- a/saleor/static/js/components/variantPicker/AttributeSelectionWidget.js
+++ b/saleor/static/js/components/variantPicker/AttributeSelectionWidget.js
@@ -1,4 +1,4 @@
-import React, { Component, PropTypes } from 'react';
+import React, { Component, PropTypes } from 'react'
export default class AttributeSelectionWidget extends Component {
@@ -10,12 +10,12 @@ export default class AttributeSelectionWidget extends Component {
};
handleChange = (event) => {
- const { name, value } = event.target;
- this.props.handleChange(name, value);
+ const { name, value } = event.target
+ this.props.handleChange(name, value)
}
render() {
- const { attribute: { display, pk, values }, selected } = this.props;
+ const { attribute: { display, pk, values }, selected } = this.props
return (
<div className="form-group">
<label className="control-label">{display}</label>
@@ -32,10 +32,10 @@ export default class AttributeSelectionWidget extends Component {
/>
{value.display}
</label>
- );
+ )
})}
</div>
</div>
- );
+ )
}
}
diff --git a/saleor/static/js/components/variantPicker/QuantityInput.js b/saleor/static/js/components/variantPicker/QuantityInput.js
index 12a02e239d..0709bb7457 100644
--- a/saleor/static/js/components/variantPicker/QuantityInput.js
+++ b/saleor/static/js/components/variantPicker/QuantityInput.js
@@ -1,5 +1,5 @@
-import classNames from 'classnames';
-import React, { Component, PropTypes } from 'react';
+import classNames from 'classnames'
+import React, { Component, PropTypes } from 'react'
export default class QuantityInput extends Component {
@@ -11,11 +11,11 @@ export default class QuantityInput extends Component {
}
render() {
- const { errors, quantity } = this.props;
+ const { errors, quantity } = this.props
const formGroupClasses = classNames({
'form-group': true,
'has-error': errors && !!errors.length
- });
+ })
return (
<div className={formGroupClasses}>
<label className="control-label" htmlFor="id_quantity">Quantity</label>
@@ -33,6 +33,6 @@ export default class QuantityInput extends Component {
<span className="help-block">{errors.join(' ')}</span>
)}
</div>
- );
+ )
}
}
diff --git a/saleor/static/js/components/variantPicker/VariantPicker.js b/saleor/static/js/components/variantPicker/VariantPicker.js
index 03ecb45f9c..7a74f63a57 100644
--- a/saleor/static/js/components/variantPicker/VariantPicker.js
+++ b/saleor/static/js/components/variantPicker/VariantPicker.js
@@ -1,10 +1,10 @@
-import _ from 'lodash';
-import $ from 'jquery';
-import classNames from 'classnames';
-import React, { Component, PropTypes } from 'react';
+import _ from 'lodash'
+import $ from 'jquery'
+import classNames from 'classnames'
+import React, { Component, PropTypes } from 'react'
-import AttributeSelectionWidget from './AttributeSelectionWidget';
-import QuantityInput from './QuantityInput';
+import AttributeSelectionWidget from './AttributeSelectionWidget'
+import QuantityInput from './QuantityInput'
export default class VariantPicker extends Component {
@@ -16,22 +16,22 @@ export default class VariantPicker extends Component {
}
constructor(props) {
- super(props);
- const { variants } = this.props;
+ super(props)
+ const { variants } = this.props
- const variant = variants.filter(v => !!Object.keys(v.attributes).length)[0];
- const selection = variant ? variant.attributes : {};
+ const variant = variants.filter(v => !!Object.keys(v.attributes).length)[0]
+ const selection = variant ? variant.attributes : {}
this.state = {
errors: {},
quantity: 1,
variant: variant,
selection: selection
- };
+ }
}
handleAddToCart = () => {
- const { quantity, variant } = this.state;
+ const { quantity, variant } = this.state
if (quantity > 0 && variant) {
$.ajax({
url: this.props.url,
@@ -41,20 +41,20 @@ export default class VariantPicker extends Component {
variant: variant.id
},
success: (response) => {
- const { next } = response;
+ const { next } = response
if (next) {
- window.location = next;
+ window.location = next
} else {
- location.reload();
+ location.reload()
}
},
error: (response) => {
- const { error } = response.responseJSON;
+ const { error } = response.responseJSON
if (error) {
- this.setState({ errors: response.responseJSON.error });
+ this.setState({ errors: response.responseJSON.error })
}
}
- });
+ })
}
}
@@ -62,32 +62,32 @@ export default class VariantPicker extends Component {
this.setState({
selection: Object.assign({}, this.state.selection, { [attrId]: valueId })
}, () => {
- this.matchVariantFromSelection();
- });
+ this.matchVariantFromSelection()
+ })
}
handleQuantityChange = (event) => {
- this.setState({quantity: parseInt(event.target.value)});
+ this.setState({quantity: parseInt(event.target.value)})
}
matchVariantFromSelection() {
- let matchedVariant = null;
+ let matchedVariant = null
this.props.variants.forEach(variant => {
if (_.isEqual(this.state.selection, variant.attributes)) {
- matchedVariant = variant;
+ matchedVariant = variant
}
- });
- this.setState({ variant: matchedVariant });
+ })
+ this.setState({ variant: matchedVariant })
}
render() {
- const { attributes } = this.props;
- const { errors, selection, quantity, variant } = this.state;
+ const { attributes } = this.props
+ const { errors, selection, quantity, variant } = this.state
const addToCartBtnClasses = classNames({
'btn btn-lg btn-block btn-primary': true,
'disabled': !variant
- });
+ })
return (
<div>
@@ -112,6 +112,6 @@ export default class VariantPicker extends Component {
</button>
</div>
</div>
- );
+ )
}
}
diff --git a/saleor/static/js/storefront.js b/saleor/static/js/storefront.js
index 31f0a497f6..a7169521f0 100644
--- a/saleor/static/js/storefront.js
+++ b/saleor/static/js/storefront.js
@@ -1,65 +1,65 @@
/* @flow */
-import 'bootstrap-sass';
-import $ from 'jquery';
-import 'jquery.cookie';
-import React from 'react';
-import ReactDOM from 'react-dom';
+import 'bootstrap-sass'
+import $ from 'jquery'
+import 'jquery.cookie'
+import React from 'react'
+import ReactDOM from 'react-dom'
-import '../scss/storefront.scss';
-import VariantPicker from './components/variantPicker/VariantPicker';
+import '../scss/storefront.scss'
+import VariantPicker from './components/variantPicker/VariantPicker'
-let csrftoken = $.cookie('csrftoken');
+let csrftoken = $.cookie('csrftoken')
function csrfSafeMethod(method) {
- return /^(GET|HEAD|OPTIONS|TRACE)$/.test(method);
+ return /^(GET|HEAD|OPTIONS|TRACE)$/.test(method)
}
$.ajaxSetup({
beforeSend: function(xhr, settings) {
if (!csrfSafeMethod(settings.type) && !this.crossDomain) {
- xhr.setRequestHeader('X-CSRFToken', csrftoken);
+ xhr.setRequestHeader('X-CSRFToken', csrftoken)
}
}
-});
+})
$(function() {
- const $carousel = $('.carousel');
- const $items = $('.product-gallery-item');
- const $modal = $('.modal');
+ const $carousel = $('.carousel')
+ const $items = $('.product-gallery-item')
+ const $modal = $('.modal')
$items.on('click', function(e) {
if ($carousel.is(':visible')) {
- e.preventDefault();
+ e.preventDefault()
}
- const index = $(this).index();
- $carousel.carousel(index);
- });
+ const index = $(this).index()
+ $carousel.carousel(index)
+ })
$modal.on('show.bs.modal', function() {
- const $img = $(this).find('.modal-body img');
- const dataSrc = $img.attr('data-src');
- $img.attr('src', dataSrc);
- });
-});
+ const $img = $(this).find('.modal-body img')
+ const dataSrc = $img.attr('data-src')
+ $img.attr('src', dataSrc)
+ })
+})
$(function() {
- const $i18nAddresses = $('.i18n-address');
+ const $i18nAddresses = $('.i18n-address')
$i18nAddresses.each(function () {
- const $form = $(this).closest('form');
- const $countryField = $form.find('select[name=country]');
- const $previewField = $form.find('input.preview');
+ const $form = $(this).closest('form')
+ const $countryField = $form.find('select[name=country]')
+ const $previewField = $form.find('input.preview')
$countryField.on('change', () => {
- $previewField.val('on');
- $form.submit();
- });
- });
-});
+ $previewField.val('on')
+ $form.submit()
+ })
+ })
+})
-const variantPicker = document.getElementById('variant-picker');
+const variantPicker = document.getElementById('variant-picker')
if (variantPicker) {
- const variantPickerData = JSON.parse(variantPicker.dataset.variantPickerData);
+ const variantPickerData = JSON.parse(variantPicker.dataset.variantPickerData)
ReactDOM.render(
<VariantPicker
attributes={variantPickerData.attributes}
@@ -67,7 +67,7 @@ if (variantPicker) {
variants={variantPickerData.variants}
/>,
variantPicker
- );
+ )
}