Skip to content

Commit 6b7ab34

Browse files
committed
refactor: remove mandatory type items from optional type items list and query both
1 parent 4aca635 commit 6b7ab34

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

src/jsdocUtils.js

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -129,21 +129,24 @@ const hasDefinedTypeReturnTag = (tag) => {
129129
return true;
130130
};
131131

132-
const tagsWithOptionalType = [
133-
'augments', 'extends',
134-
'class', 'constructor',
135-
'constant', 'const',
132+
const tagsWithMandatoryType = [
136133
'enum',
137134
'implements',
138135
'member', 'var',
139136
'module',
137+
'type',
138+
'typedef',
139+
];
140+
141+
const tagsWithOptionalType = [
142+
'augments', 'extends',
143+
'class', 'constructor',
144+
'constant', 'const',
140145
'namespace',
141146
'param', 'arg', 'argument',
142147
'property', 'prop',
143148
'returns', 'return',
144149
'throws', 'exception',
145-
'type',
146-
'typedef',
147150
'yields', 'yield',
148151

149152
// GCC specific
@@ -154,15 +157,6 @@ const tagsWithOptionalType = [
154157
'static',
155158
];
156159

157-
const tagsWithMandatoryType = [
158-
'enum',
159-
'implements',
160-
'member', 'var',
161-
'module',
162-
'type',
163-
'typedef',
164-
];
165-
166160
const namepathDefiningTags = [
167161
'external', 'host',
168162
'name',
@@ -219,7 +213,7 @@ const isNamepathDefiningTag = (tagName) => {
219213
};
220214

221215
const tagMightHaveType = (tag) => {
222-
return tagsWithOptionalType.includes(tag);
216+
return tagsWithMandatoryType.includes(tag) || tagsWithOptionalType.includes(tag);
223217
};
224218

225219
const tagMustHaveType = (tag) => {

0 commit comments

Comments
 (0)