kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

Enforce JSDoc comment standards via eslint-plugin-jsdoc

Open rtibbles opened this issue 7 months ago • 3 comments

❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Overview

Enable eslint-plugin-jsdoc in packages/kolibri-format/eslint.config.mjs to lint JSDoc comments across .js and .vue files, and remediate the pre-existing violations. Uses the flat/recommended-error preset as the base, plus a curated set of opt-in rules covering blank-block hygiene, description quality, tag ordering, and @throws coverage. Includes a minor version bump of kolibri-format.

Complexity: High Target branch: develop

Context

Kolibri has ~3,100 JSDoc blocks across ~286 frontend files but no JSDoc-specific linting today. As a result, quality varies: blocks with empty descriptions, descriptions that only repeat the symbol name, inconsistent tag ordering, and missing @throws are all present.

kolibri-format (the shared ESLint config at packages/kolibri-format/eslint.config.mjs) is the correct place to add the plugin so both the Kolibri repo and external consumers get the rules. The rules should apply to both .js and .vue files.

The Change

Add eslint-plugin-jsdoc as a dev dependency of kolibri-format and register it in packages/kolibri-format/eslint.config.mjs:

  • Extend jsdoc.configs['flat/recommended-error'] as the base.
  • Enable the following opt-in rules as errors:
    • jsdoc/no-blank-blocks
    • jsdoc/no-blank-block-descriptions
    • jsdoc/informative-docs
    • jsdoc/sort-tags
    • jsdoc/require-description
    • jsdoc/require-description-complete-sentence
    • jsdoc/require-hyphen-before-param-description
    • jsdoc/require-throws

Apply the rules to both .js and .vue files.

Remediate the resulting violations across the Kolibri codebase. Where a JSDoc block is trivially wrong (empty, name-echoing), prefer deleting it over padding it to satisfy the rule.

Bump kolibri-format to a new minor version.

How to Get There

After wiring the plugin and rules, run:

pnpm run lint-frontend:format

Many eslint-plugin-jsdoc rules have autofixers (sort-tags, hyphen-before-param-description, description-complete-sentence in some cases). Remaining violations need manual editing or JSDoc block deletion.

Out of Scope

  • jsdoc/require-jsdoc — does not mandate JSDoc on every function/class; that's a separate, much larger effort.
  • Other JSDoc rules not listed above (require-example, require-file-overview, check-examples, TypeScript-flavor rules).
  • Authoring new JSDoc for code that currently has none. Remediation fixes or removes existing blocks only.

Acceptance Criteria

  • [ ] eslint-plugin-jsdoc is added as a dependency of kolibri-format
  • [ ] jsdoc.configs['flat/recommended-error'] is registered as the base preset in packages/kolibri-format/eslint.config.mjs
  • [ ] The opt-in rules listed in The Change are enabled as errors: no-blank-blocks, no-blank-block-descriptions, informative-docs, sort-tags, require-description, require-description-complete-sentence, require-hyphen-before-param-description, require-throws
  • [ ] Rules apply to both .js and .vue files
  • [ ] pnpm run lint-frontend passes with no new violations across the repo
  • [ ] kolibri-format has a minor version bump in its package.json
  • [ ] pnpm-lock.yaml is updated for the version bump

References

AI usage

Used Claude Code to draft this issue iteratively. I provided direction on scope and reviewed each section before it was committed. Claude scanned the codebase to gauge existing JSDoc volume (~3,100 blocks across ~286 files) and grouped the plugin's opt-in rules by remediation cost so I could pick a curated set.

rtibbles avatar Apr 22 '26 21:04 rtibbles

Plan: Add eslint-plugin-jsdoc to kolibri-format, configure 8 opt-in rules on top of flat/recommended-error, and remediate every resulting violation across the Kolibri codebase.

  • [ ] Add eslint-plugin-jsdoc to kolibri-format and configure it
  • [ ] Apply ESLint auto-fixes for jsdoc rules
  • [ ] Confirm clean lint pass

status


@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly

How was this generated?
  • Implemented code following the pre-approved plan using test-driven development (red-green-refactor)
  • Ran the project's full test suite and linter before committing
  • For UI changes: captured live screenshots to verify rendering
  • For backend changes: verified with example API/CLI output

rtibblesbot avatar Apr 22 '26 22:04 rtibblesbot

I was unable to complete this task after multiple attempts. Manual review and intervention may be needed.

rtibblesbot avatar Apr 23 '26 01:04 rtibblesbot

  1. Is the local work already superseded by the remote, and nothing needs to be done?

@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly

How was this generated?
  • Implemented code following the pre-approved plan using test-driven development (red-green-refactor)
  • Ran the project's full test suite and linter before committing
  • For UI changes: captured live screenshots to verify rendering
  • For backend changes: verified with example API/CLI output

rtibblesbot avatar Apr 24 '26 21:04 rtibblesbot