Skip to content

Fix/css parse errors with location#2

Open
kristentr wants to merge 8 commits intokristentr:kristentrfrom
tailwindlabs:fix/css-parse-errors-with-location
Open

Fix/css parse errors with location#2
kristentr wants to merge 8 commits intokristentr:kristentrfrom
tailwindlabs:fix/css-parse-errors-with-location

Conversation

@kristentr
Copy link
Owner

Summary

Test plan

ish1416 and others added 8 commits November 8, 2025 13:48
- Add getLineAndColumn helper to calculate position from buffer index
- Add formatError helper to format errors with source location
- Update all CSS parser error messages to include filename:line:column
- Add comprehensive test coverage for error reporting
- Maintain backward compatibility when no filename provided

Fixes #19236
- Use simpler CSS that actually triggers parse errors
- Fix regex patterns to match actual error output
- Remove inline snapshots from describe.each blocks
- Update CLI test to match actual error line numbers

All tests should now pass with the CssSyntaxError implementation.
createLineTable().find() returns 0-based columns per source map spec,
but users expect 1-based column numbers. Add 1 to column before
formatting error message so both line and column are 1-based and accurate.

Addresses reviewer feedback about off-by-one column numbers.
Add minimal JSDoc documentation to satisfy docstring coverage requirement
for the exported CssSyntaxError class.
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.

3 participants