-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
feat: CSS language plugin #2
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 <[email protected]>
Co-authored-by: Milos Djermanovic <[email protected]>
Co-authored-by: Milos Djermanovic <[email protected]>
Co-authored-by: Milos Djermanovic <[email protected]>
Co-authored-by: Milos Djermanovic <[email protected]>
Co-authored-by: Milos Djermanovic <[email protected]>
Co-authored-by: Milos Djermanovic <[email protected]>
CSSTree updated Blocks so that curly braces are now included in the location, meaning I could remove the extra |
Co-authored-by: Milos Djermanovic <[email protected]>
Co-authored-by: Milos Djermanovic <[email protected]>
Co-authored-by: Milos Djermanovic <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last few suggestions, then LGTM.
if (Array.isArray(child)) { | ||
child.forEach(grandchild => { | ||
visit(grandchild, node); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I can tell, yes.
Co-authored-by: Milos Djermanovic <[email protected]>
Co-authored-by: Milos Djermanovic <[email protected]>
Co-authored-by: Milos Djermanovic <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.