Skip to content

fix(postcss): keep comment indentation stable - #1507

Merged
Anber merged 1 commit into
masterfrom
anber/fix-comment-indentation-roundtrip
Aug 5, 2026
Merged

fix(postcss): keep comment indentation stable#1507
Anber merged 1 commit into
masterfrom
anber/fix-comment-indentation-roundtrip

Conversation

@Anber

@Anber Anber commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Motivation

stylelint --fix is not idempotent for comments inside indented Linaria templates: it adds the template's base indentation before trailing comments and removes it from continuation lines inside multi-line comments on every run.

Closes #1502.

Summary

  • restore base indentation before a root node only when the whitespace actually starts the line
  • preserve source indentation inside unchanged multi-line comment text
  • cover both cases across three parse/stringify passes

Validation

  • 5 Jest suites, 97 tests, 13 snapshots
  • TypeScript typecheck
  • ESLint
  • Prettier

@changeset-bot

changeset-bot Bot commented Aug 5, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8cc33ce

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
@linaria/postcss-linaria Patch
@linaria/atomic Patch
@linaria/babel-plugin-interop Patch
@linaria/core Patch
@linaria/react Patch
@linaria/server Patch
@linaria/stylelint Patch
@linaria/stylelint-config-standard-linaria Patch
linaria Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@Anber
Anber marked this pull request as ready for review August 5, 2026 10:17
@Anber
Anber merged commit c7b0360 into master Aug 5, 2026
8 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.

@linaria/postcss-linaria: stylelint --fix keeps adding whitespace before a trailing comment

1 participant