Skip to content

Commit

Permalink
Run autofix for monorepo (#1681)
Browse files Browse the repository at this point in the history
  • Loading branch information
krzysztofzuraw authored Jan 13, 2025
1 parent f1e577c commit 9fc9edf
Show file tree
Hide file tree
Showing 255 changed files with 721 additions and 528 deletions.
19 changes: 19 additions & 0 deletions .changeset/silver-mangos-behave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
"@saleor/react-hook-form-macaw": patch
"@saleor/webhook-utils": patch
"products-feed": patch
"@saleor/apps-logger": patch
"@saleor/apps-shared": patch
"@saleor/apps-otel": patch
"@saleor/trpc": patch
"klaviyo": patch
"segment": patch
"@saleor/e2e": patch
"app-avatax": patch
"cms-v2": patch
"search": patch
"@saleor/apps-ui": patch
"smtp": patch
---

Fixed autofixable liniting issues. No functional changes.
5 changes: 3 additions & 2 deletions apps/avatax/src/modules/app/metadata-manager.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { encrypt } from "@saleor/app-sdk/settings-manager";
import { Client } from "urql";
import { describe, expect, it, Mock, vi } from "vitest";
import { describe, expect, it, vi } from "vitest";

import { AppMetadataCache } from "../../lib/app-metadata-cache";
import { createSettingsManager } from "./metadata-manager";
Expand Down Expand Up @@ -36,7 +36,8 @@ describe("MetadataManager", () => {
const cache = new AppMetadataCache();
const manager = createSettingsManager(mockGqlClient, "test-id", cache);

(mockGqlClient.query as Mock).mockImplementationOnce(() => {
// @ts-expect-error mocking the request for testing
vi.mocked(mockGqlClient.query).mockImplementationOnce(() => {
return {
async toPromise() {
return {
Expand Down
3 changes: 2 additions & 1 deletion apps/cms-v2/scripts/deploy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { exportSentryReleaseEnvironmentVariable } from "@saleor/sentry-utils";
import { execSync } from "node:child_process";

import { exportSentryReleaseEnvironmentVariable } from "@saleor/sentry-utils";

import packageJson from "../package.json";

exportSentryReleaseEnvironmentVariable(packageJson.version);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useCallback, useEffect, useState } from "react";

import { BulkImportProductFragment } from "../../../generated/graphql";
import { VariantsSyncStatusListItem } from "./variants-sync-status-list";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useAppBridge } from "@saleor/app-sdk/app-bridge";
import { createGraphQLClient } from "@saleor/apps-shared";
import { useEffect, useState } from "react";

import { createGraphQLClient } from "@saleor/apps-shared";
import {
BulkImportProductFragment,
FetchProductsPaginatedDocument,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useDashboardNotification } from "@saleor/apps-shared";
import { ButtonsBox, Layout, SkeletonLayout } from "@saleor/apps-ui";
import { Box, Button, Text } from "@saleor/macaw-ui";
import { useState } from "react";

import { trpcClient } from "../trpc/trpc-client";
import { AddConnectionModal } from "./add-connection-modal";
import { ChanelProviderConnectionsSectionHeader } from "./channel-provider-connections-section-header";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { AuthData } from "@saleor/app-sdk/APL";
import { SettingsManager } from "@saleor/app-sdk/settings-manager";
import { createGraphQLClient } from "@saleor/apps-shared";

import { AppConfig } from "./app-config";
import { createSettingsManager } from "./metadata-manager";
import { AuthData } from "@saleor/app-sdk/APL";
import { createGraphQLClient } from "@saleor/apps-shared";

export class AppConfigMetadataManager {
public readonly metadataKey = "app-config-v1";
Expand Down
3 changes: 2 additions & 1 deletion apps/cms-v2/src/modules/configuration/app-config.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { describe, it, expect, beforeEach } from "vitest";
import { beforeEach,describe, expect, it } from "vitest";

import { AppConfig } from "./app-config";
import { ContentfulProviderConfig } from "./schemas/contentful-provider.schema";
import { DatocmsProviderConfig } from "./schemas/datocms-provider.schema";
Expand Down
6 changes: 3 additions & 3 deletions apps/cms-v2/src/modules/configuration/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
export * from "./app-config";
export * from "./app-config-metadata-manager";
export * from "./metadata-manager";
export * from "./schemas/builder-provider.schema";
export * from "./schemas/channel-provider-connection.schema";
export * from "./schemas/contentful-provider.schema";
export * from "./schemas/builder-provider.schema";
export * from "./schemas/datocms-provider.schema";
export * from "./schemas/strapi-provider.schema";
export * from "./schemas/saleor-provider-fields-mapping.schema";
export * from "./schemas/root-config.schema";
export * from "./schemas/saleor-provider-fields-mapping.schema";
export * from "./schemas/strapi-provider.schema";
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { z } from "zod";
import { SaleorProviderFieldsMappingSchema } from "./saleor-provider-fields-mapping.schema";

import { BuilderIo } from "@/modules/providers/builder.io/builder-io";

import { SaleorProviderFieldsMappingSchema } from "./saleor-provider-fields-mapping.schema";

const InputSchema = z.object({
type: z.literal(BuilderIo.type),
privateApiKey: z.string().min(1),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { cmsTypes } from "@/modules/providers/providers-registry";
import { z } from "zod";

import { cmsTypes } from "@/modules/providers/providers-registry";

const InputSchema = z.object({
channelSlug: z.string().min(1),
providerId: z.string().min(1),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { z } from "zod";

import { Contentful } from "../../providers/contentful/contentful";
import { SaleorProviderFieldsMappingSchema } from "./saleor-provider-fields-mapping.schema";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Datocms } from "@/modules/providers/datocms/datocms";
import { z } from "zod";

import { Datocms } from "@/modules/providers/datocms/datocms";

import { SaleorProviderFieldsMappingSchema } from "./saleor-provider-fields-mapping.schema";

const InputSchema = z.object({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { PayloadCMS } from "@/modules/providers/payloadcms/payloadcms";
import { z } from "zod";

import { PayloadCMS } from "@/modules/providers/payloadcms/payloadcms";

import { SaleorProviderFieldsMappingSchema } from "./saleor-provider-fields-mapping.schema";

const InputSchema = z.object({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { z } from "zod";

import { BuilderIoProviderConfig } from "./builder-provider.schema";
import { ChannelProviderConnectionConfig } from "./channel-provider-connection.schema";
import { ContentfulProviderConfig } from "./contentful-provider.schema";
import { BuilderIoProviderConfig } from "./builder-provider.schema";
import { StrapiProviderConfig } from "./strapi-provider.schema";
import { DatocmsProviderConfig } from "./datocms-provider.schema";
import { PayloadCmsProviderConfig } from "./payloadcms-provider.schema";
import { StrapiProviderConfig } from "./strapi-provider.schema";

export namespace ProvidersConfig {
const AnyFull = z.union([
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Strapi } from "@/modules/providers/strapi/strapi";
import { z } from "zod";

import { Strapi } from "@/modules/providers/strapi/strapi";

import { SaleorProviderFieldsMappingSchema } from "./saleor-provider-fields-mapping.schema";

const InputSchema = z.object({
Expand Down
3 changes: 1 addition & 2 deletions apps/cms-v2/src/modules/graphql/GraphQLProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { useAppBridge } from "@saleor/app-sdk/app-bridge";
import { createGraphQLClient } from "@saleor/apps-shared";
import { PropsWithChildren } from "react";
import { Provider } from "urql";

import { createGraphQLClient } from "@saleor/apps-shared";

export function GraphQLProvider(props: PropsWithChildren<{}>) {
const { appBridgeState } = useAppBridge();
const saleorApiUrl = appBridgeState?.saleorApiUrl!;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { createSettingsManager } from "../configuration/metadata-manager";

import { z } from "zod";

import { createLogger } from "../../logger";
import { ProvidersConfig } from "../configuration";
import { AppConfigMetadataManager } from "../configuration/app-config-metadata-manager";
import { createSettingsManager } from "../configuration/metadata-manager";
import { protectedClientProcedure } from "../trpc/protected-client-procedure";
import { router } from "../trpc/trpc-server";
import { ProvidersConfig } from "../configuration";
import { createLogger } from "../../logger";

const procedure = protectedClientProcedure.use(({ ctx, next }) => {
const settingsManager = createSettingsManager(ctx.apiClient, ctx.appId!);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createLogger } from "@/logger";

import {
WebhookProductFragment,
WebhookProductVariantFragment,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createLogger } from "@/logger";
import { BuilderIoProviderConfig } from "@/modules/configuration";

import { WebhookProductVariantFragment } from "../../../../generated/graphql";
import { createLogger } from "@/logger";
import { FieldsMapper } from "../fields-mapper";

// https://www.builder.io/c/docs/write-api
Expand Down
4 changes: 2 additions & 2 deletions apps/cms-v2/src/modules/providers/builder.io/builder-io.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { TextLink } from "@saleor/apps-ui";
import { Text } from "@saleor/macaw-ui";

import logo from "./builder-logo.svg";
import { CMSProviderMeta } from "../cms-provider-meta";
import { TextLink } from "@saleor/apps-ui";
import logo from "./builder-logo.svg";

export const BuilderIo = {
formSideInfo: (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { createLogger } from "@/logger";

import { BulkImportProductFragment } from "../../../../generated/graphql";
import { BulkSyncProcessor, BulkSyncProcessorHooks } from "../../bulk-sync/bulk-sync-processor";
import { ContentfulProviderConfig } from "../../configuration";
import { ContentfulClient } from "./contentful-client";
import { contentfulRateLimiter } from "./contentful-rate-limiter";
import { createLogger } from "@/logger";

export class ContentfulBulkSyncProcessor implements BulkSyncProcessor {
private logger = createLogger("ContentfulBulkSyncProcessor");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { describe, it, expect, vi, beforeEach } from "vitest";
import { ContentfulClient, ContentfulApiClientChunk } from "./contentful-client";
import { beforeEach,describe, expect, it, vi } from "vitest";

import { ContentfulProviderConfig } from "@/modules/configuration";

import { WebhookProductVariantFragment } from "../../../../generated/graphql";
import { ContentfulApiClientChunk,ContentfulClient } from "./contentful-client";

const getMockContenfulConfiguration = (): ContentfulProviderConfig.FullShape => ({
authToken: "test-token",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { describe, expect, vi, it, beforeEach } from "vitest";
import { beforeEach,describe, expect, it, vi } from "vitest";

import { ContentfulProviderConfig } from "@/modules/configuration";

import { WebhookProductVariantFragment } from "../../../../generated/graphql";
import {
ContentfulClientStrip,
ContentfulWebhooksProcessor,
} from "./contentful-webhooks-processor";
import { ContentfulProviderConfig } from "@/modules/configuration";
import { WebhookProductVariantFragment } from "../../../../generated/graphql";

const getMockContenfulConfiguration = (): ContentfulProviderConfig.FullShape => ({
authToken: "test-token",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createLogger } from "@/logger";

import {
WebhookProductFragment,
WebhookProductVariantFragment,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { TRPCError } from "@trpc/server";
import { z } from "zod";
import { AppConfigMetadataManager } from "../../configuration/app-config-metadata-manager";

import { createLogger } from "@/logger";

import { AppConfigMetadataManager } from "../../configuration/app-config-metadata-manager";
import { createSettingsManager } from "../../configuration/metadata-manager";
import { protectedClientProcedure } from "../../trpc/protected-client-procedure";
import { router } from "../../trpc/trpc-server";

import { ContentfulClient } from "./contentful-client";
import { createLogger } from "@/logger";

const procedure = protectedClientProcedure.use(({ ctx, next }) => {
const settingsManager = createSettingsManager(ctx.apiClient, ctx.appId!);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Box, Text } from "@saleor/macaw-ui";

import logo from "./contentful-logo.svg";
import { CMSProviderMeta } from "../cms-provider-meta";
import logo from "./contentful-logo.svg";

export const Contentful = {
formSideInfo: (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { DatocmsProviderConfig } from "@/modules/configuration/schemas/datocms-provider.schema";

import { BulkImportProductFragment } from "../../../../generated/graphql";
import { BulkSyncProcessor, BulkSyncProcessorHooks } from "../../bulk-sync/bulk-sync-processor";

import { DatoCMSClient } from "./datocms-client";

export class DatocmsBulkSyncProcessor implements BulkSyncProcessor {
Expand Down
9 changes: 5 additions & 4 deletions apps/cms-v2/src/modules/providers/datocms/datocms-client.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { buildClient, Client, SimpleSchemaTypes, ApiError } from "@datocms/cma-client-browser";
import { WebhookProductVariantFragment } from "../../../../generated/graphql";
import { createLogger } from "@/logger";
import { ApiError,buildClient, Client, SimpleSchemaTypes } from "@datocms/cma-client-browser";
import * as Sentry from "@sentry/nextjs";
import { z } from "zod";

import * as Sentry from "@sentry/nextjs";
import { createLogger } from "@/logger";
import { DatocmsProviderConfig } from "@/modules/configuration/schemas/datocms-provider.schema";

import { WebhookProductVariantFragment } from "../../../../generated/graphql";
import { FieldsMapper } from "../fields-mapper";

type Context = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { createLogger } from "@/logger";
import { DatocmsProviderConfig } from "@/modules/configuration/schemas/datocms-provider.schema";

import {
WebhookProductFragment,
WebhookProductVariantFragment,
} from "../../../../generated/graphql";

import { ProductWebhooksProcessor } from "../../webhooks-operations/product-webhooks-processor";
import { DatoCMSClient } from "./datocms-client";
import { createLogger } from "@/logger";

/*
* todo error handling
Expand Down
5 changes: 2 additions & 3 deletions apps/cms-v2/src/modules/providers/datocms/datocms.router.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { TRPCError } from "@trpc/server";
import { z } from "zod";

import { createLogger } from "../../../logger";
import { protectedClientProcedure } from "../../trpc/protected-client-procedure";
import { router } from "../../trpc/trpc-server";

import { DatoCMSClient } from "./datocms-client";
import { TRPCError } from "@trpc/server";
import { createLogger } from "../../../logger";

/**
* Operations specific for Datocms service.
Expand Down
3 changes: 2 additions & 1 deletion apps/cms-v2/src/modules/providers/fields-mapper.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { describe, it, expect } from "vitest";
import { describe, expect,it } from "vitest";

import { FieldsMapper } from "./fields-mapper";

describe("FieldsMapper", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { createLogger } from "@/logger";
import { WebhookProductVariantFragment } from "../../../../generated/graphql";
import qs from "qs";

import { createLogger } from "@/logger";
import { PayloadCmsProviderConfig } from "@/modules/configuration/schemas/payloadcms-provider.schema";
import { FieldsMapper } from "../fields-mapper";

import qs from "qs";
import { WebhookProductVariantFragment } from "../../../../generated/graphql";
import { FieldsMapper } from "../fields-mapper";

type Context = {
configuration: PayloadCmsProviderConfig.FullShape;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { createLogger } from "@/logger";
import { PayloadCmsProviderConfig } from "@/modules/configuration/schemas/payloadcms-provider.schema";

import {
WebhookProductFragment,
WebhookProductVariantFragment,
} from "../../../../generated/graphql";

import { PayloadCmsProviderConfig } from "@/modules/configuration/schemas/payloadcms-provider.schema";
import { createLogger } from "@/logger";
import { ProductWebhooksProcessor } from "../../webhooks-operations/product-webhooks-processor";
import { PayloadCMSClient } from "./payloadcms-client";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { TextLink } from "@saleor/apps-ui";
import { Box, Text } from "@saleor/macaw-ui";

import { CMSProviderMeta } from "../cms-provider-meta";
import logo from "./logo.png";
import { TextLink } from "@saleor/apps-ui";

export const PayloadCMS = {
formSideInfo: (
Expand Down
Loading

0 comments on commit 9fc9edf

Please sign in to comment.