-
-
Notifications
You must be signed in to change notification settings - Fork 452
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(linter): declare_oxc_lint proc_macro #70
Conversation
This is amazing! Thank you for making the time for this. This is exactly what we need.
I think some integrations test for getting the metadata is more than enough, because macros are just implementation details. So probably just a dummy rule where we call and check
I think this is fine here, because it will expand into the equivalent code, it doesn't really better the order we put it. Of course we can do more macro magic to make it super nice, but I'm eager to try out your implementation. We can iterate and make changes later.
Struct with fields is super ergonomic here, are we able to make some kind of round trip to make this happen? Clippy has round trip: Edit: If I understand correctly, pre-defining the struct is the solution for "customization of the struct" then I'm all for it! |
Yeah, cause then its identifier can just be referenced. I'm not sure how useful the macro is currently (well, I guess it might be more future-oriented/useful when there's further metadata and actual usage of it). |
Just noting - I'm not getting the latest lint errors (https://github.com/Boshen/oxc/actions/runs/4284464848/jobs/7461457381) when I run |
On rule name: it can be derived from the struct name, let's do it in the next PR. |
Let's follow clippy from the CI for now, I'll check later and see if CI is actually broken. |
Don't bother, I'm suddenly getting the clippy errors locally. CI is probably fine. |
Squash commits and we'll be good to go 😄 |
c427f09
to
4e35f52
Compare
Thank you! This is one step closer to be like |
Initial implementation for #60
TODO/open questions:
pub struct my_struct
). It doesn't allow for customization of the struct, like you've done with theallow_empty_catch
field in the "no_empty" rule.It's probably possible for the proc macro to parse an arbitrary struct, but it sounds overly complex (it might not be, though).
What do you think about pre-defining the struct, then using the macro.
I may have misunderstood what you want the macro to do/what role you want it to play in creating rules.