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

Bugfix recursive rule-naming #4

Merged
merged 2 commits into from
Nov 8, 2022
Merged

Conversation

vHeemstra
Copy link
Contributor

Fixes #3

Problem/Bug

Object.assign changes the imported rules in-place. Therefore, on each run, rules already has the additonal scss/ variants.

So it makes scss/ variants for each of these, resulting in recursively added doubles and more. See example:

Run 1:

{
  "some-rule": null,
}

becomes

{
  "some-rule": null,
  "scss/some-rule": null,
}

Run 2:

{
  "some-rule": null,
  "scss/some-rule": null,
}

becomes

{
  "some-rule": null,
  "scss/some-rule": null, // <------- this. ---------,
  "scss/some-rule": null, // --- This overwrites ---`
  "scss/scss/some-rule": null,
}

Run 3:

{
  "some-rule": null,
  "scss/some-rule": null,
  "scss/scss/some-rule": null,
}

becomes

{
  "some-rule": null,
  "scss/some-rule": null, // <------- this. ---------,
  "scss/some-rule": null, // --- This overwrites ---`
  "scss/scss/some-rule": null, // <------- this. ---------,
  "scss/scss/some-rule": null, // --- This overwrites ---`
  "scss/scss/scss/some-rule": null,
}

...etc...

`Object.assign` changes the imported rules in-place. Therefore, each next run, the rule names already have the additonal `scss` variants. And this keeps adding up recursively.

Fixes zhilidali#3
@zhilidali zhilidali merged commit 75756df into zhilidali:master Nov 8, 2022
@vHeemstra vHeemstra deleted the patch-1 branch November 8, 2022 04:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Lint error - Unknown rule scss/scss/..etc/at-rule in VS Code
2 participants