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 function-url-quotes false positives for SCSS variable and @ character #7404

Closed
tavelli opened this issue Dec 15, 2023 · 2 comments · Fixed by #7416
Closed

Fix function-url-quotes false positives for SCSS variable and @ character #7404

tavelli opened this issue Dec 15, 2023 · 2 comments · Fixed by #7416
Labels
status: wip is being worked on by someone type: bug a problem with a feature or rule

Comments

@tavelli
Copy link

tavelli commented Dec 15, 2023

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

.class {
  background-image: url($asset-prefix + 'assets/images/fa_calculator_blue@2x.png');
}

.otherclass {
    background: url($asset-prefix + 'assets/images/HSA_Icons-31.png');
}

What minimal configuration is needed to reproduce the bug?

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

How did you run Stylelint?

"stylelint \"apps/**/*.scss\" \"libs/**/*.scss\"" --fix

Which Stylelint-related dependencies are you using?

"stylelint": "^16.0.2",
"stylelint-config-standard-scss": "^12.0.0",

What did you expect to happen?

nothing should happen. format is valid/conforming.

.class {
  background-image: url($asset-prefix + 'assets/images/fa_calculator_blue@2x.png');
}

.otherclass {
    background: url($asset-prefix + 'assets/images/HSA_Icons-31.png');
}

What actually happened?

added extraneous double quotes around entire thing

.class {
  background-image: url("$asset-prefix + 'assets/images/fa_calculator_blue@2x.png'");
}

.otherclass {
    background: url($asset-prefix + 'assets/images/HSA_Icons-31.png');
}

Do you have a proposal to fix the bug?

the @ symbol in the image path seems to be the problem, when i remove that it does not add wrapping double quotes...

@jeddy3 jeddy3 changed the title function-url-quotes adding extra quotes when concatenating with scss variable and url includes @ character Fix function-url-quotes false positives for SCSS variable and @ character 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 labels Dec 16, 2023
@jeddy3
Copy link
Member

jeddy3 commented Dec 16, 2023

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

We'll probably need to improve the heuristics in isStandardSyntaxUrl.

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.

@mattxwang
Copy link
Member

Ended up taking a stab at diagnosing the issue and wrote a longer explanation in #7416!

@ybiquitous ybiquitous added status: wip is being worked on by someone and removed status: ready to implement is ready to be worked on by someone labels Dec 20, 2023
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
Development

Successfully merging a pull request may close this issue.

4 participants