question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[question] `scss/no-duplicate-dollar-variables`

See original GitHub issue

Example:

.btn {
    $new-color: $color;

    @if (lightness($background) < 75%) {
      $new-color: $background;
    }

    color: $new-color;
}

Looks like rule don’t look on context, just search same name and all. It is expected behaviour?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
kristerkaricommented, May 4, 2018

Oh yeah there’s of course always the option of adding secondary ignore option to the rule to ignore variables inside @if.

0reactions
kristerkaricommented, Jun 16, 2018

@evilebottnawi I have now implemented ignore options for the rule. Please have a look at the PR and let me know if it solves the issue that you had: https://github.com/kristerkari/stylelint-scss/pull/256

Read more comments on GitHub >

github_iconTop Results From Across the Web

[question] `scss/no-duplicate-dollar-variables` · Issue #244 - GitHub
The rule is quite simple and does not handle any special cases, at least yet. In your example it might be easier to...
Read more >
Disable 'no-duplicate-dollar-variables' for ... - Stack Overflow
Is it possible to tell stylelint to skip the 'no-duplicate-dollar-variables' rule when a variable is initialized with default as in the case ...
Read more >
Duplicate dollar signs ($) when using autocomplete.
Using VSCode v1.48.2. If I type the preceding $ for a php variable, then use autocomplete a second $ is added to the...
Read more >
Sass vs. Less | CSS-Tricks
Variable Handling. Less uses @, Sass uses $. The dollar sign has no inherent meaning in CSS, while the @ sign does.
Read more >
How to write reusable CSS with SASS - LogRocket Blog
Custom CSS (even with CSS variables) is still very redundant. ... run into the problem of importing a style sheet inside another style...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found