* refactor: remove TRPCError handling from getServerErrorFromUnknown This removes the @trpc/server dependency from packages/lib by removing TRPCError handling from getServerErrorFromUnknown.ts. packages/lib is meant to be a general utility library that other packages depend on, so it shouldn't import tRPC. The callers that need to handle TRPCError (like onErrorHandler.ts and defaultResponder.ts) already handle it explicitly before calling getServerErrorFromUnknown, so this change has no behavioral impact. Changes: - Remove TRPCError and getHTTPStatusCodeFromError imports - Remove TRPCError instanceof check from getServerErrorFromUnknown - Update docstring to note that TRPCError is not handled - Remove TRPCError-related tests (they belong in the tRPC layer) - Fix lint warnings in Prisma error tests (replace 'as any' with proper type) Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * wip --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
import { forbid } from "@calcom/eslint-config/base";
|
|
import { config } from "@calcom/eslint-config/base";
|
|
|
|
export default [
|
|
...config,
|
|
forbid({
|
|
from: "../app-store/**",
|
|
target: ".",
|
|
message: "lib package should not import from app-store to avoid circular dependencies.",
|
|
}),
|
|
forbid({
|
|
from: "../features/**",
|
|
target: ".",
|
|
message: "lib package should not import from features to avoid circular dependencies.",
|
|
}),
|
|
forbid({
|
|
from: "../trpc/**",
|
|
target: ".",
|
|
message: "lib package should not import from trpc to avoid circular dependencies.",
|
|
}),
|
|
{
|
|
// Block @trpc/server imports to keep packages/lib framework-agnostic.
|
|
// defaultResponder.ts is temporarily excluded until it can be refactored.
|
|
ignores: ["server/defaultResponder.ts", "server/defaultResponder.test.ts"],
|
|
rules: {
|
|
"no-restricted-imports": [
|
|
"error",
|
|
{
|
|
paths: [
|
|
{
|
|
name: "@trpc/server",
|
|
message: "packages/lib should not import from @trpc/server to keep it framework-agnostic.",
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
},
|
|
];
|