Repository navigation
feat: read tsdoc.json and check TSDoc's grammar - #40
Open
botandbang wants to merge 5 commits into
Open
botandbang wants to merge 5 commits into
botandbang wants to merge 5 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
docov now reads a project's tsdoc.json and checks doc comments against TSDoc's grammar, reporting what
@microsoft/tsdocreports, with the same message ids and texts, so findings line up witheslint-plugin-tsdoc.Added: a
tsdocConfigkey and--tsdoc-configflag (src/feature/tsdoc_config.rs). With"syntax": "tsdoc"and neither set, each file is read with the tsdoc.json@microsoft/tsdoc-configwould find for it: the one in the nearest folder above the file with a tsconfig.json or a package.json. A tsdoc.json can extend files by path or package name, resolved withoxc_resolver, and docov readsnoStandardTags,tagDefinitions,supportForTags,supportedHtmlElementsandreportUnsupportedHtmlElementsthe way tsdoc-config sets up the parser. Unknown keys and other mistakes exit 2 with TSDoc'stsdoc-config-*ids.Added: src/tsdoc/, a Rust port of
@microsoft/tsdoc's parser that keeps its messages and positions and skips the node tree. Running the package through Node would have made the cargo install and the language server depend on Node, and nothing on crates.io parses TSDoc's grammar.Added: seven doc checks, one per part of the grammar:
tsdoc-tags(undefined, unsupported or misused tags,@deprecatedwithout a message,{@inheritDoc}rules, plus two docov-only findings TSDoc has no check for: a tag repeated withoutallowMultipleand text after a modifier tag),tsdoc-params,tsdoc-inline-tags,tsdoc-escapes,tsdoc-code,tsdoc-htmlandtsdoc-links. The tsdoc.json lookup runs only when one of them is on.Added: tools/tsdoc-oracle.sh and tests/fixtures/tsdoc/corpus.json. The script runs
@microsoft/tsdoc0.17.1 over 260 comments, 75 of them from its own parser tests, and records what it finds. A unit test and a Hegel property check docov against that file, along with properties for tsdoc.json loading and errors, the per-file lookup through the CLI, and the two docov-only findings. There are also failing and passing examples under tests/fixtures/checks/ for the generated check docs.Changed:
@remarks {@inheritDoc}in tests/fixtures/tsdoc/parser.ts became{@inheritDoc}, since TSDoc rejects@remarksnext to{@inheritDoc}. The collect unit tests' helper leaves out thetsdoc-*checks, which have their own tests. The README lists the new checks, and docov.schema.json describes the key and the checks.Closes #37