I'm trying to improve the documentation of my javascript code, and am following the JSDoc guidelines https://jsdoc.app/.
I can't find how to document an intentional side-effect. For example the following method:
/**
* @description
* Paints the object red.
* @return
*/
Painter.paintItRed = function(someObj){
someObj.color = "red";
};
How do you document the fact that the method acts directly on the passed object? A different example:
/**
* @description
* If the user has not setUp a config, show config Modal.
* @return
*/
User.checkConfig = function(user){
if(!user.config.valid){
showConfigModal();
}
};
These are contrived examples and probable "code smells", but that's another issue. I'm looking at some best-practices on how to document such behavior (for good or bad). Something perhaps better than //IMPORTANT!! This method is dangerous!
function doSomethingDangerous
. – Troostite