scottohara / tvmanager

PWA for tracking recorded, watched & upcoming TV shows
MIT License
4 stars 0 forks source link

Review use of JSDoc #81

Closed scottohara closed 2 years ago

scottohara commented 6 years ago

With the switch to Typescript, arguably the value of JSDoc comments has reduced slightly. (parameter/return types are now explicit in the function signature itself, and therefore the risk of forgetting to update the comment when the function sig changes is removed).

There is potentially still value in documenting parameter descriptions or usage, however; as well as being able to generate external, standalone API docs.

During the TS conversion, we purposely didn't update JSDoc comments (because we weren't sure if the effort would be wasted, if we later removed them entirely); so it is possible/likely that some comments no longer accurately reflect reality.

Need to decide if we:

  1. Remove JSDoc comments entirely (and rely only on TS type annotations)
  2. Review/update JSDoc comments (JSDoc support in Typescript)
  3. Switch to something else such as TypeDoc

(see also: older discussion of issues with JSDoc3 https://github.com/scottohara/tvmanager/issues/34)

scottohara commented 4 years ago

By default, JSDoc only looks for *.js files. When running npm run docs, the error There are no input files to process. is thrown.

Tried setting includePattern: ".+\\.(t|j)s$", in jsdoc.json to get it to recognise *.ts files, but that reports numerous errors, e.g.

ERROR: Unable to parse /Users/scotto/GitHub/tvmanager/src/components/index.d.ts: This experimental syntax requires enabling one of the following parser plugin(s): 'flow, typescript' (10:7)
ERROR: Unable to parse /Users/scotto/GitHub/tvmanager/src/components/list.ts: Unexpected token (39:9)
ERROR: Unable to parse /Users/scotto/GitHub/tvmanager/src/components/progressbar.ts: Unexpected token (25:9)
ERROR: Unable to parse /Users/scotto/GitHub/tvmanager/src/components/toucheventproxy.ts: Unexpected token (22:8)

It looks like we may need to use something like jsdoc-plugin-typescript if we wish to continue using JSDoc.