reporters.ts docstring claims a 'fileExtension' static and a 'create(basePath)' factory that no reporter implements

Open Beginner friendly
#72 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
88/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Quiet
Tech stack
typescript
Domain
documentation

Research direction

Start in src/reporters.ts by reading the Reporter interface docstring, reporterConstructors map, and the YamlReporter and JsonlReporter implementations. Update the documentation so it matches the registered factory shape and does not claim an unused fileExtension; confirm the documented statics align with both reference reporters.

Written by the indexing model from the issue text.

Description

bug S4

Observed behavior

The Reporter interface docstring in src/reporters.ts tells extension authors to add three statics:

/**
 * To create a custom reporter:
 *
 * 1. Create a class that implements this interface.
 * 2. Add a static `reporterName` string, a static `fileExtension` string,
 *    and a static async `create(basePath)` factory method.
 * 3. Register it in the `reporterConstructors` map in this file.
 *
 * See `YamlReporter` and `JsonlReporter` for reference implementations.
 */

Neither reference reporter follows that recipe:

  • YamlReporter and JsonlReporter only define reporterName; there is no fileExtension static, and the runtime never reads one.
  • create takes a ReporterConfig ({ outputDir, jobName }), not a basePath string. The file extension is hard-coded inside each create (-report.yaml, -report.jsonl).

A third-party author following the docstring will write code that compiles but is inconsistent with the registered shape, and they will not understand where the supposed fileExtension is consumed.

Expected behavior

The docstring should describe the shape that reporterConstructors actually expects:

  • A static reporterName: string
  • A static create(config: ReporterConfig): Promise<Reporter> factory

Either remove the fileExtension mention or actually introduce the field (for example to drive a default filename in createReporter).

Suggested fix

Update the JSDoc in src/reporters.ts to:

2. Add a static `reporterName` string and a static async
   `create(config: ReporterConfig)` factory method.

If fileExtension is wanted as part of the contract, introduce it on YamlReporter and JsonlReporter and have create use it when constructing the report path; otherwise drop it from the docstring.

Dominant language
TypeScript
Stars
2
Forks
1
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from joewalker/loop-the-loop

All issues in joewalker/loop-the-loop

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.