Skip to content

Commit fa82a11

Browse files
committed
docs: further code comment clarifications on types/namepaths
1 parent 474ecb0 commit fa82a11

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

src/jsdocUtils.js

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,18 @@ const hasDefinedTypeReturnTag = (tag) => {
138138

139139
const tagsWithMandatoryType = [
140140
// These both show curly brackets in the doc signature and examples
141+
// "typeExpression"
141142
'implements',
143+
144+
// "typeName"
142145
'type',
143146
];
144147

148+
// All of these have a signature with "type" except for
149+
// `augments`/`extends` ("namepath")
150+
// `param`/`arg`/`argument` (no signature)
151+
// `property`/`prop` (no signature)
152+
// `modifies` (undocumented)
145153
const tagsWithOptionalType = [
146154
// These have the example showing curly brackets but not in their doc signature, e.g.: https://jsdoc.app/tags-enum.html
147155
'enum',
@@ -151,6 +159,7 @@ const tagsWithOptionalType = [
151159

152160
// These do not show curly brackets in either the signature or examples
153161
'augments', 'extends',
162+
154163
'class', 'constructor',
155164
'constant', 'const',
156165

@@ -170,6 +179,7 @@ const tagsWithOptionalType = [
170179

171180
// Todo: Omit these GCC specific items when in non-GCC mode after landing https://github.com/gajus/eslint-plugin-jsdoc/issues/356
172181
// Shows the signature with curly brackets but not in the example
182+
// "typeExpression"
173183
'package',
174184
'private',
175185
'protected',
@@ -184,16 +194,15 @@ const tagsWithOptionalType = [
184194
'modifies',
185195
];
186196

187-
// None of these show as having curly brackets for their name/namepath,
188-
// except for `member`/`var` (which show in their example)
197+
// None of these show as having curly brackets for their name/namepath
189198
const namepathDefiningTags = [
190-
// These appears to require a "name" in their signature, albeit these
191-
// are somewhat different from other "names" (including as described
199+
// These appear to require a "name" in their signature, albeit these
200+
// are somewhat different from other "name"'s (including as described
192201
// at https://jsdoc.app/about-namepaths.html )
193202
'external', 'host',
194203
'event',
195204

196-
// These allow for "names" in their signature, but indicate as optional
205+
// These allow for "name"'s in their signature, but indicate as optional
197206
'class', 'constructor',
198207
'constant', 'const',
199208
'function', 'func', 'method',
@@ -217,7 +226,7 @@ const tagsWithOptionalNamepath = [
217226
...namepathDefiningTags,
218227

219228
// `borrows` has a different format, however, so needs special parsing;
220-
// seems to require both, and as "namepaths"
229+
// seems to require both, and as "namepath"'s
221230
'borrows',
222231

223232
// Signature seems to require a "name" (of an event) and no counter-examples
@@ -237,7 +246,7 @@ const tagsWithOptionalNamepath = [
237246
// Signature seems to require a "OtherObjectPath" with no counter-examples
238247
'mixes',
239248

240-
// Signature allows for namepath or text
249+
// Signature allows for "namepath" or text
241250
'see',
242251
];
243252

0 commit comments

Comments
 (0)