postcss-less icon indicating copy to clipboard operation
postcss-less copied to clipboard

Inline comment inside selector outputs invalid selector

Open cdrini opened this issue 6 years ago • 4 comments

Causing some downstream errors in stylelint: https://github.com/stylelint/stylelint/issues/4049 . I observed these errors in my repo when trying to update stylelint from 9.6.0 to 12.0.1 .

  • Node Version: 13.5.0
  • NPM Version: Unk; using RunKit
  • postcss Version: 7.0.26
  • postcss-less Version: 3.1.4

LESS

// comment1
.a, .b,
// comment2
.c {}

JavaScript

const { parse } = require("postcss-less");
const less = `
// comment1
.a, .b,
// comment2
.c {}`;
const result = parse(less);
console.log(result);

Expected Behavior

comment2 should have its own Comment node and (probably?) not be inside the selector's string.

Actual Behavior

comment2 appears inside the selector string: selector: ".a, .b,\n// comment2\n.c"

How can we reproduce the behavior?

Run it here: https://runkit.com/embed/euxbhhlhqu1l

cdrini avatar Jan 14 '20 17:01 cdrini

Happy to review a PR to resolve this.

shellscape avatar Jan 14 '20 18:01 shellscape

would this be ever fixed then? A year passed

xboy2012 avatar Nov 23 '21 11:11 xboy2012

@xboy2012 the "PR Welcome" tag means it requires community contribution for resolution. I'd you'd like to see this fixed, please open a pull request.

shellscape avatar Nov 23 '21 14:11 shellscape

It seem like work well in postcss-less v5

xyy94813 avatar Jan 20 '22 03:01 xyy94813