JSDoc outputs same variable twice

920 views Asked by At

JSDoc prints the list of all the members twice. And in these lists it prints every member also twice. Any idea what could cause this behaviour?

This is my code:

/** @module styles */

/**
 * Contains the general styles
 * @var _
 */

var _ = StyleSheet.create({});

This is my configuration file:

{
  "tags": {
    "allowUnknownTags": true,
    "dictionaries": ["jsdoc", "closure"]
  },
  "source": {
    "include": [ "./styles.js" ],
    "includePattern": ".+\\.js$",
    "excludePattern": ""
  },
  "plugins": [],
  "templates": {
    "cleverLinks": false,
    "monospaceLinks": false
  },
  "opts": {
    "destination": "./docs/",
    "encoding": "utf8"
  }
}

This is the command to generate the docs:

jsdoc . -c conf.json

This is the result:

enter image description here

3

There are 3 answers

0
Martin Cup On

I found the error. It happens because in the configuration I'm using:

"include": [ "./styles.js" ], 

AND

"includePattern": ".+\\.js$",

If I change include to an empty array it outputs everything once. I thought includePattern only filters everything that's included, but that's not the case. It matches the files again.

0
Marc Nicole On

I had a similar issue. I was passing the source in the command line and in the config file.

{
  "source": {
    "include": [
      "src"
    ]
  }
}

jsdoc -c jsdoc.json ./src
I had to remove it from either the config or the command. I choose to remove it from the command
jsdoc -c jsdoc.json

0
Russ Bain On

I had this problem on two separate occasions.(jsdoc 3.6.10 with docdash 1.2.0)

One time it was caused by having an empty comment in the file like this one.

/*
* 
* */

Removing the empty comment eliminated duplicate output.

Another time the duplicate output was caused by my "includes" array in jsdoc.json

This caused it:

"include": ["./src", "./src/lib"]

This did not:

"include": ["./src"]