diff --git a/CHANGELOG.md b/CHANGELOG.md index de944cd95..fdd51c628 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Unreleased +### Features + +- Improved Korean translation coverage, #2602 + +### Bug Fixes + +- Added `@author` to the default list of recognized tags, #2603. + +### Thanks! + +- @KNU-K + # v0.26.0 (2024-06-22) ### Breaking Changes diff --git a/src/lib/utils/options/tsdoc-defaults.ts b/src/lib/utils/options/tsdoc-defaults.ts index 5371c4902..41ec3ce16 100644 --- a/src/lib/utils/options/tsdoc-defaults.ts +++ b/src/lib/utils/options/tsdoc-defaults.ts @@ -15,27 +15,26 @@ export const tsdocBlockTags = [ export const blockTags = [ ...tsdocBlockTags, + "@author", + "@callback", "@category", "@categoryDescription", "@default", "@document", "@group", "@groupDescription", + "@import", "@inheritDoc", + "@jsx", "@license", "@module", - "@return", - // Alias for @typeParam - "@template", - // Because TypeScript is important! - "@type", - "@typedef", - "@callback", "@prop", "@property", + "@return", "@satisfies", - "@import", - "@jsx", + "@template", // Alias for @typeParam + "@type", // Because TypeScript is important! + "@typedef", ] as const; export const tsdocInlineTags = ["@link", "@inheritDoc", "@label"] as const; @@ -53,8 +52,6 @@ export const tsdocModifierTags = [ "@internal", "@override", "@packageDocumentation", - "@private", - "@protected", "@public", "@readonly", "@sealed", @@ -68,12 +65,14 @@ export const modifierTags = [ "@event", "@hidden", "@hideCategories", + "@hideconstructor", "@hideGroups", "@ignore", "@interface", "@namespace", "@overload", + "@private", + "@protected", "@showCategories", "@showGroups", - "@hideconstructor", ] as const; diff --git a/src/test/converter2/issues/gh2603.ts b/src/test/converter2/issues/gh2603.ts new file mode 100644 index 000000000..c12406c6a --- /dev/null +++ b/src/test/converter2/issues/gh2603.ts @@ -0,0 +1,4 @@ +/** + * @author Ian Awesome + */ +export const x = 1; diff --git a/src/test/issues.c2.test.ts b/src/test/issues.c2.test.ts index dc1f9ca00..81f579a80 100644 --- a/src/test/issues.c2.test.ts +++ b/src/test/issues.c2.test.ts @@ -1578,4 +1578,15 @@ describe("Issue Tests", () => { "Shorthand comment", ); }); + + it("#2603 handles @author tag", () => { + const project = convert(); + const x = query(project, "x"); + equal( + x.comment?.getTag("@author"), + new CommentTag("@author", [{ kind: "text", text: "Ian Awesome" }]), + ); + + logger.expectNoOtherMessages(); + }); }); diff --git a/src/test/utils/options/tsdoc-defaults.test.ts b/src/test/utils/options/tsdoc-defaults.test.ts new file mode 100644 index 000000000..7d636a0bb --- /dev/null +++ b/src/test/utils/options/tsdoc-defaults.test.ts @@ -0,0 +1,61 @@ +import { deepEqual as equal } from "assert/strict"; +import { join } from "path"; +import ts from "typescript"; +import * as defaults from "../../../lib/utils/options/tsdoc-defaults"; + +describe("tsdoc-defaults.ts", () => { + const tsdoc = ts.readConfigFile( + join(__dirname, "../../../../tsdoc.json"), + ts.sys.readFile, + ); + const tagDefinitions = tsdoc.config?.tagDefinitions as Array<{ + tagName: string; + syntaxKind: "block" | "modifier" | "inline"; + }>; + + function tagsByKind(kind: "block" | "modifier" | "inline") { + return tagDefinitions + .filter((t) => t.syntaxKind === kind) + .map((t) => t.tagName) + .sort((a, b) => a.localeCompare(b)); + } + + before(() => { + equal(tsdoc.error, undefined); + }); + + it("Should expose the same block tags as the tsdoc.json file", () => { + const tsdocTags = tagsByKind("block"); + + const typedocTags = defaults.blockTags + .filter((t) => !defaults.tsdocBlockTags.includes(t as never)) + .sort((a, b) => a.localeCompare(b)); + + // @inheritDoc is a special case. We can't specify it in the tsdoc.json + // or the official parser blows up, because it thinks that it is only + // an inline tag. + typedocTags.splice(typedocTags.indexOf("@inheritDoc"), 1); + + equal(tsdocTags, typedocTags); + }); + + it("Should expose the same modifier tags as the tsdoc.json file", () => { + const tsdocTags = tagsByKind("modifier"); + + const typedocTags = defaults.modifierTags + .filter((t) => !defaults.tsdocModifierTags.includes(t as never)) + .sort((a, b) => a.localeCompare(b)); + + equal(tsdocTags, typedocTags); + }); + + it("Should expose the same inline tags as the tsdoc.json file", () => { + const tsdocTags = tagsByKind("inline"); + + const typedocTags = defaults.inlineTags + .filter((t) => !defaults.tsdocInlineTags.includes(t as never)) + .sort((a, b) => a.localeCompare(b)); + + equal(tsdocTags, typedocTags); + }); +}); diff --git a/tsdoc.json b/tsdoc.json index ad39316da..2177d5561 100644 --- a/tsdoc.json +++ b/tsdoc.json @@ -3,10 +3,18 @@ // If updating this, also update tsdoc-defaults.ts "noStandardTags": false, "tagDefinitions": [ + { + "tagName": "@author", + "syntaxKind": "block" + }, { "tagName": "@module", "syntaxKind": "block" }, + { + "tagName": "@type", + "syntaxKind": "block" + }, { "tagName": "@typedef", "syntaxKind": "block" @@ -92,7 +100,7 @@ }, { "tagName": "@linkplain", - "syntaxKind": "block", + "syntaxKind": "inline", "allowMultiple": true }, {