jscs-dev / jscs-jsdoc

JsDoc validation rules for jscs
MIT License
99 stars 35 forks source link

Enforce existance, but only for functions that has arguments #139

Closed webuniverseio closed 9 years ago

webuniverseio commented 9 years ago

In my opinion only hacky/unclear code needs description otherwise developers should express what code is doing using code, not comments. Following that logic and taking in count cases that some functions might not have any arguments is it possible to enforce jsdoc existance, but only for functions which take arguments? Otherwise I need to put empty comments at the top of each function. Thank you.

qfox commented 9 years ago

Yeah, why not? Thanks for contribution. Just need to decide how to do it.

webuniverseio commented 9 years ago

Hi @zxqfox I'll try to figure it out. If there are any examples which might help me along the way, please let me know.

qfox commented 9 years ago

We usually doing it with exceptions like allExcept: ['some', 'thing', 'etc'].

For now there are 3 options: anonymous, exports, expressions. Feels like we need another one for your case. Any ideas how to call it? Something like paramless?

https://github.com/jscs-dev/jscs-jsdoc/blob/master/lib/rules/validate-jsdoc/enforce-existence.js#L15-L20

webuniverseio commented 9 years ago

paramless sounds pretty cool :+1: Less cool, and a little boring alternatives are no-arguments, no-parameters, no-params, without-params. It will read like enforceExistence for allExcept: ['without-params']. I'm fine with any of those including paramless, so it is up to you :)