postcss-selector-parser
postcss-selector-parser copied to clipboard
broken ast
regarding to https://github.com/stylelint/stylelint/issues/4049
.foo1, // this comments is marked as an error
.foo2 {
color: #fff;
}
Parsers // this comments is marked as an error as selectors
Known issue, we should rewrite parser whole, now we parse comments as part of ast, but it is invalid, we should use leadingComments, trailingComments and etc as do babel (try this in https://astexplorer.net/), it is allow to keep ast clean and works with comments in right way (without pain)
Is it possible to contribute? or this issue still is in discussion?
@vankop it is breaking change, anyway let's do it, in future we should use safe option and throw error on this syntax when for pure css
@evilebottnawi I will take this.
:+1:
@evilebottnawi should we skip comments in .toString() method?
Currently https://github.com/postcss/postcss-selector-parser/blob/master/src/tests/util/helpers.js#L24 we expect that comments will be in output
No, we should print comments
Sorry I was a bit stuck with stringifying comments correctly and gave up =) I hope I will find time on the next week or will create WIP PR.
This issue is occurring in upgrade for angular 12, and i also get this criptic error message that the angular people says comes from this progam after I replace all the // comments: Error: Unexpected '/'. Escaping Social characters with \ may help
Shouldn't the error message give a location where this error occurs?
@daddyschmack just helped a teammate with this. Apparently this is a problem with CRLF or something related to Stylelint's ignoreFiles.