Skip to content

Commit

Permalink
Merge branch 'chore/run-prettier-on-project' into 'master'
Browse files Browse the repository at this point in the history
Run prettier on entire codebase

See merge request schema/origin-storefront!168
  • Loading branch information
richie-v1 committed Apr 29, 2022
2 parents 0651e74 + d4372ae commit 10d82e8
Show file tree
Hide file tree
Showing 100 changed files with 38,581 additions and 14,666 deletions.
4 changes: 4 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": ["env"],
"plugins": ["transform-vue-jsx"]
}
20 changes: 19 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,23 @@ module.exports = {
extends: ['@nuxtjs', 'plugin:nuxt/recommended', 'prettier'],
plugins: [],
// add your custom rules here
rules: {},
rules: {
'vue/multi-word-component-names': [
'error',
{
ignores: [
'error',
'Subscription',
'index',
'payments',
'returns',
'login',
'default',
'account',
'Order',
'addresses',
],
},
],
},
};
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run lintfix
2 changes: 1 addition & 1 deletion assets/css/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,6 @@ input[type='number'] {

@responsive {
.container {
@apply w-full mx-auto px-6 lg:px-8 xl:px-10;
@apply mx-auto w-full px-6 lg:px-8 xl:px-10;
}
}
6 changes: 3 additions & 3 deletions components/AccordionItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ export default {
data() {
return {
isExpanded: false,
}
};
},
methods: {
toggleExpanded() {
this.isExpanded = !this.isExpanded
this.isExpanded = !this.isExpanded;
},
},
}
};
</script>
2 changes: 1 addition & 1 deletion components/AccountAddressContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,5 @@ export default {
default: false,
},
},
}
};
</script>
78 changes: 39 additions & 39 deletions components/AccountAddressPopup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -296,24 +296,24 @@

<script>
// Helpers
import { validationMixin } from 'vuelidate'
import { required, maxLength, helpers } from 'vuelidate/lib/validators'
import { validationMixin } from 'vuelidate';
import { required, maxLength, helpers } from 'vuelidate/lib/validators';
// Phone number validation
const validPhone = helpers.regex(
'validPhone',
/^\s*(?:\+?(\d{1,3}))?([-. (]*(\d{3})[-. )]*)?((\d{3})[-. ]*(\d{2,4})(?:[-.x ]*(\d+))?)\s*$/
)
/^\s*(?:\+?(\d{1,3}))?([-. (]*(\d{3})[-. )]*)?((\d{3})[-. ]*(\d{2,4})(?:[-.x ]*(\d+))?)\s*$/,
);
export default {
components: {
async CountrySelect() {
const { CountrySelect } = await import('vue-country-region-select')
return CountrySelect
const { CountrySelect } = await import('vue-country-region-select');
return CountrySelect;
},
async RegionSelect() {
const { RegionSelect } = await import('vue-country-region-select')
return RegionSelect
const { RegionSelect } = await import('vue-country-region-select');
return RegionSelect;
},
},
Expand Down Expand Up @@ -374,22 +374,22 @@ export default {
country: '',
phone: '',
setDefault: false,
}
};
},
computed: {
disableDefaultOption() {
// Disable if no default address is set and no addresses exist
if (!this.defaultAddressId && !this.addressesLength) return true
if (!this.defaultAddressId && !this.addressesLength) return true;
// Disable if current address is the only one and default
if (this.address) {
if (
this.defaultAddressId === this.address.id &&
this.addressesLength === 1
)
return true
return true;
}
return false
return false;
},
addressBody() {
Expand All @@ -403,7 +403,7 @@ export default {
zip,
country,
phone,
} = this
} = this;
return {
firstName,
lastName,
Expand All @@ -414,26 +414,26 @@ export default {
zip,
country,
phone,
}
};
},
},
created() {
// Prefill form data for updating existing
if (this.address) {
this.firstName = this.address.firstName || ''
this.lastName = this.address.lastName || ''
this.address1 = this.address.address1 || ''
this.address2 = this.address.address2 || ''
this.state = this.address.state || ''
this.city = this.address.city || ''
this.zip = this.address.zip || ''
this.country = this.address.country || ''
this.phone = this.address.phone || ''
this.firstName = this.address.firstName || '';
this.lastName = this.address.lastName || '';
this.address1 = this.address.address1 || '';
this.address2 = this.address.address2 || '';
this.state = this.address.state || '';
this.city = this.address.city || '';
this.zip = this.address.zip || '';
this.country = this.address.country || '';
this.phone = this.address.phone || '';
// Set default check state
if (this.defaultAddressId === this.address.id) {
this.setDefault = true
this.setDefault = true;
}
}
Expand All @@ -443,46 +443,46 @@ export default {
!this.addressesLength &&
this.type === 'new'
) {
this.setDefault = true
this.setDefault = true;
}
},
methods: {
create() {
// Validate fields
this.$v.$touch()
if (this.$v.$invalid) return
this.$v.$touch();
if (this.$v.$invalid) return;
if (this.flow === 'payment') {
this.$emit('new-billing-address', {
...this.addressBody,
isDefault: this.setDefault,
})
return
});
return;
}
this.$emit('new', { ...this.addressBody, isDefault: this.setDefault })
this.$emit('new', { ...this.addressBody, isDefault: this.setDefault });
},
update() {
this.$v.$touch()
if (this.$v.$invalid) return
this.$v.$touch();
if (this.$v.$invalid) return;
this.$emit('update', { ...this.addressBody, isDefault: this.setDefault })
this.$emit('update', { ...this.addressBody, isDefault: this.setDefault });
},
remove() {
this.$emit('delete', this.address.id)
this.$emit('delete', this.address.id);
},
async handleEnterKey() {
switch (this.type) {
case 'update':
await this.update()
break
await this.update();
break;
case 'new':
await this.create()
break
await this.create();
break;
default:
}
},
Expand All @@ -498,5 +498,5 @@ export default {
country: { required },
phone: { validPhone },
},
}
};
</script>
18 changes: 9 additions & 9 deletions components/AccountCardContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,23 +90,23 @@ export default {
computed: {
formattedCardNumber() {
const { brand, last4 } = this.card
const { brand, last4 } = this.card;
if (brand === 'American Express') {
return `···· ···· ···${last4.substring(0, 1)} ${last4.substring(
1,
last4.length
)}`
last4.length,
)}`;
} else {
return `···· ···· ···· ${last4}`
return `···· ···· ···· ${last4}`;
}
},
expDate() {
const { expMonth, expYear } = this.card
const mm = expMonth.toString().padStart(2, '0')
const yy = expYear.toString().slice(-2)
return `${mm} / ${yy}`
const { expMonth, expYear } = this.card;
const mm = expMonth.toString().padStart(2, '0');
const yy = expYear.toString().slice(-2);
return `${mm} / ${yy}`;
},
},
}
};
</script>
Loading

0 comments on commit 10d82e8

Please sign in to comment.