Skip to content

refactor: assign rule object to rule variable - #15809

Merged
kgryte merged 4 commits into
developfrom
claude/cool-johnson-e7w3m4
Oct 2, 2026
Merged

kgryte merged 4 commits into
developfrom
claude/cool-johnson-e7w3m4

Conversation

@Planeshifter

Copy link
Copy Markdown
Member

Description

What is the purpose of this pull request?

This pull request:

  • brings four lib/main.js files in @stdlib/_tools/eslint/rules in line with the section layout used by 121 of 125 sibling rules (96.8%). Each exported rule object is unchanged.

The majority layout is: var rule; under // VARIABLES //, function main( context ) under // FUNCTIONS //, rule = { 'meta': ..., 'create': main }; under // MAIN //, and module.exports = rule; under // EXPORTS //.

@stdlib/_tools/eslint/rules/doctest

Removes a duplicate // MAIN // header that came before function main, so main falls under the existing // FUNCTIONS // section. This is a comment-only change.

@stdlib/_tools/eslint/rules/jsdoc-ordered-list-marker-style

Merges function main into the existing // FUNCTIONS // section, declares var rule;, moves the inline module.exports = {...} to rule = {...} under // MAIN //, and exports rule.

@stdlib/_tools/eslint/rules/jsdoc-typedef-typos

Renames the // MAIN // header above function main to // FUNCTIONS // (the file had no FUNCTIONS section), declares var rule;, and replaces the inline export with rule = {...} plus module.exports = rule;.

@stdlib/_tools/eslint/rules/require-last-path-relative

Adds a // VARIABLES // section with var rule;, merges function main into // FUNCTIONS //, and replaces the inline export with rule = {...} plus module.exports = rule;.

Related Issues

Does this pull request have any related issues?

None.

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

Namespace summary. _tools/eslint/rules has 125 member packages, none autogenerated. The run compared:

  • Structural features: file tree, package.json keys, README sections, and test/benchmark/example file names.
  • Semantic features: create signature, return kind, validation prologue, error construction, JSDoc shape, and dependencies.
  • Rule-specific features: meta keys and lib/main.js section layout.

Every feature had a clear majority (≥75%) except how context.report messages are built (plain strings in 93/125 = 74.4%), which was excluded.

Validation.

  • Features were extracted with scripts and with per-package agents.
  • Three independent reviews (semantic, cross-reference, structural) confirmed each change as drift.
  • Each modified lib/main.js passes node --check, and its exported meta/create were checked to be identical before and after.
  • The packages' tests only assert typeof rule === 'object'.

Deliberately excluded.

  • Trailing period in meta.docs.description for first-unit-test and jsdoc-first-heading-level (123/125 have none). Dropped because the fix changes the exported metadata string, which needs a human call.
  • Missing "bin": {} in three package.json files. bin is present in only about 9% of package.json files stdlib-wide, so its absence is not treated as drift.

Open draft #11928 also touches doctest/lib/main.js (a regex at line 51) but does not overlap this change.

Checklist

Please ensure the following tasks are completed before submitting this pull request.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

If you answered "yes" to using AI assistance, please provide a short disclosure indicating how you used AI assistance. This helps reviewers determine how much scrutiny to apply when reviewing your contribution. Example disclosures: "This PR was written primarily by Claude Code." or "I consulted ChatGPT to understand the codebase, but the proposed changes were fully authored manually by myself.".

This PR was written primarily by Claude Code as part of an automated cross-package drift-detection run.


🤖 Generated with Claude Code

https://claude.ai/code/session_01HUvGDqRNYY3PQpcCrs5uBq


Generated by Claude Code

claude added 4 commits October 2, 2026 12:40
…doctest`

Removed the stray `// MAIN //` header preceding `function main`, so the
rule's `create` function falls under the existing `// FUNCTIONS //`
section and `// MAIN //` holds only the rule object (layout used by
121/125 = 96.8% of sibling rules). Comment-only change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HUvGDqRNYY3PQpcCrs5uBq
…es/jsdoc-ordered-list-marker-style`

Moved `function main` under `// FUNCTIONS //`, declared `var rule;`
under `// VARIABLES //`, assigned the rule object under `// MAIN //`,
and exported `rule` (layout used by 121/125 = 96.8% of sibling rules).
The exported rule object is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HUvGDqRNYY3PQpcCrs5uBq
…es/jsdoc-typedef-typos`

Moved `function main` under `// FUNCTIONS //`, declared `var rule;`
under `// VARIABLES //`, assigned the rule object under `// MAIN //`,
and exported `rule` (layout used by 121/125 = 96.8% of sibling rules).
The exported rule object is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HUvGDqRNYY3PQpcCrs5uBq
…es/require-last-path-relative`

Moved `function main` under `// FUNCTIONS //`, declared `var rule;`
under `// VARIABLES //`, assigned the rule object under `// MAIN //`,
and exported `rule` (layout used by 121/125 = 96.8% of sibling rules).
The exported rule object is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HUvGDqRNYY3PQpcCrs5uBq
@stdlib-bot stdlib-bot added the Tools Issue or pull request related to project tooling. label Oct 2, 2026
@kgryte
kgryte marked this pull request as ready for review October 2, 2026 21:13
@kgryte
kgryte requested a review from a team October 2, 2026 21:13
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Oct 2, 2026
@kgryte kgryte changed the title refactor: assign rule object to rule variable in _tools/eslint/rules/{jsdoc-ordered-list-marker-style,jsdoc-typedef-typos,require-last-path-relative} refactor: assign rule object to rule variable Oct 2, 2026
@kgryte
kgryte merged commit 02bd757 into develop Oct 2, 2026
47 checks passed
@kgryte
kgryte deleted the claude/cool-johnson-e7w3m4 branch October 2, 2026 21:14
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Tools Issue or pull request related to project tooling.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants