Skip to content

Conversation

@boneskull
Copy link
Owner

@boneskull boneskull commented Jan 6, 2026

(this is for typedoc)

Copilot AI review requested due to automatic review settings January 6, 2026 22:51
Copy link
Owner Author

boneskull commented Jan 6, 2026

Copy link

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

This PR introduces a standardized documentation practice by adding @function tags to all arrow functions throughout the codebase. The change includes a custom ESLint rule to enforce this convention going forward, ensuring consistency in JSDoc comments for arrow functions.

  • Added a new custom ESLint rule to require @function tags in JSDoc comments for named arrow functions
  • Applied @function tags to all existing arrow functions across source files, tests, and configuration
  • Updated cspell configuration to recognize new terminology

Reviewed changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
.config/require-function-tag-in-arrow-functions.js New custom ESLint rule implementation to enforce @function tags in arrow function JSDoc comments
eslint.config.js Configured the new custom rule with options to require tags for named functions
src/bargs.ts Added @function tags to arrow functions including transform composition helpers
src/help.ts Added @function tags to utility functions for help generation
src/osc.ts Added @function tags to terminal hyperlink support functions
src/opt.ts Added @function tags to option and positional builder functions
src/parser.ts Added @function tags to parsing and coercion functions
src/theme.ts Added @function tags to theme and styling utility functions
src/validate.ts Added @function tags to validation and type guard functions
src/version.ts Added @function tags to version detection and package.json utilities
test/bargs.test.ts Added @function tags to test helper functions
cspell.json Updated spelling dictionary with "TSES" and moved "ghostty" to ignoreWords

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

Comment on lines +16 to +36
/**
* ESLint rule to require `@function` tag in JSDoc comments for arrow functions
*
* This rule enforces the presence of `@function` tags in JSDoc comments for
* arrow functions to improve code documentation and maintain consistency with
* the project's documentation standards.
*
* The rule supports:
*
* - Named arrow functions (`const foo = () => {}`)
* - Arrow functions in object properties (`{ method: () => {} }`)
* - Arrow functions in assignments (`obj.method = () => {}`)
* - Export declarations (`export const foo = () => {}`)
*
* Configuration options:
*
* - `requireForNamed`: Whether to require `@function` tags for named arrow
* functions (default: `true`)
* - `requireForAnonymous`: Whether to require `@function` tags for anonymous
* arrow functions (default: `false`)
*/
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

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

The documentation comment on lines 16-36 duplicates the comment at lines 1-5. The first comment is a package documentation comment, while the second one appears to be describing the same thing. This duplication creates unnecessary redundancy.

Suggested change
/**
* ESLint rule to require `@function` tag in JSDoc comments for arrow functions
*
* This rule enforces the presence of `@function` tags in JSDoc comments for
* arrow functions to improve code documentation and maintain consistency with
* the project's documentation standards.
*
* The rule supports:
*
* - Named arrow functions (`const foo = () => {}`)
* - Arrow functions in object properties (`{ method: () => {} }`)
* - Arrow functions in assignments (`obj.method = () => {}`)
* - Export declarations (`export const foo = () => {}`)
*
* Configuration options:
*
* - `requireForNamed`: Whether to require `@function` tags for named arrow
* functions (default: `true`)
* - `requireForAnonymous`: Whether to require `@function` tags for anonymous
* arrow functions (default: `false`)
*/

Copilot uses AI. Check for mistakes.
Comment on lines +103 to +109
if (
parent?.type === AST_NODE_TYPES.VariableDeclarator &&
parent.parent?.parent?.type === AST_NODE_TYPES.ExportNamedDeclaration
) {
return true;
}

Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

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

The shouldRequireTag function checks for exported variables in lines 103-108, but this condition is redundant. Lines 85-90 already check for VariableDeclarator with an identifier. The export check at lines 103-108 will never be reached because if the parent is a VariableDeclarator, the function returns true at line 89 before reaching line 103.

Suggested change
if (
parent?.type === AST_NODE_TYPES.VariableDeclarator &&
parent.parent?.parent?.type === AST_NODE_TYPES.ExportNamedDeclaration
) {
return true;
}

Copilot uses AI. Check for mistakes.
"frickin"
"frickin",
"TSES",
"ghostty"
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

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

The word "ghostty" is being moved from the "words" array to the "ignoreWords" array. According to cspell semantics, "words" are considered valid dictionary words while "ignoreWords" are words that should be ignored but not necessarily considered valid. If "ghostty" is a legitimate term (e.g., a terminal emulator name), it should remain in "words" rather than being moved to "ignoreWords".

Copilot uses AI. Check for mistakes.
@boneskull boneskull merged commit 380667a into main Jan 6, 2026
7 checks passed
@boneskull boneskull deleted the function-tags branch January 6, 2026 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants