stylelint icon indicating copy to clipboard operation
stylelint copied to clipboard

Fix `declaration-property-value-keyword-no-deprecated` false positives for function arguments

Open woylie opened this issue 11 months ago • 1 comments

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

$colors: (
  background: (
    primary: #f00
  )
);

@function mycolor($id, $ids...) {
  @return map.get($colors, $id, $ids...);
}

.some-class {
  background-color: mycolor(background, primary);
}

What minimal configuration is needed to reproduce the bug?

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

How did you run Stylelint?

stylelint css

Which Stylelint-related dependencies are you using?

{
    "stylelint": "16.19.1",
    "stylelint-config-recess-order": "6.0.0",
    "stylelint-config-standard-scss": "15.0.0",
    "stylelint-declaration-strict-value": "1.10.11",
    "stylelint-webpack-plugin": "5.0.1"
}

What did you expect to happen?

No problems being reported for SCSS function arguments. No auto-fixes applied.

What actually happened?

This warning is emitted:

Expected "background" to be "canvas"  declaration-property-value-keyword-no-deprecated

The auto-fixer updates the code to:

.some-class {
  background-color: mycolor(canvas, primary);
}

Do you have a proposal to fix the bug?

No response

woylie avatar May 14 '25 05:05 woylie

@woylie Thanks for the report and for using the template.

I can reproduce this using the demo and:

a {
  color: --foo(background);
}

I've labelled the issue as ready to implement. Please consider contributing if you have time.

There are steps on how to fix a bug in a rule in the Developer guide.

The fix will likely involve ignoring keywords inside functions.

jeddy3 avatar May 14 '25 10:05 jeddy3