diff --git a/.changeset/chilly-geckos-help.md b/.changeset/chilly-geckos-help.md new file mode 100644 index 000000000..0034fd2c1 --- /dev/null +++ b/.changeset/chilly-geckos-help.md @@ -0,0 +1,5 @@ +--- +"eslint-config-saleor": patch +--- + +Add restricted import rule for importing Sentry package. diff --git a/apps/segment/src/pages/api/manifest.ts b/apps/segment/src/pages/api/manifest.ts index 23e64f717..3518e4f92 100644 --- a/apps/segment/src/pages/api/manifest.ts +++ b/apps/segment/src/pages/api/manifest.ts @@ -1,6 +1,7 @@ import { createManifestHandler } from "@saleor/app-sdk/handlers/next"; import { AppManifest } from "@saleor/app-sdk/types"; import { wrapWithLoggerContext } from "@saleor/apps-logger/node"; +import { captureException } from "@sentry/nextjs"; import { env } from "@/env"; import { loggerContext } from "@/logger-context"; @@ -14,6 +15,10 @@ export default wrapWithLoggerContext( const iframeBaseUrl = env.APP_IFRAME_BASE_URL ?? appBaseUrl; const apiBaseURL = env.APP_API_BASE_URL ?? appBaseUrl; + const error = new Error("Test error - checking if importing sentry works"); + + captureException(error); + const manifest: AppManifest = { about: "Seamlessly feed Twillo Segment with Saleor events", appUrl: iframeBaseUrl, diff --git a/packages/eslint-config-saleor/index.js b/packages/eslint-config-saleor/index.js index 8e81f23ec..3073842eb 100644 --- a/packages/eslint-config-saleor/index.js +++ b/packages/eslint-config-saleor/index.js @@ -35,6 +35,13 @@ module.exports = { "error", { name: "@saleor/apps-logger", message: "Use your app logger directly" }, ], + "no-restricted-syntax": [ + "error", + { + selector: "ImportDeclaration[source.value='@sentry/nextjs'] > ImportDefaultSpecifier", + message: "Use `import * as Sentry from '@sentry/nextjs';`", + }, + ], }, parserOptions: { babelOptions: {