Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a new tsdoc.json setting "noStandardTags" #279

Merged
merged 4 commits into from
Jan 22, 2021

Conversation

octogonz
Copy link
Collaborator

TSDocConfigFile.loadFromParser() generates a tsdoc.json file from the API object, which can be used to produce a single file that rolls up another tsdoc.json file, plus its "extends" references, plus the predefined standard tags for the current TSDoc version. This is useful for serializing the exact TSDoc configuration for later usage.

However, normally tsdoc.json files are loaded with a set of predefined standard tags, which would conflict with the serialized copy of those definitions. This PR solves that problem by adding a "noStandardTags" that instructs the loader not to predefine any tags.

It might also be useful for a custom tsdoc.json configuration that wants to be substantially different from the standard tags. Or for example, if we wanted to publish tsdoc.json config files that represent previous versions of the TSDoc standard. So this feature can be generally useful.

Design note

I initially approached this by moving the standard definitions into a standard-tsdoc.json file (rather than having them declared in code). The idea was that a custom tsdoc.json file would always have a line like this:

  "extends": ["@microsoft/tsdoc/includes/standard-tsdoc.json"],

This seemed elegant, because the predefined values are now in a nice JSON file, and their existence is explicitly specified using the familiar "extends" mechanism. But I realized that it would be clunky in practice:

  • Every project that has a tsdoc.json file must now have a direct dependency on the @microsoft/tsdoc package
  • Its version needs to be coordinated the indirect dependency from your documentation tool
  • 99% of developers will always want the defaults, so opting out is more convenient than opting in

…re that the TSDocConfigFile.saveFile() output does not conflict with predefined tags
@octogonz octogonz requested a review from iclanton as a code owner January 22, 2021 06:15
@octogonz octogonz merged commit f18225c into master Jan 22, 2021
@octogonz octogonz deleted the octogonz/no-standard-tags branch January 22, 2021 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant