Skip to content

ESLint for TSDoc#40

Merged
michaelahern merged 3 commits intomainfrom
eslint-tsdoc
Apr 3, 2026
Merged

ESLint for TSDoc#40
michaelahern merged 3 commits intomainfrom
eslint-tsdoc

Conversation

@michaelahern
Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings April 3, 2026 17:44
Copy link
Copy Markdown

@amazon-q-developer amazon-q-developer bot left a comment

Choose a reason for hiding this comment

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

This PR successfully adds ESLint support for TSDoc by integrating eslint-plugin-jsdoc and reformatting documentation comments to comply with TSDoc standards. The changes include proper configuration in ESLint, dependency updates, and documentation improvements throughout the codebase. All changes are working correctly with no defects identified that would block merge.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

Copy link
Copy Markdown

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 adds ESLint-based validation for TSDoc/JSDoc comments in the TypeScript sources to improve documentation consistency, and updates existing docblocks to comply with the new rules.

Changes:

  • Add eslint-plugin-jsdoc as a dev dependency and enable its flat/recommended-tsdoc config for *.ts files.
  • Update WattBoxClient method docblocks to be more TSDoc-compliant (remove stray blank tag lines, add missing @returns, remove incorrect @param).
  • Add an entry-point docblock to the example script.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/example.ts Adds a top-level docblock describing required environment variables and program purpose.
src/client.ts Adjusts TSDoc blocks across client methods (formatting, @returns, and tag cleanup).
eslint.config.js Enables eslint-plugin-jsdoc’s flat recommended TSDoc rules for TypeScript files.
package.json Adds eslint-plugin-jsdoc to devDependencies.
package-lock.json Locks new transitive dependencies introduced by eslint-plugin-jsdoc.

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

Comment thread src/client.ts Outdated
Comment thread package.json
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 3, 2026 17:47
@michaelahern michaelahern merged commit 5e79c9a into main Apr 3, 2026
6 checks passed
@michaelahern michaelahern deleted the eslint-tsdoc branch April 3, 2026 17:49
Copy link
Copy Markdown

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

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (5)

src/client.ts:146

  • The new @returns description doesn’t match the implementation: this method can return an empty string when the response doesn’t match. Consider documenting the empty-string fallback (or throwing/returning null instead) to avoid misleading API docs.
    /**
     * Get the hostname of the WattBox.
     * @remarks
     * Protocol Command: ?Hostname
     * @returns The hostname of the WattBox
     * @throws {@link WattBoxError}
     */
    public async getHostname(): Promise<string> {
        const response = await this.#handleRequestMessage('?Hostname');

src/client.ts:159

  • The new @returns text says it returns a model number string, but the implementation falls back to '' if parsing fails. Please document the empty-string fallback (or adjust the implementation) so generated docs remain accurate.
    /**
     * Get the model number of the WattBox.
     * @remarks
     * Protocol Command: ?Model
     * @returns The model number string
     * @throws {@link WattBoxError}
     */
    public async getModel(): Promise<string> {
        const response = await this.#handleRequestMessage('?Model');

src/client.ts:172

  • The new @returns text implies a real outlet count is always returned, but the implementation falls back to 0 if parsing fails. Please document that 0 may mean “unavailable/parse failure” (or change the behavior to throw/return null) so callers can interpret results correctly.
    /**
     * Get the number of outlets on the WattBox.
     * @remarks
     * Protocol Command: ?OutletCount
     * @returns The number of outlets
     * @throws {@link WattBoxError}
     */
    public async getOutletCount(): Promise<number> {
        const response = await this.#handleRequestMessage('?OutletCount');

src/client.ts:185

  • The new @returns text doesn’t mention that this method can return an empty array when parsing fails. Please document that fallback (or adjust the behavior) to keep docs accurate for consumers.
    /**
     * Get the names of all outlets on the WattBox.
     * @remarks
     * Protocol Command: ?OutletName
     * @returns An array of outlet names
     * @throws {@link WattBoxError}
     */
    public async getOutletNames(): Promise<string[]> {
        const response = await this.#handleRequestMessage('?OutletName');

src/client.ts:263

  • The new @returns description says a service tag string is returned, but the implementation can return '' if parsing fails. Please document the empty-string fallback (or change the behavior) so API docs align with runtime behavior.
    /**
     * Get the service tag of the WattBox.
     * @remarks
     * Protocol Command: ?ServiceTag
     * @returns The service tag string
     * @throws {@link WattBoxError}
     */
    public async getServiceTag(): Promise<string> {
        const response = await this.#handleRequestMessage('?ServiceTag');

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

Comment thread package.json
Comment on lines 44 to 49
"@stylistic/eslint-plugin": "^5",
"@types/node": "^22",
"eslint": "^10",
"eslint-plugin-jsdoc": "^62",
"eslint-plugin-jsonc": "^3",
"eslint-plugin-yml": "^3",
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

eslint-plugin-jsdoc@62.9.0 (added here) requires Node ^20.19.0 || ^22.13.0 || >=24 per the lockfile, but this repo declares engines.node as >=22. This can break installs on Node 22.0–22.12; either bump the repo engine requirement (e.g., to >=22.13.0) or pin/choose a plugin version that supports the currently declared range.

Copilot uses AI. Check for mistakes.
Comment thread src/client.ts
* @remarks
* Protocol Command: ?Firmware
*
* @returns The firmware version string
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

The new @returns description is incomplete vs the implementation: this method returns an empty string when the response doesn’t match, not always a firmware version. Update the @returns text (or behavior) so the docs reflect possible '' results.

Suggested change
* @returns The firmware version string
* @returns The firmware version string, or an empty string if the response does not match the expected format

Copilot uses AI. Check for mistakes.
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