github-url-detection icon indicating copy to clipboard operation
github-url-detection copied to clipboard

POC for JSDoc extraction

Open fregante opened this issue 2 years ago • 2 comments

For https://github.com/refined-github/github-url-detection/issues/146

I found a package that allows extraction of URLs from JSDoc. The issue is that we sometimes have comments around test URLs, which are impractical in JSDoc:

  • while they can be easily filtered out, any deviations from the expected comment position would require future changes to this setup

but mainly:

  • JSDoc are user-facing, but these comments might not make sense outside the source code, e.g.
/** 
 * Some of these are here simply as "gotchas" to other detections
 * @example https://github.com/sindresorhus/refined-github/blame/master/package.json // Gotcha for isRepoTaxonomyIssueOrPRList
 * @example https://github.com/sindresorhus/notifications/
 */

this would show up as the description of the isRepo function, which is not relevant to the final user.

fregante avatar Aug 11 '23 15:08 fregante

The tool also appears to easily allow editing of the files, so I wouldn't exclude going the other way around:

  • leave index.ts as is but add the JSDoc after the transpilation, directly to dist/index.d.ts

fregante avatar Aug 11 '23 15:08 fregante

Really looking forward it. I've researched some typescript AST parsers for this feature and this is really nice.

134130 avatar Aug 14 '23 10:08 134130