Conversation
|
One thing I've noticed about this parser: it is very fault-tolerant, just like the CSS parser built into the browser. That means something like |
|
https://drafts.csswg.org/css-syntax/#consume-simple-block
Encountering an |
|
@romainmenke it may be correct syntax by the spec, but users would expect a linter to pick that up. |
|
Sure, no disagreement there :) |
|
I've updated to catch the errors that csstree does report. Waiting to hear back on |
Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
|
CSSTree updated Blocks so that curly braces are now included in the location, meaning I could remove the extra |
Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
mdjermanovic
left a comment
There was a problem hiding this comment.
Last few suggestions, then LGTM.
| if (Array.isArray(child)) { | ||
| child.forEach(grandchild => { | ||
| visit(grandchild, node); | ||
| }); |
There was a problem hiding this comment.
Is it guaranteed that all array items are always AST nodes, not e.g., null as can be the case in ESTree (for example, in ArrayExpression#elements)?
There was a problem hiding this comment.
As far as I can tell, yes.
Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
mdjermanovic
left a comment
There was a problem hiding this comment.
LGTM, thanks!
I'm not sure if the a { parsing is a blocker for merging this and releasing the first version of this plugin. If it isn't, I think this is ready to merge & release.
|
It shouldn't be a blocker. I just left it in there to remind me to follow up. |
This is the first commit for the CSS language plugin. It implements the basic functionality along with the general infrastructure necessary for the plugin.
I've included just one rule to ensure that the language plugin works. We can add additional rules on a one-off basis after this initial PR is merged.