Skip to content

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

Update eslintrc and apply cosmetic changes

Marcin Gębala8c5f04993983
diff --git a/.eslintrc.json b/.eslintrc.json
index 73c31526af..dc803b3515 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -2,17 +2,17 @@
"env": {
"browser": true
},
- "plugins": [
- "react"
- ],
- "extends": [
- "eslint:recommended", "plugin:react/recommended"
- ],
+ "extends": ["eslint:recommended", "plugin:react/recommended"],
+ "plugins": ["react"],
"parser": "babel-eslint",
"rules": {
- "quotes": [1, "single"],
- "strict": [2, "never"],
"comma-dangle": ["error", "only-multiline"],
- "react/jsx-no-bind": ["error"]
+ "indent": ["error", 2],
+ "no-trailing-spaces": ["warn"],
+ "no-undef": ["error"],
+ "react/jsx-no-bind": ["error"],
+ "semi": ["error", "always"],
+ "strict": ["error", "never"],
+ "quotes": ["warn", "single"]
}
}
\ No newline at end of file
diff --git a/saleor/static/js/category.js b/saleor/static/js/category.js
index 27dc784316..927b36643f 100644
--- a/saleor/static/js/category.js
+++ b/saleor/static/js/category.js
@@ -1,17 +1,17 @@
-import React, { PropTypes } from 'react'
-import ReactDOM from 'react-dom'
-import Relay from 'react-relay'
+import React, { PropTypes } from 'react';
+import ReactDOM from 'react-dom';
+import Relay from 'react-relay';
-import CategoryPage from './components/CategoryPage'
-import ProductFilters from './components/ProductFilters'
+import CategoryPage from './components/CategoryPage';
+import ProductFilters from './components/ProductFilters';
const categoryPage = document.getElementById('category-page');
const categoryData = JSON.parse(categoryPage.getAttribute('data-category'));
Relay.injectNetworkLayer(
- new Relay.DefaultNetworkLayer('/graphql/', {
- credentials: 'same-origin',
- })
+ new Relay.DefaultNetworkLayer('/graphql/', {
+ credentials: 'same-origin',
+ })
);
class App extends React.Component {
@@ -22,11 +22,11 @@ class App extends React.Component {
render() {
return (
- <CategoryPage
- category = {this.props.viewer.category}
- attributes = {this.props.viewer.attributes}
- />
- );
+ <CategoryPage
+ category={this.props.viewer.category}
+ attributes={this.props.viewer.attributes}
+ />
+ );
}
}
diff --git a/saleor/static/js/components/CategoryFilter.js b/saleor/static/js/components/CategoryFilter.js
index c9dd5dd833..ec952265f2 100644
--- a/saleor/static/js/components/CategoryFilter.js
+++ b/saleor/static/js/components/CategoryFilter.js
@@ -1,4 +1,4 @@
-import React, { Component, PropTypes } from 'react'
+import React, { Component, PropTypes } from 'react';
export default class CategoryFilter extends Component {
@@ -17,14 +17,13 @@ export default class CategoryFilter extends Component {
<span>{category.productsCount}</span>
</li>
{category.siblings && (category.siblings.map((sibling) => {
- return (
- <li key={sibling.pk} className="item">
- <a href={sibling.url}>{sibling.name}</a>
- <span>{sibling.productsCount}</span>
- </li>
- );
- })
- )}
+ return (
+ <li key={sibling.pk} className="item">
+ <a href={sibling.url}>{sibling.name}</a>
+ <span>{sibling.productsCount}</span>
+ </li>
+ );
+ }))}
</ul>
</div>
);
diff --git a/saleor/static/js/components/CategoryPage.js b/saleor/static/js/components/CategoryPage.js
index ac7313df80..7c8ac1a405 100644
--- a/saleor/static/js/components/CategoryPage.js
+++ b/saleor/static/js/components/CategoryPage.js
@@ -29,7 +29,7 @@ class CategoryPage extends Component {
loadMore = () => {
this.props.relay.setVariables({
count: this.props.relay.variables.count + PAGINATE_BY
- })
+ });
}
setAttributesFilter = (attributes) => {
@@ -41,7 +41,6 @@ class CategoryPage extends Component {
}, () => {
this.setUrlParams();
});
-
}
setPriceFilter = (minPrice, maxPrice) => {
@@ -53,12 +52,12 @@ class CategoryPage extends Component {
});
if (minPrice && maxPrice) {
- enabled = [`minPrice=${minPrice}`, `maxPrice=${maxPrice}`]
+ enabled = [`minPrice=${minPrice}`, `maxPrice=${maxPrice}`];
} else {
if (minPrice) {
- enabled = [`minPrice=${minPrice}`]
+ enabled = [`minPrice=${minPrice}`];
} else if (maxPrice) {
- enabled = [`maxPrice=${maxPrice}`]
+ enabled = [`maxPrice=${maxPrice}`];
}
}
@@ -76,23 +75,23 @@ class CategoryPage extends Component {
if (attributesFilter) {
attributesFilter.map((param, index) => {
- param = param.replace(':', '=');
- if (index == 0) {
- url += '?' + param;
- } else {
- url += '&' + param;
- }
- })
+ param = param.replace(':', '=');
+ if (index == 0) {
+ url += '?' + param;
+ } else {
+ url += '&' + param;
+ }
+ });
}
if (priceFilters) {
priceFilters.map((param, index) => {
- if (index == 0) {
- url += '?' + param;
- } else {
- url += '&' + param;
- }
- })
+ if (index == 0) {
+ url += '?' + param;
+ } else {
+ url += '' + param;
+ }
+ });
}
if (attributesFilter.length == 0 && priceFilters.length == 0) {
@@ -133,9 +132,9 @@ class CategoryPage extends Component {
products={category.products}
/>
</div>
- </div>
+ </div>
</div>
- )
+ );
}
}
diff --git a/saleor/static/js/components/PriceFilter.js b/saleor/static/js/components/PriceFilter.js
index 123b37572e..2217b2d67f 100644
--- a/saleor/static/js/components/PriceFilter.js
+++ b/saleor/static/js/components/PriceFilter.js
@@ -13,18 +13,18 @@ export default class PriceFilter extends Component {
minPrice: null,
maxPrice: null,
filters: []
- }
+ };
}
checkKey = (event) => {
if (event.key === 'Enter') {
- this.updateFilter()
+ this.updateFilter();
}
};
onChange = (event) => {
const { name, value } = event.target;
- this.setState({[name]: value})
+ this.setState({[name]: value});
}
parseValue = (value) => {
diff --git a/saleor/static/js/components/ProductFilters.js b/saleor/static/js/components/ProductFilters.js
index f6c011dbf3..49735a3d41 100644
--- a/saleor/static/js/components/ProductFilters.js
+++ b/saleor/static/js/components/ProductFilters.js
@@ -1,4 +1,4 @@
-import React, { Component, PropTypes } from 'react'
+import React, { Component, PropTypes } from 'react';
import Relay from 'react-relay';
@@ -46,14 +46,14 @@ class ProductFilters extends Component {
{value.display}
</label>
</li>
- )
+ );
})}
</ul>
</div>
- )
+ );
}))}
</div>
- )
+ );
}
}
diff --git a/saleor/static/js/components/ProductItem.js b/saleor/static/js/components/ProductItem.js
index 74bedfe4d9..43da28c9af 100644
--- a/saleor/static/js/components/ProductItem.js
+++ b/saleor/static/js/components/ProductItem.js
@@ -1,5 +1,5 @@
-import React, { Component, PropTypes } from 'react'
-import Relay from 'react-relay'
+import React, { Component, PropTypes } from 'react';
+import Relay from 'react-relay';
class ProductItem extends Component {
diff --git a/saleor/static/js/components/ProductList.js b/saleor/static/js/components/ProductList.js
index 8c163a6e93..b87ea411ca 100644
--- a/saleor/static/js/components/ProductList.js
+++ b/saleor/static/js/components/ProductList.js
@@ -1,5 +1,5 @@
-import React, { Component, PropTypes } from 'react'
-import Relay from 'react-relay'
+import React, { Component, PropTypes } from 'react';
+import Relay from 'react-relay';
import ProductItem from './ProductItem';
@@ -28,7 +28,7 @@ class ProductList extends Component {
)}
</div>
</div>
- )
+ );
}
}