Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix declaration-property-value-no-unknown parse error for multiline interpolation #7403

Closed
FloEdelmann opened this issue Dec 15, 2023 · 1 comment · Fixed by #7406
Closed
Labels
status: wip is being worked on by someone type: bug a problem with a feature or rule

Comments

@FloEdelmann
Copy link
Member

FloEdelmann commented Dec 15, 2023

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

.foo {
  color: #{
    some-scss-function()
  };
}

What minimal configuration is needed to reproduce the bug?

{
  "rules": {
    "declaration-property-value-no-unknown": true
  }
}

How did you run Stylelint?

stylelint file.scss

Which Stylelint-related dependencies are you using?

{
  "stylelint": "^15.11.0",
  "stylelint-config-standard-scss": "^11.1.0"
}

What did you expect to happen?

No error, since interpolations should be ignored in the rule:

if (!isStandardSyntaxValue(value)) return;

What actually happened?

A problem was reported:

Cannot parse property value "#{
    some-scss-function()
  }" for property "color" (declaration-property-value-no-unknown)

Do you have a proposal to fix the bug?

I think the regex here needs to be changed to also take newline characters into account:

const HAS_SCSS_INTERPOLATION = /#\{.+?\}/;

@Mouvedia Mouvedia added status: needs discussion triage needs further discussion syntax: scss relates to SCSS and SCSS-like syntax labels Dec 15, 2023
@jeddy3 jeddy3 removed the syntax: scss relates to SCSS and SCSS-like syntax label Dec 16, 2023
@jeddy3 jeddy3 changed the title Multiline SCSS interpolations are not ignored Fix declaration-property-value-no-unknown parse error for multiline interpolation Dec 16, 2023
@jeddy3 jeddy3 added status: ready to implement is ready to be worked on by someone type: bug a problem with a feature or rule and removed status: needs discussion triage needs further discussion labels Dec 16, 2023
@jeddy3
Copy link
Member

jeddy3 commented Dec 16, 2023

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

The rule is only for CSS:

This rule is only appropriate for CSS. You should not turn it on for CSS-like languages, such as Sass or Less, as they have their own syntaxes.

Having said that, there's no harm in improving the interpolation to migrate this particular issue. You may encounter other issue trying to use the rule for SCSS, though.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: wip is being worked on by someone type: bug a problem with a feature or rule
3 participants