stylelint icon indicating copy to clipboard operation
stylelint copied to clipboard

Fix location of reported violations after multiline parameters

Open Tenkoru opened this issue 5 years ago • 8 comments

Clearly describe the bug

If I use @include or @mixin with parameters at multiline it's breaks messages and highlighted errors, that goes afterwards.

Which rule, if any, is the bug related to?

Not depends on rules

What code is needed to reproduce the bug?

e.g.

.instance-button {
  @include button (
    $padding: 0 0 0 16px,
    $border: none,
    $background-color: transparent,
    $text-transform: capitalize,
    $fill: $black-l-5);
  .d-Icon {
    margin-right: 16px;
  }
}

What stylelint configuration is needed to reproduce the bug?

e.g.

Not depends on rules

Which version of stylelint are you using?

e.g. 13.3.1

How are you running stylelint: CLI, PostCSS plugin, Node.js API?

e.g. "Webstorm, also tryed in Intelij Idea"

Does the bug relate to non-standard syntax (e.g. SCSS, Less etc.)?

e.g. "Yes, it's related to SCSS nested properties."

What did you expect to happen?

e.g. "Messages and highlights at right places"

What actually happened (e.g. what warnings or errors did you get)?

e.g. "The following warnings were flagged:"

No warnont

Two screenshots to show the difference: image image

Tenkoru avatar Apr 09 '20 21:04 Tenkoru

@Tenkoru Thanks for the report and for using the template.

I'm unable to reproduce this using the demo, the CLI nor the VS Code plugin. They correctly report that the violation is on line 13.

The problem may lie with the Webstorm and Intelij Idea plugin. I recommend:

  • checking you're using the latest version of stylelint (currently 13.3.1)
  • raising a bug report in their issue tracker

I'm going to close this issue for now as it doesn't appear to be a problem with stylelint itself. Feel free to reopen with a reproducible example, though.

jeddy3 avatar Apr 10 '20 11:04 jeddy3

Thanks for answer. I created a issue at jetbrains forum. https://youtrack.jetbrains.com/issue/WEB-44856 What i should do next?

Tenkoru avatar Apr 13 '20 09:04 Tenkoru

Elena Pogorelova commented 2 hours ago didn't try this in VSCode, but I can easily reproduce the issue by running stylelint in terminal. So it's clearly not an issue with Webstorm

I'm unable to reproduce it locally.

.instance-button {
  @include button (
    $padding: 0 0 0 16px,
    $border: none,
    $background-color: transparent,
    $text-transform: capitalize,
    $fill: $black-l-5);
  .d-Icon {
    margin-right: 16px;
  }
}

.bad-style {}
{
  "rules": {
    "block-no-empty": true
  }
}

Gives me:

jeddy3@UNKNOWN stylelint-test % npx stylelint "sources/scss/fix.scss" --config configs/fix.json

sources/scss/fix.scss
 13:12  ✖  Unexpected empty block   block-no-empty

However, Elena Pogorelova was able to reproduce it. Therefore something is definitely amiss. I'll reopen the issue as needing investigation.

@Tenkoru Can you:

  • try reproducing the issue locally using the stylelint CLI?
  • tell us what OS are you using, e.g. MacOS, Windows 10 etc?

A difference in OS is usually the culprit with these mysterious bugs.

jeddy3 avatar Apr 13 '20 10:04 jeddy3

I reproduced it localy with CLI. My OS is Windows 10 https://prnt.sc/rydrf6

Tenkoru avatar Apr 13 '20 11:04 Tenkoru

Thanks for reproducing it locally. This is a bug in stylelint, but specific to Windows 10 (or Windows line endings).

The problem lies in either the block-no-empty rule (perhaps where it calculates the index) or upstream in the parser stylelint uses to support SCSS.

I've labelled the issue as ready to implement. Please consider contributing if you have time.

There are steps on how to fix a bug in a rule in the Developer guide.

jeddy3 avatar Apr 13 '20 13:04 jeddy3

Unfortunately, problem exists with any rule, than goes after multiline parameters.

Tenkoru avatar Apr 14 '20 08:04 Tenkoru

That hints at it being a parser issue, although it doesn't guarantee it. Resolving the bug requires a small investigation to first pinpoint where the issue lies. Please consider digging deeper if you have time, and contributing to the parser if the problem lies there.

jeddy3 avatar Apr 14 '20 11:04 jeddy3

This issue is older than one month. Please ask before opening a pull request, as it may no longer be relevant.

github-actions[bot] avatar Jan 22 '24 10:01 github-actions[bot]