Skip to content

chore(linter): declare_oxc_lint! accept docs from a const#18603

Open
Sysix wants to merge 1 commit intomainfrom
01-26-chore_linter_declare_oxc_lint_accept_docs_from_a_const
Open

chore(linter): declare_oxc_lint! accept docs from a const#18603
Sysix wants to merge 1 commit intomainfrom
01-26-chore_linter_declare_oxc_lint_accept_docs_from_a_const

Conversation

@Sysix
Copy link
Copy Markdown
Member

@Sysix Sysix commented Jan 26, 2026

Updates the declare_oxc_lint! proc-macro parser/codegen to support sourcing rule documentation from a shared constant (via a docs = path::TO_CONST option) in addition to inline doc comments.

@github-actions github-actions bot added the C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior label Jan 26, 2026
Copy link
Copy Markdown
Member Author

Sysix commented Jan 26, 2026


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent changes, fast-track this PR to the front of the merge queue

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@Sysix Sysix force-pushed the 01-26-chore_linter_declare_oxc_lint_accept_docs_from_a_const branch 2 times, most recently from 7448224 to 16da109 Compare January 26, 2026 21:36
@Sysix Sysix requested a review from Copilot January 26, 2026 22:45
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the declare_oxc_lint! proc-macro parser/codegen to support sourcing rule documentation from a shared constant (via a docs = path::TO_CONST option) in addition to inline doc comments.

Changes:

  • Introduces a DocumentationSource enum to represent inline docs vs. a referenced constant path.
  • Extends macro argument parsing with a docs = ... option and improves unknown-key handling by returning syn::Error instead of panicking.
  • Adjusts generated RuleMeta::documentation() to emit docs based on the selected documentation source.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Sysix Sysix force-pushed the 01-26-chore_linter_declare_oxc_lint_accept_docs_from_a_const branch from 16da109 to b26c547 Compare January 27, 2026 15:29
@Sysix Sysix marked this pull request as ready for review January 27, 2026 15:38
@Sysix Sysix added the A-linter Area - Linter label Jan 27, 2026
@Sysix
Copy link
Copy Markdown
Member Author

Sysix commented Feb 15, 2026

@camc314 any thoughts about this solution? Would wait for your approval before restacking and continue the work

@camc314
Copy link
Copy Markdown
Contributor

camc314 commented Feb 16, 2026

Yeah this approach looks good - I think the name "shared" might be a little to ambiguous - maybe we want something to indicate that it's shared between the two vitest/jest plugins?

@Sysix Sysix force-pushed the 01-26-chore_linter_declare_oxc_lint_accept_docs_from_a_const branch from b26c547 to fa08031 Compare March 6, 2026 14:18
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Mar 6, 2026

Merging this PR will not alter performance

✅ 4 untouched benchmarks
⏩ 52 skipped benchmarks1


Comparing 01-26-chore_linter_declare_oxc_lint_accept_docs_from_a_const (330758b) with main (5c104ff)2

Open in CodSpeed

Footnotes

  1. 52 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on main (b82d37c) during the generation of this report, so 5c104ff was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@Sysix
Copy link
Copy Markdown
Member Author

Sysix commented Mar 6, 2026

I think the name "shared" might be a little to ambiguous

The goal is to share other plugins rule like no-negated-condition and unicorn/no-negated-condition.
https://github.com/oxc-project/oxlint-migrate/blob/main/scripts/constants.ts#L17

They have only one different default option.

Updated the branch, checking for the others PRs (broken because of conflicts)

@Sysix
Copy link
Copy Markdown
Member Author

Sysix commented Mar 16, 2026

@camc314 After a test migration of a project, I found #18975 which would help us to split the logic for valid-expect with (second?) configuration.
Would love to see a movement here :)

@Sysix Sysix force-pushed the 01-26-chore_linter_declare_oxc_lint_accept_docs_from_a_const branch from fa08031 to 330758b Compare March 16, 2026 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-linter Area - Linter C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants