microsoft / microsoft/tsdoc

Support for defining custom tag syntax

Open
#366 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
5k
Forks
162
Avg merge
17h 24m
Merged PRs (30d)
8

Description

Example:

I want to use supported JSDoc tags with @custom-elements-manifest/analyzer:

/**
 * @prop {string} dir - The directionality of the element.
 * @prop {string} lang - The language of the element.
 */

Problem:

There is no way to define custom tags that support this format.

// tsdoc.json
{
  "$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
  "extends": ["@microsoft/api-extractor/extends/tsdoc-base.json"],
  "tagDefinitions": [
    {
      "tagName": "@prop",
      "syntaxKind": "modifier",
      "allowMultiple": true
    }
  ],
  "supportForTags": {
    "@prop": true
  }
}

ESLint will not pass.

Proposal:

Support custom tag syntax, perhaps through regex. Further, it would be nice if you could omit specifying the syntax kind, such that the parser would allow the content following the tag to be whatever.

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.

Research direction

Start by reading the TSDoc tagDefinitions and supportForTags configuration shown in the issue, then trace how the parser handles syntaxKind and tag content. Done means a custom @prop tag can accept the demonstrated JSDoc format, including repeated tags and following content, while ESLint passes.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
documentation
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.