Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: apply automatic linter formatting #676

Merged
merged 2 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ trim_trailing_whitespace = false

[*.svg]
insert_final_newline = false

[package.json]
insert_final_newline = false
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default async function addWishlist(listName?: string): Promise<WishlistTy
listName,
},
},
}
},
);

return data!.createWishlist;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default async function resetPasswordByToken(payload: InputChangePasswordT
variables: {
command: payload,
},
}
},
);

return data!.changePassword;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { InputMemberAddressType, Mutations, MutationsDeleteMemberAddressesA

export default async function deleteMemberAddresses(
addresses: InputMemberAddressType[],
memberId: string
memberId: string,
): Promise<void> {
await graphqlClient.mutate<Required<Pick<Mutations, "deleteMemberAddresses">>, MutationsDeleteMemberAddressesArgs>({
mutation: mutationDocument,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default async function deleteWishlist(listId: string): Promise<boolean> {
listId,
},
},
}
},
);

return data!.removeWishlist;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type {
} from "@/core/api/graphql/types";

export default async function registerAccount(
registrationData: InputRequestRegistrationType
registrationData: InputRequestRegistrationType,
): Promise<RequestRegistrationType> {
const { data } = await graphqlClient.mutate<
Required<Pick<Mutations, "requestRegistration">>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type {
} from "@/core/api/graphql/types";

export default async function registerByInvitation(
payload: InputRegisterByInvitationType
payload: InputRegisterByInvitationType,
): Promise<CustomIdentityResultType> {
const { data } = await graphqlClient.mutate<
Required<Pick<Mutations, "registerByInvitation">>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default async function renameWishlist(payload: InputRenameWishlistType):
variables: {
command: payload,
},
}
},
);

return data!.renameWishlist;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type {
} from "@/core/api/graphql/types";

export default async function resetPasswordByToken(
payload: InputResetPasswordByTokenType
payload: InputResetPasswordByTokenType,
): Promise<IdentityResultType> {
const { data } = await graphqlClient.mutate<
Required<Pick<Mutations, "resetPasswordByToken">>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { InputMemberAddressType, Mutations, MutationsUpdateMemberAddressesA

export default async function updateMemberAddresses(
memberId: string,
addresses: InputMemberAddressType[]
addresses: InputMemberAddressType[],
): Promise<void> {
await graphqlClient.mutate<Required<Pick<Mutations, "updateMemberAddresses">>, MutationsUpdateMemberAddressesArgs>({
mutation: mutationDocument,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export type ChangeCartItemQuantityOptionsType = {
export async function changeCartItemQuantity(
lineItemId: string,
quantity: number,
options: ChangeCartItemQuantityOptionsType = {}
options: ChangeCartItemQuantityOptionsType = {},
): Promise<CartType> {
const { reloadFullCart = false } = options;
const { storeId, userId, cultureName, currencyCode } = globals;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export async function removeCartItem(lineItemId: string): Promise<CartType> {
lineItemId,
},
},
}
},
);

return data!.removeCartItem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export async function removeShipment(shipmentId: string, cartId?: string): Promi
shipmentId,
},
},
}
},
);

return data!.removeShipment;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export async function validateCoupon(coupon: string): Promise<boolean> {
coupon,
},
},
}
},
);

return data!.validateCoupon;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,6 @@ export async function getSearchResults(params: GetSearchResultsParamsType): Prom
categories: {},
products: {},
},
data
data,
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export async function searchProducts(
withImages?: boolean;
/** @default false */
withZeroPrice?: boolean;
} = {}
} = {},
): Promise<ProductConnection> {
const { storeId, catalogId, userId, cultureName, currencyCode } = globals;
const { withFacets = false, withImages = true, withZeroPrice = false } = options;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type {
} from "@/core/api/graphql/types";

export default async function changeOrganizationContactRole(
payload: InputChangeOrganizationContactRoleType
payload: InputChangeOrganizationContactRoleType,
): Promise<CustomIdentityResultType | undefined> {
const { data } = await graphqlClient.mutate<
Required<Pick<Mutations, "changeOrganizationContactRole">>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type {
} from "@/core/api/graphql/types";

export default async function removeMemberFromOrganization(
payload: InputRemoveMemberFromOrganizationType
payload: InputRemoveMemberFromOrganizationType,
): Promise<void> {
await graphqlClient.mutate<
Required<Pick<Mutations, "removeMemberFromOrganization">>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type {

export default async function getOrganizationAddresses(
organizationId: string,
payload?: OrganizationAddressesArgs
payload?: OrganizationAddressesArgs,
): Promise<MemberAddressConnection> {
const { userId } = globals;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type {

export default async function getOrganizationContacts(
organizationId: string,
payload: OrganizationContactsArgs
payload: OrganizationContactsArgs,
): Promise<ContactConnection> {
const { userId } = globals;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import mutationDocument from "./changeQuoteItemQuantityMutation.graphql";
import type { Mutations, MutationsChangeQuoteItemQuantityArgs, QuoteType } from "@/core/api/graphql/types";

export default async function changeQuoteItemQuantity(
payload: MutationsChangeQuoteItemQuantityArgs
payload: MutationsChangeQuoteItemQuantityArgs,
): Promise<QuoteType> {
const { data } = await graphqlClient.mutate<
Required<Pick<Mutations, "changeQuoteItemQuantity">>,
Expand Down
2 changes: 1 addition & 1 deletion client-app/core/composables/useCategoriesRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ export function useCategoriesRoutes(categories: MaybeRef<(Category | CategoryTre
unref(categories).reduce<Record<string, RouteLocationRaw>>((result, category) => {
result[category.id] = getCategoryRoute(category);
return result;
}, {})
}, {}),
);
}
2 changes: 1 addition & 1 deletion client-app/core/composables/useCurrency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const savedCurrencyCode = useLocalStorage<string | null>("currency", "");
const defaultCurrency = computed<ICurrency>(() => themeContext.value.defaultCurrency);
const supportedCurrencies = computed<ICurrency[]>(() => themeContext.value.availCurrencies);
const currentCurrency = computed<ICurrency>(
() => supportedCurrencies.value?.find((item) => item.code === savedCurrencyCode.value) || defaultCurrency.value
() => supportedCurrencies.value?.find((item) => item.code === savedCurrencyCode.value) || defaultCurrency.value,
);

function saveCurrencyCodeAndReload(code: string) {
Expand Down
5 changes: 2 additions & 3 deletions client-app/core/composables/useGoogleAnalytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,8 @@ function addShippingInfo(cart: CartType, params?: EventParamsExtendedType, shipm

function addPaymentInfo(cart: CartType, params?: EventParamsExtendedType, paymentGatewayCode?: string): void {
const paymentMethodCode = paymentGatewayCode || cart.payments?.[0]?.paymentGatewayCode;
const payment_type = cart.availablePaymentMethods?.find(
(paymentMethod) => paymentMethod.code === paymentMethodCode
)?.paymentMethodGroupType;
const payment_type = cart.availablePaymentMethods?.find((paymentMethod) => paymentMethod.code === paymentMethodCode)
?.paymentMethodGroupType;

sendEvent("add_payment_info", {
...params,
Expand Down
2 changes: 1 addition & 1 deletion client-app/core/composables/useLanguages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const currentLocale = computed<string>(() => {
});

const currentLanguage = computed<ILanguage>(
() => supportedLanguages.value.find((x) => x.twoLetterLanguageName === currentLocale.value) || defaultLanguage.value
() => supportedLanguages.value.find((x) => x.twoLetterLanguageName === currentLocale.value) || defaultLanguage.value,
);

function fetchLocaleMessages(locale: string): Promise<any> {
Expand Down
14 changes: 7 additions & 7 deletions client-app/core/composables/useNavigations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ const catalogMenuItems = shallowRef<ExtendedMenuLinkType[]>([]);
const openedMenuItemsStack = shallowRef<ExtendedMenuLinkType[]>([]);

const openedItem = computed<ExtendedMenuLinkType | undefined>(
() => openedMenuItemsStack.value[openedMenuItemsStack.value.length - 1]
() => openedMenuItemsStack.value[openedMenuItemsStack.value.length - 1],
);

const desktopMainMenuItems = computed<ExtendedMenuLinkType[]>(() =>
(menuSchema.value?.header.desktop || []).map((item: ExtendedMenuLinkType) => getTranslatedMenuLink(item))
(menuSchema.value?.header.desktop || []).map((item: ExtendedMenuLinkType) => getTranslatedMenuLink(item)),
);

const mobileMainMenuItems = computed<ExtendedMenuLinkType[]>(() =>
Expand All @@ -35,19 +35,19 @@ const mobileMainMenuItems = computed<ExtendedMenuLinkType[]>(() =>
}

return menuLink;
})
}),
);

const mobileCatalogMenuItem = computed<ExtendedMenuLinkType | null>(
() => mobileMainMenuItems.value.find((item) => item.id === "catalog") || null
() => mobileMainMenuItems.value.find((item) => item.id === "catalog") || null,
);

const mobileAccountMenuItem = computed<ExtendedMenuLinkType | null>(() =>
menuSchema.value ? getTranslatedMenuLink(menuSchema.value.header.mobile.account) : null
menuSchema.value ? getTranslatedMenuLink(menuSchema.value.header.mobile.account) : null,
);

const mobileCorporateMenuItem = computed<ExtendedMenuLinkType | null>(() =>
menuSchema.value ? getTranslatedMenuLink(menuSchema.value.header.mobile.corporate) : null
menuSchema.value ? getTranslatedMenuLink(menuSchema.value.header.mobile.corporate) : null,
);

const mobilePreSelectedMenuItem = computed<ExtendedMenuLinkType | null>(() => {
Expand Down Expand Up @@ -92,7 +92,7 @@ export function useNavigations() {
if (catalog_menu_link_list_name) {
// Use a list of links
catalogMenuItems.value = (await getMenu(catalog_menu_link_list_name)).map((item) =>
convertToExtendedMenuLink(item, true)
convertToExtendedMenuLink(item, true),
);
} else {
// Use the query `childCategories`, with `maxLevel` equal to 2
Expand Down
2 changes: 1 addition & 1 deletion client-app/core/composables/usePageHead.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function usePageHead(data: IUsePageSeoData) {

if (data.meta) {
Object.entries(data.meta).forEach(([name, content]) =>
headObject.meta.push({ name, content: () => unref(content) ?? "" })
headObject.meta.push({ name, content: () => unref(content) ?? "" }),
);
}

Expand Down
4 changes: 2 additions & 2 deletions client-app/core/composables/useProductsRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import type { RouteLocationRaw } from "vue-router";

export function useProductsRoutes(
products: MaybeRef<Record<string, any>[]>, // eslint-disable-line @typescript-eslint/no-explicit-any
options: { productIdProperty?: string; slugProperty?: string } = {}
options: { productIdProperty?: string; slugProperty?: string } = {},
): ComputedRef<Record<string, RouteLocationRaw>> {
const { productIdProperty = "id", slugProperty = "slug" } = options;

return computed(() =>
unref(products).reduce<Record<string, RouteLocationRaw>>((result, item) => {
result[item[productIdProperty]] = getProductRoute(item[productIdProperty], item[slugProperty]);
return result;
}, {})
}, {}),
);
}
2 changes: 1 addition & 1 deletion client-app/core/composables/useRouteQueryParam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type { LocationAsRelativeRaw, LocationQueryValue, LocationQueryValueRaw,

export function useRouteQueryParam<T = NonNullable<LocationQueryValue> | NonNullable<LocationQueryValue>[]>(
key: string,
options: IUseRouteQueryParamOptions<T> = {}
options: IUseRouteQueryParamOptions<T> = {},
): WritableComputedRef<T> {
const {
validator,
Expand Down
5 changes: 4 additions & 1 deletion client-app/core/types/search/sorting/sort.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ export class Sort extends SearchEntity implements ISortInfo {
this.fieldName = value;
}

constructor(public fieldName: string = "createdDate", public direction: SortDirection = SortDirection.Descending) {
constructor(
public fieldName: string = "createdDate",
public direction: SortDirection = SortDirection.Descending,
) {
super();
}

Expand Down
2 changes: 1 addition & 1 deletion client-app/core/utilities/address/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function getAddressName(address: AnyAddressType): string {
export function isEqualAddresses(
address1: AnyAddressType,
address2: AnyAddressType,
options: { skipDescription?: boolean } = {}
options: { skipDescription?: boolean } = {},
): boolean {
const { skipDescription = true } = options;
const verifiableProperties: Array<keyof MemberAddressType> = [
Expand Down
2 changes: 1 addition & 1 deletion client-app/core/utilities/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export function convertToType<To, From = Record<any, any>>(value?: From): To {

export async function asyncForEach<T>(
array: T[],
callbackFn: (value: T, index: number, arr: T[]) => Promise<void>
callbackFn: (value: T, index: number, arr: T[]) => Promise<void>,
): Promise<void> {
for (let i = 0, l = array.length; i < l; i++) {
await callbackFn(array[i], i, array);
Expand Down
4 changes: 2 additions & 2 deletions client-app/core/utilities/line-items/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function isQuoteItemType(item: AnyLineItemType): item is QuoteItemType {
}

export function getLineItemsGroupedByVendor<T extends LineItemType | OrderLineItemType>(
items: T[]
items: T[],
): LineItemsGroupByVendorType<T>[] {
// NOTE: The group without the vendor should be displayed last.
const groupWithoutVendor: LineItemsGroupByVendorType<T> = { items: [] };
Expand Down Expand Up @@ -101,7 +101,7 @@ export function prepareLineItem(item: AnyLineItemType, countInCart?: number): Pr
}

export function prepareLineItems(
items: LineItemType[] | OrderLineItemType[] | QuoteItemType[]
items: LineItemType[] | OrderLineItemType[] | QuoteItemType[],
): PreparedLineItemType[] {
return items.map((item) => prepareLineItem(item));
}
2 changes: 1 addition & 1 deletion client-app/core/utilities/search/facets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function getFilterExpressionFromFacets(facets: MaybeRef<FacetItemType[]>)
item.value
// https://github.com/VirtoCommerce/vc-module-experience-api/blob/dev/docs/filter-syntax.md#escaping-special-characters
.replace(/\\/g, "\\\\")
.replace(/"/g, '\\"')
.replace(/"/g, '\\"'),
);

if (!selectedValues.length) {
Expand Down
2 changes: 1 addition & 1 deletion client-app/pages/account/addresses.vue
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ const itemsPerPage = ref(6);

const pages = computed<number>(() => Math.ceil(addresses.value.length / itemsPerPage.value));
const paginatedAddresses = computed<MemberAddressType[]>(() =>
addresses.value.slice((page.value - 1) * itemsPerPage.value, page.value * itemsPerPage.value)
addresses.value.slice((page.value - 1) * itemsPerPage.value, page.value * itemsPerPage.value),
);

const columns = computed<ITableColumn[]>(() => [
Expand Down
Loading
Loading