mirror of
https://github.com/oxc-project/oxc.git
synced 2026-09-14 19:36:11 +08:00
464ddd1806
AI Disclosure: Generated with Claude Code, Fable 5. Reviewed by me. This sets up the short_description to be added to the various rules shared between jest and vitest. `declare_oxc_lint!` now accepts a path to a shared constant for `short_description`, mirroring how `docs = SHARED_DOCUMENTATION` works. Like `documentation`, the handling is gated behind the `ruledocs` feature. A shared short description is added to `expect-expect`, `no-disabled-tests`, and `valid-expect`. Rules where the wording legitimately differs per framework (e.g. `no-alias-methods`) can keep per-plugin string literals, which remain supported. Or we can opt to add the raw strings on every one of these rules and drop the shared short desc idea, I don't have a strong preference either way. Once we decide and merge this, we can add the short descriptions for all the other remaining shared rules. We'll also need to split up the two remaining rules that are problematic (https://github.com/oxc-project/oxc/issues/23186), then we can expose the `short_description` field in the JSON rules formatter for use on the website's rules list view.
Oxc Macros
Procedural macros for declaring lint rules and other oxc components.
Overview
This crate provides procedural macros that simplify the declaration and implementation of lint rules and other oxc components. These macros reduce boilerplate code and ensure consistent patterns across the codebase.
Key Features
declare_oxc_lint!: Macro for declaring lint rules with metadata- Rule documentation: Auto-generates documentation for website
- Category management: Organize rules into logical categories
- Boilerplate reduction: Eliminates repetitive rule declaration code
Architecture
Macro System
The macros generate:
- Rule struct definitions
- Metadata for documentation generation
- Registration code for the rule system
- Consistent interfaces across all rules
Documentation Generation
Rule documentation is automatically extracted and used to build the oxc website documentation, ensuring that rule descriptions stay in sync with implementation.
Benefits
- Consistency: All rules follow the same declaration pattern
- Documentation: Automatic documentation generation
- Type safety: Compile-time verification of rule metadata
- Maintainability: Centralized rule management
This macro system enables rapid development of new lint rules while maintaining high quality and consistency.