π€― LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
π§ chore(alint): exempt whole payload-type props from no-unguarded-response-field (#22036)
AmAzing-9a85ab5bf465
diff --git a/packages/alint/fixtures/no-unguarded-response-field/good-whole-payload-type-props.tsx b/packages/alint/fixtures/no-unguarded-response-field/good-whole-payload-type-props.tsxnew file mode 100644index 00000000000..ea7eb45515a--- /dev/null+++ b/packages/alint/fixtures/no-unguarded-response-field/good-whole-payload-type-props.tsx@@ -0,0 +1,33 @@+// Fixture: props typed with whole payload types from @lobechat/types, not slices of a response.+import type { ChannelDetail, ChannelPublicMessage } from '@lobechat/types';+import { memo } from 'react';++import { MessageAttachments } from './MessageAttachments';++interface ChannelMessageProps {+ detail: ChannelDetail;+ message: ChannelPublicMessage;+ onStartThread?: (attachmentIds: string[]) => void;+}++const ChannelMessage = memo<ChannelMessageProps>(({ detail, message, onStartThread }) => {+ const failed = detail.jobs.some((job) => job.messageId === message.id && job.status === 'failed');+ const startThread = () =>+ onStartThread?.(+ detail.attachments.filter((file) => message.fileIds.includes(file.id)).map((file) => file.id),+ );++ return (+ <article data-failed={failed || undefined}>+ {message.fileIds.length > 0 && (+ <MessageAttachments attachments={detail.attachments} fileIds={message.fileIds} />+ )}+ <p>{message.content}</p>+ <button type="button" onClick={startThread}>+ Start thread+ </button>+ </article>+ );+});++export default ChannelMessage;diff --git a/packages/alint/rules/no-unguarded-response-field/rule.alint.toml b/packages/alint/rules/no-unguarded-response-field/rule.alint.tomlindex 52b8bf2bfa9..5fc6e814b6d 100644--- a/packages/alint/rules/no-unguarded-response-field/rule.alint.toml+++ b/packages/alint/rules/no-unguarded-response-field/rule.alint.toml@@ -24,6 +24,7 @@ Do not report β these are the places the rule does not apply:- scalar fields that are rendered, compared or formatted (`{data.title}`, `data.count > 0`, `` `#${pr.number}` ``, `formatDate(data.createdAt)`): an undefined scalar renders nothing or compares false; it does not crash;- values that come from a zustand store or its selectors, React state, context, URL params, `localStorage`, constants, or something the file built itself β even if they were originally fetched; the store owns normalization;- props or parameters typed with a plain interface or an element type (`items: Item[]`, `pullRequests: PullRequestLink[]`) rather than a slice of a response type. The file cannot see where those come from;+- props or parameters typed with a whole named payload type (`detail: ChannelDetail`, `message: ChannelPublicMessage`), even when it is imported from `@lobechat/types` or an endpoint returns it. Every shared payload shape lives in `@lobechat/types`, so the type's name or package does not show that this value came from the server rather than from a store that already holds it. Only the indexed-access, `ReturnType` and `RouterOutput` forms above mark a prop as a response;- an array the client derived from a response (`data.items.map(...)` is one finding at `.map`; the `.filter` chained after it is not another);- local bridges rather than the server: anything imported from `@/services/electron/*` whatever the service is named (`imessageBridgeService`, `electronDevtoolsService`), `window.electron`, `ipcRenderer`, the device gateway, the local file system;- fields the server type itself marks optional (`field?:`) when the file already handles them β TypeScript forces that path;