Skip to content

Add ignoreAtRulePreludes: [] to length-zero-no-unit #8405

@ArianeBouchardConformit

Description

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

Use this code:

@mixin hardcode-total-height(
  $base-height,
  $extra-height: 0px
) {
  height: calc($base-height + $extra-height);
}

a {
  @include hardcode-total-height(10px);
}

@function add-numbers(
  $number-a,
  $number-b: 0px
) {
  @return calc($number-a + $number-b)
}

div {
  width: add-numbers(10px);
}

Run stylelint on it with option --fix.

Recompile Sass.

What minimal configuration is needed to reproduce the bug?

{
  "extends": [
    "stylelint-config-standard-scss"
  ]
}

How did you run Stylelint?

stylelint "src/**/*.{css,scss,sass,vue}" --fix

https://stylelint.io/demo/#N4Igxg9gJgpiBcIACBbAlgDzQOwAQAsBDAJyklgFoAXCKwgGwvxjQHN8qAKAHW26oAkAI0IBnGExbsqAGl78BMDFWKFJbDvFwAGAA4ZeASlzB5VZhqpawDMJ2FiJF6bgDUuRctXrphgNy8AL7y2IQmZkg4YPQArrAEJGTQEjR0jM4cnACMehj+QSFIAGYx2GBUaBB4hFBQFNgxKEIwxKI8fIINTS0UhHIdAl3NxBRCWrlmxqYd-EjEMFQxxHg29HaDjcO9bh5DPUKGZsF8HVBoAG7hM1QA7mhQ5lo1dXut2bn5HYEgMiBFaPQYAA5QgoOCIJSg3SAgB0ojAolEP3AVX+rAQIGmuFw3BASioMGwUFEuK0AG1eNjsbjRFQAJ6A+g4KgUSDYNEUWmEImJTkIkkgSm4AC6QWRbLRADEIMQUIQqBiAFaiKrI2C6JGILE4kC0hkwJnYKiknX0eUwWm4-rU3X0xnMvmIk24gB6ADYYTlPVahTS7QaHRK2Jy6DzSI6BVpXVkACww7Tx3FiwJAA

Which Stylelint-related dependencies are you using?

      "sass": "^1.85.0",
      "stylelint": "^16.14.1",
      "stylelint-config-standard-scss": "^14.0.0",
      "stylelint-config-standard-vue": "^1.0.0",
      "stylelint-order": "^6.0.4",
      "stylelint-scss": "^6.10.1",
      "vite": "^6.1.0",

What did you expect to happen?

  1. autofix does NOT remove the unit from the default argument values
  2. therefore there is no Sass compilation error about invalid units

What actually happened?

  1. Autofix transforms 0px into 0
  2. On recompilation, Sass says 10px and 0 are incompatible.

Do you have a proposal to fix the bug?

Apply the same fix as in #8034 to mixin/function default argument values

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions