jsdoc / jsdoc/jsdoc

JSDoc should do more to interpret IIFEs

Open
#456 12 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
JavaScript
Stars
15.5k
Forks
1.5k
Avg merge
10d 23h
Merged PRs (30d)
1

Description

JSDoc does not detect functions created by compiling CoffeeScript functions with proper JSDoc comments. Here is a simple example:

x = 1

###*
   * Funtion to ...
###
a = () ->
  1

x = 1 or some other code had to be before the comment, otherwise CoffeeScript assigns the comment to the file outer anonymous function and not the inner function.

After compilation CoffeeScript generates the following JavaScript code:

// Generated by CoffeeScript 1.6.3
(function() {
  var a, x;

  x = 1;

  /**
     * Funtion to ...
  */


  a = function() {
    return 1;
  };

}).call(this);

On this code, JSDoc does not detect the a function.

If the var a, x; line is removed, JSDoc works fine.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the compiled JavaScript example in the issue and trace JSDoc's handling of IIFEs and function detection; no repository file or test is named in the report. Done means the a function is detected when the generated var a, x; declaration remains, with a regression test covering this CoffeeScript output.

Written by the indexing model from the issue text.

Assessment

Tech stack
coffeescript, javascript
Domain
documentation
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.