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.

Fix deletion of code with --fix option

See original GitHub issue

I tried the minimum configuration.

package.json

{
  "dependencies": {
    "stylelint": "^9.4.0"
  }
}

.stylelintrc

{
  "rules": {
  }
}

ex1

app.sass

.ToggleSwitch
  @extend .hoge

CLI with yarn run stylelint app.sass --fix yarn run stylelint app.sass

Unexpected changes will be made

ex2

app.sass

.ToggleSwitch
  @extend .hoge
  @include .fuga
  padding: 0 $width
  border: 1px solid $border-color

CLI with yarn run stylelint app.sass --fix yarn run stylelint app.sass

Unexpected changes will be made

.ToggleSwitch
  
    padding: 0 $width
  border: 1px solid border-color

thx

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
jeddy3commented, Feb 15, 2020

This issue is likely due to to a problem in postcss-sass, which stylelint uses:

We lean on PostCSS syntaxes to help us with this task [of supporting non-standard syntaxes] . We use them to transform these languages into something that resembles CSS

Please consider contributing a fix upstream to resolve this issue.

I’ll add an “upstream” label to indicate this.

Any workaround?

We added a feature in 13.2.0 to workaround these types of upstream parser issues:

Fixing bugs in syntaxes can take time. stylelint can work around these bug by turning off autofix for incompatible sources. Autofix can then remain safe to use while contributors try to fix the underlying issue.

If you’re unable to contribute to the upstream parser, please consider contributing a workaround to stylelint itself so that autofix becomes safer to use with sass syntax.

4reactions
renanpvazcommented, Apr 1, 2019

I’m having the same issue when using sass + fix option.

Here are some more examples that might be helpful:

- @import '../settings/variables'
- background: url("https://s3.amazonaws.com/cool-url/icon.svg")
+ background: "https://s3.amazonaws.com/cool-url/icon.svg"

this won’t even break because navy is a preset color lol

- color: $navy
+ color: navy 
- @font-face
-  font-family: 'Gotham'
-  src: ...
-  font-style: italic
-  font-weight: 300
Read more comments on GitHub >

github_iconTop Results From Across the Web

4 Ways to Solve the Cannot Delete Files Error
Step 2: Now click on "Troubleshoot" > "Advanced options" > "Startup Settings" ... These are some of the typical ways of fixing cannot...
Read more >
6 Ways to Fix the “Could Not Find This Item” Deletion Error in ...
To delete a file or folder using Eraser on Windows 10, right-click on it and select Eraser > Erase. On Windows 11, right-click...
Read more >
Windows Scan And Fix Deleted Files – Problem Solved
Be Ready to Recover Deleted Files from Scan and Fix · By clicking on the former option, you can see all partition on...
Read more >
Quick and Easy Solution! Delete option missing can't delete files
diy #computerhelp # delete #windowshelpSometimes you may find that the delete option is missing when you right click mouse on a file or ......
Read more >
eslintcache is deleted when auto-fix is performed #635 - GitHub
I think the solution here is to add an option like Preserve ESLint cache , which would add --cache when performing a fix....
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