Skip to content

Fix unexpected change of syntax in computed EditInfo #8637

@pamelalozano16

Description

@pamelalozano16

What minimal example or steps are needed to reproduce the bug?

// rule-empty-line-before
.foo {
  padding: 10px;
}

// rule-empty-line-before
.baz {
  margin: 10px;
}

Demo

What minimal configuration is needed to reproduce the bug?

{
  "extends": [
    "stylelint-config-standard-scss"
  ],
  "rules": {
    "rule-empty-line-before": "always"
  }
}

How did you run Stylelint?

Demo

Which Stylelint-related dependencies are you using?

{
    "postcss": "^8.5.6",
    "stylelint": "^16.21.0",
    "stylelint-config-standard-scss": "^15.0.0",
    "stylelint-scss": "^6.12.1",
}

What did you expect to happen?

I’ve encountered some inconsistencies when using --compute-edit-info with the rule-empty-line-before rule. The issues appear in how fixes are generated and applied, particularly in relation to comment placement and formatting.

Additional notes

  • Why are silent comments being changed to loud (/* */) ones? While this might be helpful for clarity or tooling, this change can be disruptive in codebases that intentionally use silent comments. It would be great to make this optional or configurable.

Expected Behavior:

  • Fixes should apply consistently to all violations where possible.
  • If a fix is skipped due to a conflict or other rule, the reason should be clear.
  • Comment transformation should not be enforced unless explicitly opted in.

What actually happened?

  • Fixes are not consistently applied across matching violations.
  • Some fixes include a conversion from silent to loud comments (///* */) and insertion of a newline.
  • Others only change the comment notation without adding the expected newline. (See example)
  • In some cases, no fix is provided at all, even when the violation is detected and is not overlapping with others. Demo

Do you have a proposal to fix the bug?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions