Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

refactor: lint and types fixes (#650)

Brad Barbinfabfa2bb1e0d
diff --git a/apps/biome.jsonc b/apps/biome.jsonc
index 1ae40f085a..c4fb4cd8ac 100644
--- a/apps/biome.jsonc
+++ b/apps/biome.jsonc
@@ -2,5 +2,12 @@
"root": false,
"$schema": "https://biomejs.dev/schemas/2.3.8/schema.json",
"extends": "//",
- "files": { "includes": ["./**/app/**/*.ts*", "./**/app/**/*.tsx*"] }
+ "files": {
+ "includes": [
+ "./**/app/**/*.ts*",
+ "./**/app/**/*.tsx*",
+ "!**/mcp*/lib/tools/**",
+ "!**/mcp*/lib/server.ts"
+ ]
+ }
}
diff --git a/apps/erp/app/modules/items/ui/Consumables/ConsumableProperties.tsx b/apps/erp/app/modules/items/ui/Consumables/ConsumableProperties.tsx
index 2b404f1a5a..c05fbdb1e1 100644
--- a/apps/erp/app/modules/items/ui/Consumables/ConsumableProperties.tsx
+++ b/apps/erp/app/modules/items/ui/Consumables/ConsumableProperties.tsx
@@ -17,7 +17,6 @@ import { z } from "zod";
import { zfd } from "zod-form-data";
import { MethodBadge, MethodIcon, TrackingTypeIcon } from "~/components";
import { Enumerable } from "~/components/Enumerable";
-// biome-ignore lint/suspicious/noShadowRestrictedNames: Boolean is a component name
import { Boolean, ItemPostingGroup, Tags } from "~/components/Form";
import CustomFormInlineFields from "~/components/Form/CustomFormInlineFields";
import { ItemThumbnailUpload } from "~/components/ItemThumnailUpload";
diff --git a/apps/erp/app/modules/items/ui/Item/BillOfMaterial.tsx b/apps/erp/app/modules/items/ui/Item/BillOfMaterial.tsx
index c1e7339231..70f9388ed6 100644
--- a/apps/erp/app/modules/items/ui/Item/BillOfMaterial.tsx
+++ b/apps/erp/app/modules/items/ui/Item/BillOfMaterial.tsx
@@ -205,7 +205,8 @@ const BillOfMaterial = ({
description: "",
item: {
name: "",
- itemTrackingType: "Inventory"
+ itemTrackingType: "Inventory",
+ replenishmentSystem: "Buy and Make"
}
});
} else {
diff --git a/apps/erp/app/modules/items/ui/Item/ItemCostingForm.tsx b/apps/erp/app/modules/items/ui/Item/ItemCostingForm.tsx
index fabf0677d3..815522da60 100644
--- a/apps/erp/app/modules/items/ui/Item/ItemCostingForm.tsx
+++ b/apps/erp/app/modules/items/ui/Item/ItemCostingForm.tsx
@@ -54,7 +54,7 @@ const ItemCostingForm = ({ initialValues }: ItemCostingFormProps) => {
<ItemPostingGroup
name="itemPostingGroupId"
label="Item Group"
- helperText="Group used together with the supplier type, customer type, and location to determine the account"
+ helperText="Used to categorize items for reporting and analysis"
isClearable
/>
{/* <Select
diff --git a/apps/erp/app/modules/items/ui/Materials/MaterialProperties.tsx b/apps/erp/app/modules/items/ui/Materials/MaterialProperties.tsx
index 88094ebcee..9ed13525af 100644
--- a/apps/erp/app/modules/items/ui/Materials/MaterialProperties.tsx
+++ b/apps/erp/app/modules/items/ui/Materials/MaterialProperties.tsx
@@ -26,7 +26,6 @@ import { z } from "zod";
import { zfd } from "zod-form-data";
import { MethodBadge, MethodIcon, TrackingTypeIcon } from "~/components";
import {
- // biome-ignore lint/suspicious/noShadowRestrictedNames: Boolean is a component name
Boolean,
ItemPostingGroup,
Tags,
diff --git a/apps/erp/app/modules/items/ui/Parts/PartProperties.tsx b/apps/erp/app/modules/items/ui/Parts/PartProperties.tsx
index c698d75b98..b13c9ad6ed 100644
--- a/apps/erp/app/modules/items/ui/Parts/PartProperties.tsx
+++ b/apps/erp/app/modules/items/ui/Parts/PartProperties.tsx
@@ -24,7 +24,6 @@ import { z } from "zod";
import { zfd } from "zod-form-data";
import { MethodBadge, MethodIcon, TrackingTypeIcon } from "~/components";
import {
- // biome-ignore lint/suspicious/noShadowRestrictedNames: Boolean is a component name
Boolean,
ItemPostingGroup,
Tags,
diff --git a/apps/erp/app/modules/items/ui/Tools/ToolProperties.tsx b/apps/erp/app/modules/items/ui/Tools/ToolProperties.tsx
index ce95106810..66ebb61a8a 100644
--- a/apps/erp/app/modules/items/ui/Tools/ToolProperties.tsx
+++ b/apps/erp/app/modules/items/ui/Tools/ToolProperties.tsx
@@ -17,7 +17,6 @@ import { Await, useFetcher, useParams } from "react-router";
import { z } from "zod";
import { zfd } from "zod-form-data";
import { MethodBadge, MethodIcon, TrackingTypeIcon } from "~/components";
-// biome-ignore lint/suspicious/noShadowRestrictedNames: Boolean is a component name
import { Boolean, ItemPostingGroup, Tags } from "~/components/Form";
import CustomFormInlineFields from "~/components/Form/CustomFormInlineFields";
import { ReplenishmentSystemIcon } from "~/components/Icons";
diff --git a/apps/erp/app/modules/resources/ui/MaintenanceSchedule/MaintenanceScheduleForm.tsx b/apps/erp/app/modules/resources/ui/MaintenanceSchedule/MaintenanceScheduleForm.tsx
index fecd6c4d6c..69378f0dd5 100644
--- a/apps/erp/app/modules/resources/ui/MaintenanceSchedule/MaintenanceScheduleForm.tsx
+++ b/apps/erp/app/modules/resources/ui/MaintenanceSchedule/MaintenanceScheduleForm.tsx
@@ -1,7 +1,5 @@
import {
- // biome-ignore lint/suspicious/noShadowRestrictedNames: Boolean is a component name
Boolean,
- // biome-ignore lint/suspicious/noShadowRestrictedNames: Number is a component name
Number,
Select,
useControlField,
diff --git a/apps/erp/app/modules/sales/ui/Customer/CustomerHeader.tsx b/apps/erp/app/modules/sales/ui/Customer/CustomerHeader.tsx
index a9dd580fe9..9055094b20 100644
--- a/apps/erp/app/modules/sales/ui/Customer/CustomerHeader.tsx
+++ b/apps/erp/app/modules/sales/ui/Customer/CustomerHeader.tsx
@@ -66,7 +66,6 @@ const CustomerHeader = () => {
(status) => status.id === routeData?.customer?.customerStatusId
)?.name;
- // biome-ignore lint/correctness/useExhaustiveDependencies: deps are intentionally limited
const onUpdateTags = useCallback(
(value: string[]) => {
const formData = new FormData();
diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfMaterial.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfMaterial.tsx
index 89a442f792..b9d0c92801 100644
--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfMaterial.tsx
+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfMaterial.tsx
@@ -287,7 +287,8 @@ const QuoteBillOfMaterial = ({
description: "",
item: {
name: "",
- itemTrackingType: "Inventory"
+ itemTrackingType: "Inventory",
+ replenishmentSystem: null
}
});
} else {
diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteLinePricing.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteLinePricing.tsx
index 12863c80c6..7cfbfd2e2b 100644
--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteLinePricing.tsx
+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteLinePricing.tsx
@@ -412,7 +412,6 @@ const QuoteLinePricing = ({
[carbon, line.itemId]
);
- // biome-ignore lint/correctness/useExhaustiveDependencies: deps are intentionally limited
const onUpdateCategoryMarkup = useCallback(
async (category: CostCategoryKey, quantity: number, value: number) => {
const existingMarkups = categoryMarkupsByQuantity[quantity] ?? {};
diff --git a/apps/erp/app/modules/settings/ui/ApiKeys/ApiKeysForm.tsx b/apps/erp/app/modules/settings/ui/ApiKeys/ApiKeysForm.tsx
index 5eead3d58b..ccece7ad35 100644
--- a/apps/erp/app/modules/settings/ui/ApiKeys/ApiKeysForm.tsx
+++ b/apps/erp/app/modules/settings/ui/ApiKeys/ApiKeysForm.tsx
@@ -55,7 +55,6 @@ const ApiKeyForm = ({
const [key, setKey] = useState<string | null>(null);
- // biome-ignore lint/correctness/useExhaustiveDependencies: deps are intentionally limited
const initialScopeState = useMemo(
() =>
isEditing
diff --git a/apps/erp/app/modules/users/ui/EmployeeTypes/EmployeeTypeForm.tsx b/apps/erp/app/modules/users/ui/EmployeeTypes/EmployeeTypeForm.tsx
index 55e2097e35..61cf0be937 100644
--- a/apps/erp/app/modules/users/ui/EmployeeTypes/EmployeeTypeForm.tsx
+++ b/apps/erp/app/modules/users/ui/EmployeeTypes/EmployeeTypeForm.tsx
@@ -42,7 +42,6 @@ const EmployeeTypeForm = ({ initialValues }: EmployeeTypeFormProps) => {
const navigate = useNavigate();
const onClose = () => navigate(-1);
- // biome-ignore lint/correctness/useExhaustiveDependencies: deps are intentionally limited
const { state: initialState, modules } = useMemo(
() => fromEmployeeTypePermissions(initialValues.permissions),
// eslint-disable-next-line react-hooks/exhaustive-deps
diff --git a/apps/erp/app/modules/users/ui/Employees/BulkEditPermissionsForm.tsx b/apps/erp/app/modules/users/ui/Employees/BulkEditPermissionsForm.tsx
index 0049633101..51a6ba6433 100644
--- a/apps/erp/app/modules/users/ui/Employees/BulkEditPermissionsForm.tsx
+++ b/apps/erp/app/modules/users/ui/Employees/BulkEditPermissionsForm.tsx
@@ -64,7 +64,6 @@ const BulkEditPermissions = ({
});
// When new empty permissions arrive, reset the matrix state
- // biome-ignore lint/correctness/useExhaustiveDependencies: deps are intentionally limited
useEffect(() => {
if (emptyPermissionsFetcher.data) {
const { state } = fromEmployeeTypePermissions(
diff --git a/apps/erp/app/modules/users/ui/Employees/EmployeePermissionsForm.tsx b/apps/erp/app/modules/users/ui/Employees/EmployeePermissionsForm.tsx
index fa4662f923..3e6425f6fc 100644
--- a/apps/erp/app/modules/users/ui/Employees/EmployeePermissionsForm.tsx
+++ b/apps/erp/app/modules/users/ui/Employees/EmployeePermissionsForm.tsx
@@ -47,7 +47,6 @@ const EmployeePermissionsForm = ({
label: et.name
})) ?? [];
- // biome-ignore lint/correctness/useExhaustiveDependencies: deps are intentionally limited
const { state: initialState, modules } = useMemo(
() => fromCompanyPermissions(initialValues.permissions),
// eslint-disable-next-line react-hooks/exhaustive-deps
diff --git a/apps/erp/app/routes/api+/integrations.onshape.sync.ts b/apps/erp/app/routes/api+/integrations.onshape.sync.ts
index cbb9f0b77d..0217373a62 100644
--- a/apps/erp/app/routes/api+/integrations.onshape.sync.ts
+++ b/apps/erp/app/routes/api+/integrations.onshape.sync.ts
@@ -72,14 +72,13 @@ export async function action({ request }: ActionFunctionArgs) {
.eq("integration", "onshape");
await client.from("externalIntegrationMapping").insert({
- // @ts-expect-error TS2769 - TODO: fix type
entityType: "item",
entityId: itemId,
integration: "onshape",
metadata: {
- documentId,
- versionId,
- elementId
+ documentId: documentId as string,
+ versionId: versionId as string,
+ elementId: elementId as string
},
lastSyncedAt: new Date().toISOString(),
companyId
diff --git a/apps/erp/app/routes/api+/mcp+/lib/server.ts b/apps/erp/app/routes/api+/mcp+/lib/server.ts
index 4e6667e96f..435fc5439e 100644
--- a/apps/erp/app/routes/api+/mcp+/lib/server.ts
+++ b/apps/erp/app/routes/api+/mcp+/lib/server.ts
@@ -1,9 +1,10 @@
// @ts-nocheck
// AUTO-GENERATED by scripts/generate-mcp.ts — do not edit manually
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
+import type { McpContext } from "./types";
import {
- registerAccountingTools,
registerAccountTools,
+ registerAccountingTools,
registerDocumentsTools,
registerInventoryTools,
registerInvoicingTools,
@@ -16,9 +17,8 @@ import {
registerSalesTools,
registerSettingsTools,
registerSharedTools,
- registerUsersTools
+ registerUsersTools,
} from "./tools";
-import type { McpContext } from "./types";
function getServerInstructions(): string {
const today = new Date().toISOString().split("T")[0];
@@ -60,11 +60,11 @@ export function createMcpServer(ctx: McpContext): McpServer {
const server = new McpServer(
{
name: "carbon-erp",
- version: process.env.VERCEL_GIT_COMMIT_SHA?.slice(0, 7) ?? "1.0.0"
+ version: process.env.VERCEL_GIT_COMMIT_SHA?.slice(0, 7) ?? "1.0.0",
},
{
- instructions: getServerInstructions()
- }
+ instructions: getServerInstructions(),
+ },
);
registerAccountTools(server, ctx);
diff --git a/apps/erp/app/routes/file+/shipment+/$id[.]pdf.tsx b/apps/erp/app/routes/file+/shipment+/$id[.]pdf.tsx
index b81c06b94a..b1619cbcc0 100644
--- a/apps/erp/app/routes/file+/shipment+/$id[.]pdf.tsx
+++ b/apps/erp/app/routes/file+/shipment+/$id[.]pdf.tsx
@@ -422,8 +422,10 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
"Content-Type": "application/pdf",
"Content-Disposition": `inline; filename="${company.data.name} - ${shipment.data.shipmentId}.pdf"`
});
- // @ts-expect-error TS2345 - TODO: fix type
- return new Response(poBody, { status: 200, headers: poHeaders });
+ return new Response(new Uint8Array(poBody), {
+ status: 200,
+ headers: poHeaders
+ });
}
default:
throw new Error("Invalid source document");
diff --git a/apps/erp/app/routes/x+/maintenance+/$dispatchId.events.tsx b/apps/erp/app/routes/x+/maintenance+/$dispatchId.events.tsx
index 457e834b7c..41b016cd7f 100644
--- a/apps/erp/app/routes/x+/maintenance+/$dispatchId.events.tsx
+++ b/apps/erp/app/routes/x+/maintenance+/$dispatchId.events.tsx
@@ -68,10 +68,9 @@ export async function action({ request, params }: ActionFunctionArgs) {
const insertEvent = await client
.from("maintenanceDispatchEvent")
.insert({
- // @ts-expect-error TS2769 - TODO: fix type
maintenanceDispatchId: dispatchId!,
employeeId: userId,
- workCenterId,
+ workCenterId: workCenterId!,
startTime: new Date().toISOString(),
companyId,
createdBy: userId
diff --git a/apps/erp/app/routes/x+/settings+/resources.tsx b/apps/erp/app/routes/x+/settings+/resources.tsx
index 36a951cce2..27681458d6 100644
--- a/apps/erp/app/routes/x+/settings+/resources.tsx
+++ b/apps/erp/app/routes/x+/settings+/resources.tsx
@@ -2,9 +2,7 @@ import { error } from "@carbon/auth";
import { requirePermissions } from "@carbon/auth/auth.server";
import { flash } from "@carbon/auth/session.server";
import {
- // biome-ignore lint/suspicious/noShadowRestrictedNames: Boolean is a component name
Boolean,
- // biome-ignore lint/suspicious/noShadowRestrictedNames: Number is a component name
Number,
Submit,
ValidatedForm,
diff --git a/apps/erp/app/routes/x+/settings+/sales.tsx b/apps/erp/app/routes/x+/settings+/sales.tsx
index 2c1a365d1c..a50678946d 100644
--- a/apps/erp/app/routes/x+/settings+/sales.tsx
+++ b/apps/erp/app/routes/x+/settings+/sales.tsx
@@ -2,10 +2,8 @@ import { error, useCarbon } from "@carbon/auth";
import { requirePermissions } from "@carbon/auth/auth.server";
import { flash } from "@carbon/auth/session.server";
import {
- // biome-ignore lint/suspicious/noShadowRestrictedNames: Boolean is a component name
Boolean,
Input,
- // biome-ignore lint/suspicious/noShadowRestrictedNames: Number is a component name
Number,
Submit,
ValidatedForm,
diff --git a/biome.jsonc b/biome.jsonc
index 9e61443841..d066d8859c 100644
--- a/biome.jsonc
+++ b/biome.jsonc
@@ -9,8 +9,8 @@
"!sst.env.d.ts",
"!packages/database/src/types.ts",
"!packages/database/src/swagger-docs-schema.ts",
- "!apps/erp/app/routes/api+/mcp+/lib/tools/**",
- "!apps/erp/app/routes/api+/mcp+/lib/server.ts",
+ "!**/mcp*/lib/tools/**",
+ "!**/mcp*/lib/server.ts",
"**/*.json",
"examples/**/*"
]
diff --git a/package.json b/package.json
index d673c6ff62..defc91516a 100755
--- a/package.json
+++ b/package.json
@@ -59,7 +59,7 @@
"dev:starter": "turbo run dev --filter=./apps/starter --filter=./packages/",
"dev:stripe": "npm run -w @carbon/stripe dev:stripe",
"format": "biome format --write",
- "generate:mcp": "tsx scripts/generate-mcp-docs.ts",
+ "generate:mcp": "tsx scripts/generate-mcp.ts",
"generate:swagger": "tsx scripts/generate-swagger-docs.ts && npx prettier --write ./packages/database/src/swagger-docs-schema.ts ",
"generate:types": "tsx scripts/generate-db-types.ts",
"lint": "turbo run lint",