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

Inline comment inside selector outputs invalid selector #147

Open
cdrini opened this issue Jan 14, 2020 · 4 comments
Open

Inline comment inside selector outputs invalid selector #147

cdrini opened this issue Jan 14, 2020 · 4 comments

Comments

@cdrini
Copy link

cdrini commented Jan 14, 2020

Causing some downstream errors in stylelint: stylelint/stylelint#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 cdrini changed the title Comment inside selector outputs doesn't output Comment node Inline comment inside selector outputs invalid selector Jan 14, 2020
@shellscape
Copy link
Owner

Happy to review a PR to resolve this.

@xboy2012
Copy link

would this be ever fixed then? A year passed

@shellscape
Copy link
Owner

@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
Copy link

It seem like work well in postcss-less v5

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

4 participants