Skip to content

Inline comment inside selector outputs invalid selector #147

@cdrini

Description

@cdrini

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions