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

quotes in comments break stylelint in less mode #145

Closed
Zae opened this issue Nov 17, 2019 · 3 comments
Closed

quotes in comments break stylelint in less mode #145

Zae opened this issue Nov 17, 2019 · 3 comments

Comments

@Zae
Copy link

Zae commented Nov 17, 2019

Hi,

I noticed that stylelint does not handle single quotes in // comments well.

This might be a duplicate of #130 but i'm still having this issue.

I can sort of reproduce it in the demo environment, but not really. Locally the quote causes the linenumbers to start at 0 at the quote again, so errors following the quote will have incorrect linenumbers.

In the demo the duplicate selector isn't found by stylelint, but only if the quote if on the end of the line, locally it doesn't matter where the quote is in the comment.

/* */ comments work fine btw.

Version: 9.10.1 and 11.1.1 (did not test any other versions)

@evilebottnawi asked me to open an issue (stylelint/stylelint#4411) here as he thinks the issue is caused by postcss-less.

  • Node Version: v10.15.0 (but i don't think it matters)
  • NPM Version: 6.4.1 (but i don't think it matters)
  • YARN Version: 1.19.1 (but i don't think it matters)
  • postcss Version: ^7.0.14
  • postcss-less Version: ^3.1.4

LESS

a {
  color: #FFF;
}

p {
  color: #ASDASD;
  // Dont do this it breaks'
}

a {
  color:#BROKEN;
}

Expected Behavior

Stylelint shows the correct line

Actual Behavior

Stylelint resets the linenumbers when a quote is found in a single line comment.

How can we reproduce the behavior?

Try to stylelint the provided less

@Zae Zae changed the title quotes in comments break the parser in less mode #4411 quotes in comments break stylelint in less mode Nov 17, 2019
@shellscape
Copy link
Owner

Thanks for opening an issue 🍺

I would be happy to review a pull request which addressed the line numbering problem.

@popov-tensor
Copy link

There is an "extended version" of bug described in stylelint/stylelint#5115 .
If there is a quote character in lines below the problem comment, stylelint still fails to number lines correctly. The test above contains only one quote character in comment, so does not cover such case.

shellscape pushed a commit that referenced this issue Feb 22, 2021
* Add test case for single comment with quote symbol at the end (#145)

* Fix bug connected with creating new single line comment with quote symbol token.
@shellscape
Copy link
Owner

Fixed by #154

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants