Skip to content

Underline the correct occurrence of an unsupported type in --value(…) - #20554

Merged
RobinMalfait merged 4 commits into
tailwindlabs:mainfrom
otarampinelli:fix/value-unsupported-type-underline
Oct 14, 2026
Merged

RobinMalfait merged 4 commits into
tailwindlabs:mainfrom
otarampinelli:fix/value-unsupported-type-underline

Conversation

@otarampinelli

@otarampinelli otarampinelli commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

When an unsupported bare value data type is repeated in --value(…), every warning underlines the first occurrence:

@utility paint-* {
  paint: --value(color, [color], color);
}

Before, both warnings pointed at the first color:

--value(color,[color],color)
        ^^^^^

This happened because the offset was found by replacing every word matching the type with a sentinel in a cloned node and then calling indexOf on the printed result, which always returns the first match.

Now the offset is computed from the node's position instead: thame, plus the (, plus the printed length of the arguments before it.

Each warning points at its own occurrence:

--value(color,[color],color)
        ^^^^^

--value(color,[color],color)
                      ^^^^^

Test plan

Added a test in packages/tailwindcss/src/utilities.test.ts. It spies on console.warn and checks that the two warnings underline the first and the last color respectively.

cd packages/tailwindcss
pnpm vitest run src/utilities.test.ts -t "repeated unsupported data type"

Evidences

https://stackblitz.com/edit/github-yq34h5eo?file=input.css

before fix:
Captura de Tela 2026-10-08 às 15 18 19

after fix:
Captura de Tela 2026-10-08 às 15 19 29

@otarampinelli
otarampinelli requested a review from a team as a code owner October 8, 2026 19:21
@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 061885e1-aaa6-411b-98fb-e7f7e59d11fc
📥 Commits

Reviewing files that changed from the base of the PR and between 7cc5e73 and 0c89215.

📒 Files selected for processing: 1
  • CHANGELOG.md

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

Walkthrough

The utility now calculates unsupported bare-value warning positions from the argument index and preceding serialized arguments. A regression test checks separate underlines for two unsupported color values in one function call. The changelog records this fix.

Priority: ⬇️ Low

Severity of issue fixed: Low

Merge Risk: ⚪ Minimal · up to 0c892

Repeated unsupported-type warnings are intended to point to their respective occurrences, and the supplied regression assertion checks both. No actionable merge risk is evident.

Pre-merge checks: Passed 4
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: correcting the underlined occurrence of repeated unsupported types in --value(…).
Description check Passed The description directly explains the bug, the implementation change, the added test, and the expected warning output. It is related to the changeset.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Reviews (3) · Last reviewed commit: "Add changelog entry" · Reviewed by Greptile

@otarampinelli otarampinelli changed the title Underline the correct occurrence of an unsupported type in --value Underline the correct occurrence of an unsupported type in --value(…) Oct 8, 2026
@RobinMalfait
RobinMalfait force-pushed the fix/value-unsupported-type-underline branch from 24599b0 to 7cc5e73 Compare October 14, 2026 15:42
@RobinMalfait
RobinMalfait force-pushed the fix/value-unsupported-type-underline branch from 7cc5e73 to 0c89215 Compare October 14, 2026 16:03
@RobinMalfait
RobinMalfait enabled auto-merge (squash) October 14, 2026 16:03

@RobinMalfait RobinMalfait left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Computing the offset from the node position is simpler than the sentinel trick, and each warning now points at its own occurrence. Nice test too.

Sent by an AI assistant on behalf of @RobinMalfait.

@RobinMalfait
RobinMalfait merged commit 2cf0e87 into tailwindlabs:main Oct 14, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants