microsoft / tsdoc

A doc comment standard for TypeScript
https://tsdoc.org/
MIT License
4.7k stars 130 forks source link

ESlint plugin: The TSDoc tag "@notExported" is not recognized #298

Closed crystalfp closed 2 years ago

crystalfp commented 3 years ago

I have installed TypeDoc and its plugin typedoc-plugin-not-exported that adds a new tag @notExported. Running ESlint with eslint-plugin-tsdoc rightly complains that @notExported tag is not defined: tsdoc-undefined-tag: The TSDoc tag "@notExported" is not defined in this configuration (tsdoc/syntax) Is there any mechanism to make the eslint-plugin-tsdoc ignore this or generally a set of tags? Thanks! mario

AlexRogalskiy commented 2 years ago

You should add tsdoc.json file to the directory that contains tsconfig.json file. Inside tsdoc.json file you should add the following json document with corresponding tag name @notExported:

{
    "$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
    "tagDefinitions": [
        {
            "tagName": "@author",
            "syntaxKind": "block"
        },
        {
            "tagName": "@description",
            "syntaxKind": "block"
        },
        {
            "tagName": "@implements",
            "syntaxKind": "modifier"
        }
    ],
    "supportForTags": {
        "@author": true,
        "@description": true,
        "@implements": true
    }
}

more information can be found at

https://api-extractor.com/pages/configs/tsdoc_json/

crystalfp commented 2 years ago

Yes, this solved the problem of not recognized tags, but now eslint-plugin-tsdoc complains that tsdoc-unsupported-tag: The TSDoc tag "@param" is not supported by this tool (tsdoc/syntax) at ... idem for tsdoc-unsupported-tag: The TSDoc tag "@returns" is not supported by this tool (tsdoc/syntax). But if I add @returns to tsdoc.json it complains that the tag is already defined. The only difference in eslint.yaml is the absence of the sourceType: "module" option because this is a legacy project. So really don't know how to use effectively this plugin. Thanks for looking! mario

crystalfp commented 2 years ago

Solved.

You need to add "@param": true, "@returns": true to the "supportForTags" section of the configuration file tsdoc.json.

Anyway, this sounds like a bug to me. The tsdoc file should supplement the standard behavior, not interfere.

Thanks!