shellscape / postcss-less

PostCSS Syntax for parsing LESS
MIT License
122 stars 39 forks source link

Inline comment inside selector outputs invalid selector #147

Open cdrini opened 4 years ago

cdrini commented 4 years ago

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 .

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

shellscape commented 4 years ago

Happy to review a PR to resolve this.

xboy2012 commented 2 years ago

would this be ever fixed then? A year passed

shellscape commented 2 years ago

@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.

xyy94813 commented 2 years ago

It seem like work well in postcss-less v5