Skip to content

Commit

Permalink
update package.json eslint script and fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
parmsang committed Apr 11, 2021
1 parent 828b249 commit 989b595
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 15 deletions.
12 changes: 6 additions & 6 deletions gatsby-node.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const Promise = require('bluebird')
const path = require('path')

exports.createPages = ({ graphql, actions }) => {
const { createPage } = actions
exports.createPages = ({graphql, actions}) => {
const {createPage} = actions

return new Promise((resolve, reject) => {
const productPageTemplate = path.resolve('src/templates/ProductPage.js')
Expand All @@ -18,7 +18,7 @@ exports.createPages = ({ graphql, actions }) => {
}
}
}
`
`,
).then(result => {
if (result.errors) {
console.log(result.errors)
Expand All @@ -33,13 +33,13 @@ exports.createPages = ({ graphql, actions }) => {
},
})
})
})
}),
)
})
}

exports.onCreateWebpackConfig = ({ actions }) => {
exports.onCreateWebpackConfig = ({actions}) => {
actions.setWebpackConfig({
node: { fs: 'empty' },
node: {fs: 'empty'},
})
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@
},
"scripts": {
"dev": "gatsby develop",
"lint": "eslint '**/*.{js,jsx}' --quiet",
"lint": "eslint . --ext .js,.jsx --ignore-path .gitignore",
"lint:fix": "eslint . --ext .js,.jsx --fix --ignore-path .gitignore",
"format": "prettier --write \"src/**/*.{js,jsx}\"",
"develop": "rimraf .cache && gatsby develop",
"build": "rimraf .cache && gatsby build",
Expand Down
10 changes: 7 additions & 3 deletions src/components/CartItemList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,17 @@ export default ({items, removeFromCart, loading, completed}) => {
</Item.Header>
),
image: (
<React.Fragment>
<Responsive as={MobileItemImage} {...Responsive.onlyMobile} />
<>
<Responsive
as={MobileItemImage}
minWidth={Responsive.onlyMobile.minWidth}
maxWidth={Responsive.onlyMobile.maxWidth}
/>
<Responsive
as={DesktopItemImage}
minWidth={Responsive.onlyTablet.minWidth}
/>
</React.Fragment>
</>
),
meta: `${quantity}x ${price}`,
description: 'Some more information goes here....',
Expand Down
12 changes: 8 additions & 4 deletions src/pages/cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,21 @@ const Cart = ({location}) => {
})
}

const rest = {completed, items, loading, cartId}

return (
<Layout location={location}>
<SEO title="Cart" />
<CartItemList
{...rest}
completed={completed}
items={items}
loading={loading}
cartId={cartId}
removeFromCart={item => handleRemoveFromCart(item)}
/>
{!loading && !completed && (
<CartSummary {...meta} handleCheckout={handleCheckout} />
<CartSummary
display_price={meta.display_price}
handleCheckout={handleCheckout}
/>
)}
</Layout>
)
Expand Down
2 changes: 1 addition & 1 deletion wrap-with-provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import AuthProvider from './src/components/Context/AuthProvider'
import CartProvider from './src/components/Context/CartProvider'

// eslint-disable-next-line import/prefer-default-export
export default ({ element }) => (
export default ({element}) => (
<AuthProvider>
<CartProvider>{element}</CartProvider>
</AuthProvider>
Expand Down

0 comments on commit 989b595

Please # to comment.