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.

Incorrect autofix for Sass indented mixins

See original GitHub issue

What steps are needed to reproduce the bug?

  1. Run stylelint on file containing mixin.
  2. The mixin line is gone

Sample file:

// assets/stylesheets/components/alerts.sass
.alert__undo
  background: #33343A !important
  height: 80px

.error-alert
  +box-shadow($box-shadow)
  border-color: $error-darker
  margin: $m-sm auto
  width: 50%

  span
    color: $error-darker
    display: flex
    font-weight: 500
    justify-content: space-between
    line-height: $m-base

What Stylelint configuration is needed to reproduce the bug?

{
  "extends": [
    "stylelint-config-prettier",
    "stylelint-config-recommended-scss",
    "stylelint-config-standard",
  ],
  "customSyntax": "postcss-sass",
  "plugins": [
    "stylelint-order",
    "stylelint-scss"
  ],
  "rules": {
    "indentation": 2,
    "order/properties-alphabetical-order": true
  }
}

How did you run Stylelint?

yarn stylelint 'assets/stylesheets/*.sass' --fix --custom-syntax

Which version of Stylelint are you using?

^14.11.0

What did you expect to happen?

I expect the file to keep the +box-shadow($box-shadow) line after stylelint is run

What actually happened?

The mentioned line is removed from the file.

Does the bug relate to non-standard syntax?

SASS

Proposal to fix the bug

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
jeddy3commented, Sep 6, 2022

@bartoszmaka Thanks for the report. @ybiquitous Thanks for digging into the issue.

Unfortunately, postcss-sass and gonzales-pe internally used by postcss-sass seems not to be actively maintained

We removed built-in support for non-standard syntaxes in 14.0.0 for precisely this reason. Non-standard syntaxes are maintained by their respective communities and syntaxes will fade away if the health of the community isn’t good. We can close the issue as it isn’t related to Stylelint itself. @bartoszmaka If you have time, I suggest contributing to the upstream parsers if you wish to continue using Sass with Stylelint.

0reactions
ybiquitouscommented, Sep 6, 2022

Unfortunately, postcss-sass and gonzales-pe internally used by postcss-sass seems not to be actively maintained. 😓

Read more comments on GitHub >

github_iconTop Results From Across the Web

indentation is not auto fixed · Issue #18 · srowhani/sass-lint ...
I am searching a solution to fix bad indentation in my scss files and i thought that sass-lint-auto-fix was made for that. But...
Read more >
Syntax
The indented syntax supports all the same features as SCSS, but it uses indentation instead of curly braces and semicolons to describe the...
Read more >
stylelint-config-sass-guidelines - npm package
Simply add a "rules" key to your config and add your overrides there. For example, to change the indentation to tabs and turn...
Read more >
How can i fix the css stylelint errors caused by sass / scss?
I have used various sass linting options like sass-lint and sass-lint-auto-fix but these options, though helpful, have not fixed the problems in ...
Read more >
Changelog
Added: declaration-block-no-duplicate-properties autofix (#6296) (@fpetrakov). ... Fixed: indentation false positives for Less parametric mixins with rule ...
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