spacehub

surshar / claude-code

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

Built by Anthropic · github.com/anthropics

claude-code / scripts / no-box-in-text.grit
22 lines · 800 BRaw
1// Biome GritQL Plugin: Prevent <Box> from being nested inside <Text>
2// This catches the Ink error: "<Box> can't be nested inside <Text> component"
3
4language js;
5
6// Match Text elements that contain Box children (direct nesting)
7`<Text$_>$children</Text>` where {
8 $children <: contains `<Box$_>$_</Box>`,
9 register_diagnostic(
10 span = $children,
11 message = "<Box> can't be nested inside <Text> component. Use <Box> as a sibling or wrap <Text> inside <Box> instead."
12 )
13}
14
15// Also match self-closing Box inside Text
16`<Text$_>$children</Text>` where {
17 $children <: contains `<Box$_ />`,
18 register_diagnostic(
19 span = $children,
20 message = "<Box> can't be nested inside <Text> component. Use <Box> as a sibling or wrap <Text> inside <Box> instead."
21 )
22}