-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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(unstable): add JS linting plugin infrastructure #27416
Conversation
setNodeGetters(ctx); | ||
|
||
// DEV ONLY: Enable this to inspect the buffer message | ||
// _dump(ctx); |
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.
Btw: Uncommenting this line makes debugging the binary format easier. It prints it in a text representation.
append_u32(&mut self.buf, span.lo.0); | ||
append_u32(&mut self.buf, span.hi.0); |
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.
I think this is off by one? Maybe prefer using SourceRange
instead of Span
impl TsEsTreeBuilder { | ||
pub fn new() -> Self { | ||
// Max values | ||
// TODO: Maybe there is a rust macro to grab the last enum value? |
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.
Maybe add a warning comment on the enums for now?
// Max values | ||
// TODO: Maybe there is a rust macro to grab the last enum value? | ||
let kind_count: u8 = AstNode::TSEnumBody.into(); | ||
let prop_count: u8 = AstProp::Value.into(); |
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 this off by 1 since Value
is the index I think?
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.
Good point, it's currently accounted for here
deno/cli/tools/lint/ast_buffer/buffer.rs
Lines 203 to 204 in 3ba95cd
kind_map: vec![0; kind_size + 1], | |
prop_map: vec![0; prop_size + 1], |
Maybe that's confusing though and the check should be put here where the values are created instead.
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.
Yeah, or rename to prop_max_index
(though probably best to just account for it here)
todo!(); | ||
} | ||
Decl::TsInterface(node) => { | ||
let pos = ctx.header(AstNode::TSInterface, parent, &node.span, 0); |
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 this property count wrong? I feel like we need a way to express this in the code so that it doesn't need to be manually maintained and the property count can be automatically populated.
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.
Agree, those property counts are a bit brittle. I'll remove them once I'm back.
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.
Very cool and I'm excited about this! Still a lot of work to do, but this is good enough to land for iteration.
This PR extracts the core part of #27203 to make it easier to review and land in parts.
It contains: