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.

no-duplicate-dollar-variables doesn't respect scopes

See original GitHub issue

no-duplicate-dollar-variables rule reports variables with the same name but declared in different scopes. The snippet below produces error Unexpected duplicate dollar variable $padding-x scss/no-duplicate-dollar-variables.

.FormControl-label {
  $padding-x: $padding-small-x;

  @include input-overlay;

  position: relative;
  top: 0.40em;
  margin-left: $margin-medium-x;
  padding-left: $padding-x;
  padding-right: $padding-x;
  font-size: $font-size-small;
}


.FormControl-input {
  $padding-x: $padding-medium-x;

  width: 100%;
  border: 1px solid $color-grey-light;
  border-radius: 0;
  padding-left: $padding-x;
  padding-right: $padding-x;
  height: $row-height;
}

For me it’s pretty obvious that this shouldn’t be reported. Am I wrong?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:5

github_iconTop GitHub Comments

2reactions
kristerkaricommented, Feb 14, 2019
0reactions
masicommented, May 4, 2021

WIth 3.18 the rule triggers:

.foobar {
  $gapWidth: 5px;

  @media (min-width: 600px) {
    $gapWidth: 15px;
  }
}

I had assumed that the media query defines a scope.

Read more comments on GitHub >

github_iconTop Results From Across the Web

no-duplicate-dollar-variables doesn't respect scopes #277
no -duplicate-dollar-variables rule reports variables with the same name but declared in different scopes. The snippet below produces error ...
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 >
PythonTA Checks
This error occurs if there are duplicate parameter names in function definitions. All parameters must have distinct names, so that we can refer...
Read more >
Use variable inside other variable (#1809) · Issues - GitLab
For other users coming across strange variable value changes, please note that if your variable value contains a dollar sign $ and it...
Read more >
Code Style | PMD Source Code Analyzer
Avoid using dollar signs in variable/method/class/interface names. ... public abstract class Thing {} // This class doesn't respect the convention, ...
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