Git Product home page Git Product logo

esdoc-es7-plugin's Introduction

Build Status Coverage Status Document

ESDoc

ESDoc is a documentation generator for JavaScript.
Please try it out!

Features

  • Generates good documentation.
  • Measures documentation coverage.
  • Integrate test codes into documentation.
  • Integrate manual into documentation.
  • Parse ECMAScript proposals.
  • ESDoc Hosting Service

Users

And more.

Quick Start

# Move to a your project directory.
cd your-project/

# Install ESDoc and standard plugin.
npm install --save-dev esdoc esdoc-standard-plugin

# Create a configuration file.
echo '{
  "source": "./src",
  "destination": "./docs",
  "plugins": [{"name": "esdoc-standard-plugin"}]
}' > .esdoc.json

# Run ESDoc.
./node_modules/.bin/esdoc

# View a documentation
open ./docs/index.html

Document

please visit esdoc.org to see more documentation.

License

MIT

Author

Ryo Maruyama@h13i32maru

esdoc-es7-plugin's People

Contributors

h13i32maru avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

esdoc-es7-plugin's Issues

SyntaxError: Unexpected token u

Sorry for the rather pathetic plea but does anyone know any way to debug this? Or perhaps it is a bug with this plugin? The only u in the code snippet are in lines 169, 170 and 177, and none of them are syntax errors.

Thanks for any help anyone can give.

error: could not process the following code.
/Users/ben/Dev/Git/.../assets/js/entries/dashboard.js
167|         // Call link's method
168|         model[
169|           $(`option[value=${chosenTab}]`)
170|           .getAttribute('data-onclick')
171|         ]()
172|       }
173|     }
174|   })()
175| )
176|
177| grab = async function grab(tabName, from = 0) { // NOTE babel bug

/Users/ben/Dev/Git/HireHubStatic/node_modules/esdoc/out/src/ESDoc.js:415
            throw _iteratorError5;
            ^

SyntaxError: Unexpected token u
    at Object.parse (native)
    at DocFactory._copy (/Users/ben/Dev/Git/HireHubStatic/node_modules/esdoc/out/src/Factory/DocFactory.js:978:19)
    at DocFactory._decideExpressionStatementType (/Users/ben/Dev/Git/HireHubStatic/node_modules/esdoc/out/src/Factory/DocFactory.js:806:27)
    at DocFactory._decideType (/Users/ben/Dev/Git/HireHubStatic/node_modules/esdoc/out/src/Factory/DocFactory.js:700:23)
    at DocFactory._createDoc (/Users/ben/Dev/Git/HireHubStatic/node_modules/esdoc/out/src/Factory/DocFactory.js:602:25)
    at DocFactory._traverseComments (/Users/ben/Dev/Git/HireHubStatic/node_modules/esdoc/out/src/Factory/DocFactory.js:565:24)
    at DocFactory.push (/Users/ben/Dev/Git/HireHubStatic/node_modules/esdoc/out/src/Factory/DocFactory.js:451:22)
    at Controller.<anonymous> (/Users/ben/Dev/Git/HireHubStatic/node_modules/esdoc/out/src/ESDoc.js:449:19)
    at Controller.enter (/Users/ben/Dev/Git/HireHubStatic/node_modules/esdoc/out/src/Util/ASTUtil.js:57:20)
    at Controller.__execute (/Users/ben/Dev/Git/HireHubStatic/node_modules/esdoc/node_modules/estraverse/estraverse.js:397:31)
    at Controller.traverse (/Users/ben/Dev/Git/HireHubStatic/node_modules/esdoc/node_modules/estraverse/estraverse.js:495:28)

Version 0.0.3 broke esdoc

Hi!

I just installed the new version of this plugin (0.0.3) and, when running esdoc, I get the following error.
I use node v4.1.1 and npm v3.3.7.

/Users/fmonniot/project/node_modules/esdoc/out/src/ESDoc.js:409
            throw _iteratorError5;
            ^
Error: Unknown node type SpreadProperty.
    at Controller.traverse (/Users/fmonniot/project/node_modules/estraverse/estraverse.js:515:31)
    at Object.traverse (/Users/fmonniot/project/node_modules/estraverse/estraverse.js:707:27)
    at Function.traverse (/Users/fmonniot/project/node_modules/esdoc/out/src/Util/ASTUtil.js:55:31)
    at Function._traverse (/Users/fmonniot/project/node_modules/esdoc/out/src/ESDoc.js:441:34)
    at /Users/fmonniot/project/node_modules/esdoc/out/src/ESDoc.js:187:26
    at Function._walk (/Users/fmonniot/project/node_modules/esdoc/out/src/ESDoc.js:394:13)
    at Function._walk (/Users/fmonniot/project/node_modules/esdoc/out/src/ESDoc.js:396:18)
    at Function._walk (/Users/fmonniot/project/node_modules/esdoc/out/src/ESDoc.js:396:18)
    at Function.generate (/Users/fmonniot/project/node_modules/esdoc/out/src/ESDoc.js:127:12)
    at ESDocCLI.exec (/Users/fmonniot/project/node_modules/esdoc/out/src/ESDocCLI.js:90:28)

Thanks for your work on esdoc !

ES7 Decorators in @example

Hello.

I really appreciate the efforts behind esdoc and this plugin.

My current problem is that I can't use decorators inside an @example.

It thinks it is another annotation and stops the documentation.

Snippet tested:

/**
 * Enhances the component with pure render functionality
 * @public
 * @example
 * // Usage as a component decorator
 * @withPureRender <-- Here is the problem, here it stops parsing
 * class MyComponent extends React.Component {
 *  render() { return <p>Hello World!</p>; }
 * }
 * @param {React.Component} PureComponent - the component to be enhanced
 * @return {React.Component} - the enhanced component
 */

Result: Documentation only partially generated.

@examples in other parts of the code work just fine when not using decorators.

Esdoc misses description and params/return types when meets decorator

First of all thank you for providing awesome tool!

And here it is: first issue! :)

esdoc version: ^0.2.1
esdoc-es7-plugin version: 0.0.1

Input

/**
   * Sets response content type
   * Proper values could be obtained form XmlHttpRequest specification
   * https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#Properties
   * @param {String} responseType - Proper values could be obtained form
   * XmlHttpRequest specification
   * https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#Properties
   * @returns {Object} Http object
   * @deprecated since version 0.2.0
   */
  @deprecate
  withResponseType (responseType) {
    return this.responseType(responseType)
  }

  /**
   * Sets response content type
   * Proper values could be obtained form XmlHttpRequest specification
   * https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#Properties
   * @param {String} responseType - Proper values could be obtained form
   * XmlHttpRequest specification
   * https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#Properties
   * @returns {Object} Http object
   */
  responseType (responseType) {
    return new Http(Object.assign({}, this.internals(), { responseType }))
  }

Output

screen shot 2015-08-11 at 13 59 27

screen shot 2015-08-11 at 14 00 04

Here this docs published: http://stremlenye.github.io/immutable-http/

Could this sort of static functions be documented with this plug-in

I am using react and to be able to have custom methods in a react class, they have to be binded. My solution here was to use this syntax :

export default class Comp extends React.Component {
    /**
     * Desc
     * @param {Object} param- Desc
     */
    static func= (param) => {
        return
    };
}

Sadly there is no doc output for this.

Could this be fixed ?

Spread operator doesn't work

Hi!

I'm using esdoc to document my code and the esdoc-es7-plugin. I've got the following code in one of my functions:

return new SomeEntity({
      ...someParams,
      some,
      other,
      params
    });

And I'm getting the following error on generating the documentation:

error: could not parse the following code. if you want to use ES7, see esdoc-es7-plugin(https://github.com/esdoc/esdoc-es7-plugin)

This is my esdoc.json

{
  "source": "./src",
  "destination": "./docs",
  "coverage": true,
  "plugins": [
    {"name": "esdoc-es7-plugin"}
  ],
  "test": {
    "type": "mocha",
    "source": "./test",
    "includes": ["Spec\\.js$"]
  }
}

What am I doing bad? It doesn't happen when compiling with babel, so I guess the mistake is not in my code :(

Outdated Babylon - plugin can be replaced with babel-eslint parser

I noticed that this plugin doesn't support Flow type declarations as it uses an old version of Babylon. It seems babel-eslint implements a more up-to-date Babylon-to-Espree AST converter so this plugin can be replaced with:

var parse = require('babel-eslint').parse;

function parser(code) {
    return parse(code);
}

module.exports.onHandleCodeParser = function(ev) {
    ev.data.parser = parser;
};

Let me know if you want a pull request. Thanks for your libraries.

What needs to be done to handle ES7 properly?

Hi,

I started using esdoc for an ES6/7 project and I would like to know what needs to be done so we can go from:

This plugin only ignores ES7 syntax(does not optimize) to produce the documentation. So, ES7 information(ClassProperties, AsyncFunctions and etc...) is not presented in the documentation.

to

This plugin adds ES7 experimental syntax support to esdoc in order to have ES7 information (ClassProperties, AsyncFunctions and etc...) presented in the documentation.

๐Ÿ˜„

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.