jsdoc icon indicating copy to clipboard operation
jsdoc copied to clipboard

Add a tag for side effects

Open mindrones opened this issue 5 years ago • 3 comments

I would need to tag when a function has side effects, say with:

@sideEffects: console.log, fs.writefile

Expected behavior

This is supposed to be an array of strings or links to functions documentation within the same code base or externally, or both.

@sideEffects: console.log, fs.writefile

or

@side_effects: console.log, {@link https://nodejs.org/api/fs.html#fs_fs_writefile_file_data_options_callback|fs.writefile}

It could be abbreviated as @sfx:

@sfx: console.log, fs.writefile

Related issues:

  • probably #833
  • @modifies doesn't seem to apply here

mindrones avatar Jan 14 '20 12:01 mindrones

Also, having this would also help tracking down if a package has side effects just by searching for @sideEffects and set sideEffects for webpack or moduleSideEffects for rollup accordingly.

mindrones avatar Jan 15 '20 14:01 mindrones

Has this been considered? It really would be a key feature for me, as a lot of methods do not return values in React but instead modify the parent class's state

JosephHubbard avatar Aug 18 '23 17:08 JosephHubbard

The tag @modifies already exist and is supposed to be used for this situation. But for some reason it has been added in 2018 and has been undocumented ever since

iDraKzy avatar May 19 '24 07:05 iDraKzy