Skip to content

Count lines from 1 in error and warning locations - #21

Merged
marcoroth merged 2 commits into
mainfrom
one-based-line-numbers
Oct 14, 2026
Merged

marcoroth merged 2 commits into
mainfrom
one-based-line-numbers

Conversation

@marcoroth

@marcoroth marcoroth commented Oct 14, 2026 •

Copy link
Copy Markdown
Owner

This pull request updates the locations in error messages and warnings to count lines from 1, so they point at the line with the problem instead of the one above it.

This follows Prism and Herb, which both count lines from 1. Columns in the messages already count from 1, the same as the column Herb prints in its messages, so they stay as they are.

css = ".a { color: red; }\n.b, { color: blue; }\n"

LightningCSS.transform(css, filename: "main.css")
- LightningCSS::ParseError: Invalid empty selector at main.css:1:5
+ LightningCSS::ParseError: Invalid empty selector at main.css:2:5

Resolves #17

@marcoroth
marcoroth force-pushed the one-based-line-numbers branch from 235cb8d to 0d6d056 Compare October 14, 2026 06:21
@marcoroth
marcoroth enabled auto-merge (squash) October 14, 2026 06:21
@marcoroth
marcoroth merged commit e3232d4 into main Oct 14, 2026
11 checks passed
@marcoroth
marcoroth deleted the one-based-line-numbers branch October 14, 2026 06:33
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.

Error and warning locations use 0-based line numbers

1 participant