Skip to content

Commit

Permalink
fix(check-tag-names): work with the constructor tag
Browse files Browse the repository at this point in the history
  • Loading branch information
tschaub authored and brettz9 committed Aug 8, 2022
1 parent 7d21369 commit 5bd52bb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/jsdocUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ const getPreferredTagName = (
}),
);

if (name in tagPreferenceFixed) {
if (Object.prototype.hasOwnProperty.call(tagPreferenceFixed, name)) {
return tagPreferenceFixed[name];
}

Expand Down
6 changes: 6 additions & 0 deletions test/jsdocUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ describe('jsdocUtils', () => {
it('returns the primary tag name', () => {
expect(jsdocUtils.getPreferredTagName({}, 'jsdoc', 'return')).to.equal('returns');
});
it('works with the constructor tag', () => {
expect(jsdocUtils.getPreferredTagName({}, 'jsdoc', 'constructor')).to.equal('class');
});
});
it('works with tags that clash with prototype properties', () => {
expect(jsdocUtils.getPreferredTagName({}, 'jsdoc', 'toString')).to.equal('toString');
});
it('returns the primary tag name', () => {
expect(jsdocUtils.getPreferredTagName({}, 'jsdoc', 'returns')).to.equal('returns');
Expand Down

0 comments on commit 5bd52bb

Please sign in to comment.