jscs-jsdoc icon indicating copy to clipboard operation
jscs-jsdoc copied to clipboard

Force @return or @returns

Open gajus opened this issue 10 years ago • 6 comments

Have a rule that forces user to use either @return tag or @returns.

gajus avatar Oct 02 '15 00:10 gajus

Does checkAnnotations: { extra: { "returns": null } } to deny @returns would be fine?

qfox avatar Oct 02 '15 20:10 qfox

I should say that currently you allowing both when you using closure or jsdoc3 tag set: https://github.com/jscs-dev/jscs-jsdoc/blob/1d6e20f588564fa61f8794b9d1301702abdfa4be/lib/tags/jsdoc3.json#L64-L65

But I'm not sure that this is right. Closure compiler uses @return: https://developers.google.com/closure/compiler/docs/js-for-compiler#tag-return — Guess we can safely remove @returns from it. JSDoc3 http://usejsdoc.org/tags-returns.html — supports both.

Ref: https://github.com/jscs-dev/jscs-jsdoc/issues/76

qfox avatar Oct 02 '15 21:10 qfox

Semantically, @return does not make sense. You don't give a command to the function. You describe what it does. It returns a value.

On Oct 2, 2015, at 22:07, Alexej Yaroshevich [email protected] wrote:

I should say that currently you allowing both when you using closure or jsdoc3 tag set: https://github.com/jscs-dev/jscs-jsdoc/blob/1d6e20f588564fa61f8794b9d1301702abdfa4be/lib/tags/jsdoc3.json#L64-L65

But I'm not sure that this is right. Closure compiler uses @return: https://developers.google.com/closure/compiler/docs/js-for-compiler#tag-return — Guess we can safely remove @returns from it. JSDoc3 http://usejsdoc.org/tags-returns.html — supports both.

Ref: #76

— Reply to this email directly or view it on GitHub.

gajus avatar Oct 02 '15 21:10 gajus

Has any decision been taken regarding this since?

gajus avatar Oct 19 '15 13:10 gajus

I'd suggest to wait "multi-sets" (when you'll be able to use jsdoc3 with googleclosure addon) and then cleanup tag sets (e.g. remove returns from googleclosure set).

I think we shouldn't remove @return from jsdoc3 according to docs: http://usejsdoc.org/tags-returns.html But there is no @returns in googleclosure: https://developers.google.com/closure/compiler/docs/js-for-compiler ;-)

What you think?

qfox avatar Oct 19 '15 13:10 qfox

A rather general suggestion is to remove https://github.com/jscs-dev/jscs-jsdoc#checkannotations entirely. This rule is too broad. Instead, allow granular control (allowed, not allowed), case sensitive, control of all the supported tags.

gajus avatar Oct 19 '15 15:10 gajus