← Back to AI Insights
Gemini Executive Synthesis

shadcn-ui/lint's `parseDeclarations` function, specifically its CSS comment stripping regex and its impact on theme parsing and the `no-arbitrary-values` rule.

Technical Positioning
The linter's core function of verifying design system rules and preventing arbitrary values is undermined by a regex flaw that incorrectly parses `@source` globs, leading to theme discard and erroneous suggestions.
SaaS Insight & Market Implications
A critical regex flaw in `shadcn-ui/lint`'s `parseDeclarations` function incorrectly interprets `/*` within `@source` globs as comment delimiters. This leads to the silent discarding of entire theme blocks, including `@theme inline` and `:root` declarations. Consequently, the `no-arbitrary-values` rule falls back to default Tailwind scales, generating erroneous 'same value' suggestions that, if applied, alter rendered output. This bug directly impacts projects using common patterns like `streamdown`, forcing developers to choose between disabling a critical rule or risking unintended UI changes. This fundamental parsing error severely compromises the linter's reliability and its ability to enforce design system consistency, creating significant developer friction.
Proprietary Technical Taxonomy
CSS comment stripper parseDeclarations regex @source glob streamdown's README @theme inline :root { --radius: … } no-arbitrary-values

Raw Developer Origin & Technical Request

Source Icon GitHub Issue Sep 14, 2026
Repo: shadcn-ui/lint
CSS comment stripper eats the theme when an @source glob contains "/*" (e.g. streamdown's dist/*.js), producing wrong "same value" suggestions

## Summary

`parseDeclarations` strips CSS comments with `css.replace(/\/\*[\s\S]*?\*\//g, "")` before scanning for `--*` declarations. That regex does not know about string literals, so the `/*` inside a Tailwind `@source` glob such as

```css
@source "../node_modules/streamdown/dist/*.js";
```

is treated as a comment opener. Everything up to the next real `*/` in the file is discarded, which in a typical `globals.css` means the `@theme inline { … }` block and the `:root { --radius: … }` declaration.

The theme then silently falls back to Tailwind's default scale, and `no-arbitrary-values` reports *exact* replacements that are wrong for the project. Applying them via `--fix-suggestions` changes rendered output.

The `@source` line above is the one [streamdown's README](github.com/vercel/streamdown tells every user to add, so this is likely to hit anyone using it with a `calc(var(--radius) …)` ladder.

## Reproduction

`app/globals.css`:

```css
@import "tailwindcss";
@source "../node_modules/some-pkg/dist/*.js";

@theme inline {
--radius-sm: calc(var(--radius) - 4px);
--radius-md: calc(var(--radius) - 2px);
--radius-lg: var(--radius);
--radius-xl: calc(var(--radius) + 4px);
}

:root {
--radius: 0.375rem; /* 6px */
}
```

`page.tsx`:

```tsx
export default function P() {
return ;
}
```

With `"shadcn/no-arbitrary-values": "error"`:

```
"rounded-[8px]" hardcodes an off-token value. Use "rounded-lg" instead (s...

Developer Debate & Comments

No active discussions extracted for this entry yet.

Adjacent Repository Pain Points

Other highly discussed features and pain points extracted from shadcn-ui/lint.

Extracted Positioning
shadcn-ui/lint's `no-raw-colors` rule and its interpretation of custom `--text-*` CSS variables within Tailwind v4 `@theme` blocks.
The linter's objective to enforce design system consistency, particularly regarding color usage, is undermined by its misinterpretation of Tailwind v4's theme structure, where `--text-*` variables define font sizes, not just colors.
Extracted Positioning
shadcn-ui/lint's `no-raw-colors` rule and its compatibility with Tailwind v4's namespaced color theme keys.
The linter's mandate to enforce semantic color usage and prevent raw color values is compromised by its inability to recognize Tailwind v4's standard namespaced color declarations, rendering the rule ineffective in modern Tailwind projects.
Extracted Positioning
shadcn-ui/lint's stylesheet resolution for `package.json` `exports` subpath patterns.
The linter's ability to verify design system rules is compromised by its failure to resolve stylesheets from standard package exports, leading to silent degradation and inaccurate reporting.

Frequently Asked Questions

Market intelligence mapped to shadcn-ui/lint's `parseDeclarations` function, specifically its CSS comment stripping regex and its impact on theme parsing and the `no-arbitrary-values` rule..

What problem does shadcn-ui/lint's `parseDeclarations` function, specifically its CSS comment stripping regex and its impact on theme parsing and the `no-arbitrary-values` rule. solve?
Based on our AI analysis of the original developer request, its primary technical positioning is: The linter's core function of verifying design system rules and preventing arbitrary values is undermined by a regex flaw that incorrectly parses `@source` globs, leading to theme discard and erroneous suggestions.
What are the foundational technologies related to shadcn-ui/lint's `parseDeclarations` function, specifically its CSS comment stripping regex and its impact on theme parsing and the `no-arbitrary-values` rule.?
Our proprietary extraction maps shadcn-ui/lint's `parseDeclarations` function, specifically its CSS comment stripping regex and its impact on theme parsing and the `no-arbitrary-values` rule. to adjacent architectural concepts including CSS comment stripper, parseDeclarations, regex, @source glob.
How does the GitHub community build with shadcn-ui/lint's `parseDeclarations` function, specifically its CSS comment stripping regex and its impact on theme parsing and the `no-arbitrary-values` rule.?
Yes, open-source adoption is correlated. An active project titled 'shadcn-ui/cn' explores similar frameworks: cn is a new engine for Tailwind class merging and conflict resolution. It replaces tailwind-merge and clsx. Same APIs. Full parity. And it is 30× f...

Engagement Signals

0
Replies
open
Issue Status

Cross-Market Term Frequency

Quantifies the cross-market adoption of foundational terms like regex and @theme inline by tracking occurrence frequency across active SaaS architectures and enterprise developer debates.