Skip to content

Commit ebdb3a4

Browse files
authored
Merge pull request #206 from rbuckton/flexibleParamParsing
Flexible parsing of param/typeParam
2 parents ae89481 + 42fffce commit ebdb3a4

File tree

8 files changed

+1689
-31
lines changed

8 files changed

+1689
-31
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@microsoft/tsdoc",
5+
"comment": "Improve the parsing of `@param` and `@typeParam` tags to recognize legacy syntaxes",
6+
"type": "patch"
7+
}
8+
],
9+
"packageName": "@microsoft/tsdoc",
10+
"email": "ron.buckton@microsoft.com"
11+
}

tsdoc/.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
registry=https://registry.npmjs.org/
22
always-auth=false
3+
package-lock=false

tsdoc/.vscode/launch.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@
1818
"request": "launch",
1919
"name": "Jest Current File",
2020
"program": "${workspaceFolder}/node_modules/jest/bin/jest",
21-
"args": ["${relativeFile}"],
21+
"args": [
22+
"--runInBand",
23+
"--testPathPattern",
24+
"${fileBasename}"
25+
],
2226
"console": "integratedTerminal",
2327
"internalConsoleOptions": "neverOpen"
2428
}

tsdoc/src/__tests__/ParsingBasics.test.ts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,50 @@ test('04 typeParam blocks', () => {
111111
' */'
112112
].join('\n'));
113113
});
114+
115+
test('05 Invalid JSDoc syntax in @param blocks', () => {
116+
TestHelpers.parseAndMatchDocCommentSnapshot([
117+
'/**',
118+
' * @param {type} a - description',
119+
' * @param {{}} b - description',
120+
' * @param {"{"} c - description',
121+
' * @param {"\\""} d - description',
122+
' * @param e {type} - description',
123+
' * @param f {{}} - description',
124+
' * @param g {"{"} - description',
125+
' * @param h - {type} description',
126+
' * @param i - {{}} description',
127+
' * @param j - {"{"} description',
128+
' * @param [k] - description',
129+
' * @param [l=] - description',
130+
' * @param [m=[]] - description',
131+
' * @param [n="["] - description',
132+
' * @param [o="\\""] - description',
133+
' */'
134+
].join('\n'));
135+
});
136+
137+
test('06 Invalid JSDoc optional name', () => {
138+
TestHelpers.parseAndMatchDocCommentSnapshot([
139+
'/**',
140+
' * Example 1',
141+
' *',
142+
' * @param [n - this is',
143+
' * the description',
144+
' *',
145+
' * @public',
146+
' */'
147+
].join('\n'));
148+
});
149+
150+
test('07 Invalid JSDoc type', () => {
151+
TestHelpers.parseAndMatchDocCommentSnapshot([
152+
'/**',
153+
' * Example 1',
154+
' *',
155+
' * @param { test',
156+
' *',
157+
' * @public',
158+
' */'
159+
].join('\n'));
160+
});

0 commit comments

Comments
 (0)