Conversation
| if (node.type !== 'Raw' || node.value !== '') { | ||
| children.push(node); | ||
| } |
There was a problem hiding this comment.
I noticed this logic in a few places. CSSTree inserts Raw nodes where it can't figure out how to parse the source. I'm not sure we should exclude them here.
There was a problem hiding this comment.
It also looks strange to me, but that's how it was in https://github.com/eslint/csstree/blob/1d74355c1960315bf55a33b0652d13f97ebb1ba2/lib/syntax/atrule/import.js. I don't understand it that well, so I decided that it's better to leave it as close to the original as possible :)
| if ( | ||
| this.tokenType === tokenTypes.Function && | ||
| this.cmpStr(this.tokenStart, this.tokenEnd, 'source(') | ||
| ) { | ||
| children.push(this.Function(null, parseFunctions)); | ||
| matched = true; | ||
| } else if ( | ||
| this.tokenType === tokenTypes.Function && | ||
| this.cmpStr(this.tokenStart, this.tokenEnd, 'prefix(') | ||
| ) { | ||
| children.push(this.Function(null, parseFunctions)); | ||
| matched = true; | ||
| } else if ( | ||
| this.tokenType === tokenTypes.Function && | ||
| this.cmpStr(this.tokenStart, this.tokenEnd, 'layer(') | ||
| ) { |
There was a problem hiding this comment.
These are all checking if the tokenType is a function. Can we reduce the number of times we're doing that check?
There was a problem hiding this comment.
Done. Also replaced matched = false with break to simplify further.
nzakas
left a comment
There was a problem hiding this comment.
Apologies for the delay, this looks good to me. Thanks!
|
Thanks, I appreciate all your work on CSS support in ESLint! |
|
Don't panic, just have to revert and re-add to generate the release. |
Fixes #16, fixes #10 for real this time, replaces #21.
If I understand correctly, #10 wasn't actually fixed by #14, it just introduced a test that confirmed that
@import 'tailwindcss' prefix(tw)is parsed asRawnode, which is interpreted by@eslint/cssas parse error. It also added that test to TW3 test, which I removed, since this syntax was introduced in v4.