🤯 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
🎨 style(stylex): pass sx and stylex.props styles as plain arguments (#23015)
Innei3c9241489d22
diff --git a/apps/share/src/shell/ShareLayout.tsx b/apps/share/src/shell/ShareLayout.tsxindex 88aa6673097..8ab840e2990 100644--- a/apps/share/src/shell/ShareLayout.tsx+++ b/apps/share/src/shell/ShareLayout.tsx@@ -173,7 +173,7 @@ const ShareLayout = ({return (<Flexbox horizontal height={'100%'} style={{ overflow: 'hidden' }} width={'100%'}>- <div {...sx(styles.lane, undefined, laneStyle)}>+ <div {...sx(styles.lane, laneStyle)}><header {...stylex.props(styles.header)}><div {...stylex.props(styles.lead)}><ShareLogoLink>diff --git a/oxlint.config.mts b/oxlint.config.mtsindex 541061a18bb..77e96f1a22a 100644--- a/oxlint.config.mts+++ b/oxlint.config.mts@@ -322,6 +322,21 @@ const uppercaseRestrictedSyntax = [},];+const stylexCallMessage =+ 'Pass styles to sx() / stylex.props() as separate arguments: no array wrapper, no undefined placeholder.';+const stylexCallRestrictedSyntax = [+ {+ message: stylexCallMessage,+ selector:+ "CallExpression:matches([callee.name='sx'], [callee.object.name='stylex'][callee.property.name='props']) > ArrayExpression.arguments",+ },+ {+ message: stylexCallMessage,+ selector:+ "CallExpression:matches([callee.name='sx'], [callee.object.name='stylex'][callee.property.name='props']) > Identifier.arguments[name='undefined']",+ },+];+const electronIpcRemoveListenerRestrictedSyntax = {message:'Do not use removeListener in renderer code. Electron contextBridge does not preserve listener identity across calls; use the disposer returned by ipcRenderer.on().',@@ -707,7 +722,11 @@ export default defineConfig(},restrictSyntax(['**/*.{ts,tsx}'],- [...useRefLazyInitRestrictedSyntax, ...uppercaseRestrictedSyntax],+ [+ ...useRefLazyInitRestrictedSyntax,+ ...uppercaseRestrictedSyntax,+ ...stylexCallRestrictedSyntax,+ ],),restrictImports(['apps/server/src/**/*.{ts,tsx}'],@@ -779,6 +798,7 @@ export default defineConfig([...useRefLazyInitRestrictedSyntax,...uppercaseRestrictedSyntax,+ ...stylexCallRestrictedSyntax,electronIpcRemoveListenerRestrictedSyntax,],['src/hooks/usePWAInstall.ts'],diff --git a/src/components/Skeleton/Settings/Sections.tsx b/src/components/Skeleton/Settings/Sections.tsxindex 7077b05ea83..118816debbb 100644--- a/src/components/Skeleton/Settings/Sections.tsx+++ b/src/components/Skeleton/Settings/Sections.tsx@@ -368,7 +368,7 @@ const InsetTiles = ({tiles: number;}) => (<div- {...sx([styles.grid], undefined, {+ {...sx(styles.grid, {gap: 8,gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`,})}@@ -489,7 +489,7 @@ const Detail = ({</Flexbox><div {...stylex.props(styles.divider)} /><div- {...sx([styles.grid], undefined, {+ {...sx(styles.grid, {columnGap: 24,gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`,})}@@ -531,9 +531,7 @@ const Quota = ({ blocks }: { blocks: QuotaBlockShape[] }) => ({blocks.map(({ caption, cellHeight, labels }, index) => (<div key={index} {...stylex.props(styles.quotaBlock)}><QuotaCaption caption={caption} />- <div- {...sx([styles.grid], undefined, { gridTemplateColumns: 'repeat(2, minmax(0, 1fr))' })}- >+ <div {...sx(styles.grid, { gridTemplateColumns: 'repeat(2, minmax(0, 1fr))' })}>{[0, 1].map((cell) => (<Flexbox gap={10} height={cellHeight} justify={'center'} key={cell} paddingInline={16}><QuotaCellLabel index={cell} label={labels?.[cell]} />diff --git a/src/features/Acceptance/Viewer/Comments/CommentWorkspace.tsx b/src/features/Acceptance/Viewer/Comments/CommentWorkspace.tsxindex b860a1d736d..060e6cbca0f 100644--- a/src/features/Acceptance/Viewer/Comments/CommentWorkspace.tsx+++ b/src/features/Acceptance/Viewer/Comments/CommentWorkspace.tsx@@ -245,7 +245,7 @@ export const DraftNote = ({}: DraftNoteProps) => {const { t } = useTranslation('verify');return (- <div {...stylex.props([styles.note, active && styles.noteActive])}>+ <div {...stylex.props(styles.note, active && styles.noteActive)}><Flexbox horizontal align={'center'} gap={8}><span {...stylex.props(styles.badge)}>{index}</span><Flexbox horizontal align={'center'} flex={1} gap={8} style={{ minWidth: 0 }}>@@ -306,7 +306,7 @@ export const DraftFooter = ({<><divaria-live={'polite'}- {...stylex.props([styles.status, error && styles.statusError])}+ {...stylex.props(styles.status, error && styles.statusError)}role={error ? 'alert' : undefined}>{status}diff --git a/src/features/Acceptance/Viewer/Evidence/Video/VideoEvidenceDiscussion.tsx b/src/features/Acceptance/Viewer/Evidence/Video/VideoEvidenceDiscussion.tsxindex a98a0dc2e35..482d0242161 100644--- a/src/features/Acceptance/Viewer/Evidence/Video/VideoEvidenceDiscussion.tsx+++ b/src/features/Acceptance/Viewer/Evidence/Video/VideoEvidenceDiscussion.tsx@@ -209,7 +209,7 @@ export const VideoEvidenceDiscussion = ({const messages = item.commentIds?.length ?? 1;return (<div- {...stylex.props([styles.item, isOpen && styles.itemOpen])}+ {...stylex.props(styles.item, isOpen && styles.itemOpen)}id={`video-thread-${item.threadId}`}key={item.threadId}>@@ -225,7 +225,7 @@ export const VideoEvidenceDiscussion = ({<span {...stylex.props(styles.stamp)}>{formatVideoTime(item.time.start)}</span>{/* Open, the thread below names the author and says it in full. */}<span {...stylex.props(styles.author)}>{isOpen ? '' : item.authorName}</span>- <span {...stylex.props([styles.excerpt, item.resolved && styles.resolved])}>+ <span {...stylex.props(styles.excerpt, item.resolved && styles.resolved)}>{isOpen ? '' : item.comment}</span>{messages > 1 && (@@ -243,7 +243,7 @@ export const VideoEvidenceDiscussion = ({</span>)}<Icon- {...stylex.props([styles.chevron, isOpen && styles.chevronOpen])}+ {...stylex.props(styles.chevron, isOpen && styles.chevronOpen)}icon={ChevronRight}size={14}/>diff --git a/src/features/Projects/Onboarding/ProjectOnboardingCard.tsx b/src/features/Projects/Onboarding/ProjectOnboardingCard.tsxindex 19a6ee81d24..e18b44f85c5 100644--- a/src/features/Projects/Onboarding/ProjectOnboardingCard.tsx+++ b/src/features/Projects/Onboarding/ProjectOnboardingCard.tsx@@ -145,7 +145,7 @@ const OnboardingChecklistCard = ({ detail, onComposerRequest }: ProjectOnboardin</Flexbox><div {...stylex.props(styles.bar)}><div- {...sx(styles.fill, undefined, {+ {...sx(styles.fill, {width: `${(checklist.completed / checklist.total) * 100}%`,})}/>diff --git a/src/features/TaskLabels/Settings/TaskLabelFormModal.tsx b/src/features/TaskLabels/Settings/TaskLabelFormModal.tsxindex e731a1381bd..83dab144005 100644--- a/src/features/TaskLabels/Settings/TaskLabelFormModal.tsx+++ b/src/features/TaskLabels/Settings/TaskLabelFormModal.tsx@@ -150,7 +150,7 @@ const TaskLabelFormContent = memo<TaskLabelFormModalOptions>(({ isGroup, label,aria-label={preset}key={preset}role={'button'}- {...sx([styles.swatch, color === preset && styles.swatchActive], undefined, {+ {...sx(styles.swatch, color === preset && styles.swatchActive, {backgroundColor: preset,})}onClick={() => setColor(preset)}diff --git a/src/features/TaskLabels/Settings/index.tsx b/src/features/TaskLabels/Settings/index.tsxindex ec90db861b4..a086b1947ea 100644--- a/src/features/TaskLabels/Settings/index.tsx+++ b/src/features/TaskLabels/Settings/index.tsx@@ -104,7 +104,7 @@ const TaskLabelRow = memo<RowProps>(({ canManage, depth, label, manageBlockedReahorizontalalign={'center'}gap={12}- {...sx([styles.row], undefined, { paddingInlineStart: 12 + depth * 24 })}+ {...sx(styles.row, { paddingInlineStart: 12 + depth * 24 })}><Flexbox horizontal align={'center'} flex={1} gap={12} style={{ minWidth: 0 }}><TaskLabelDot color={label.color} size={10} />diff --git a/src/features/TaskLabels/TaskLabelDot.tsx b/src/features/TaskLabels/TaskLabelDot.tsxindex ce2e5c64d73..9f88c023a28 100644--- a/src/features/TaskLabels/TaskLabelDot.tsx+++ b/src/features/TaskLabels/TaskLabelDot.tsx@@ -23,7 +23,7 @@ interface TaskLabelDotProps {const TaskLabelDot = memo<TaskLabelDotProps>(({ color, size }) => (<spanaria-hidden- {...sx([styles.dot], undefined, {+ {...sx(styles.dot, {...(color ? { backgroundColor: color } : undefined),...(size ? { height: size, width: size } : undefined),})}diff --git a/src/styles/sx.test.ts b/src/styles/sx.test.tsindex 3db2100b678..1de20710d4c 100644--- a/src/styles/sx.test.ts+++ b/src/styles/sx.test.ts@@ -20,7 +20,8 @@ describe('sx', () => {it('drops falsy styles and class names', () => {const active = false;- const props = sx(styles.root, active && styles.active, undefined, '');+ const callerClassName: string | undefined = undefined;+ const props = sx(styles.root, active && styles.active, callerClassName, '');expect(props.className).toContain('styles.root');expect(props.className).not.toContain('styles.active');