esdoc / esdoc-plugins

MIT License
139 stars 74 forks source link

esdoc-flow-type-plugin: missing support for importing type(s) #33

Open alekbarszczewski opened 7 years ago

alekbarszczewski commented 7 years ago
import type { Type } from 'flow-runtime'
import type { Store } from './store'
import { type Errors } from './errors'

esdoc-flow-type-plugin fails to parse those lines because of type keyword. It throws error:

parse: /Users/alek/Desktop/pros/bs/src/types.js
warning: could not parse the following code. if you want to use ECMAScript proposals, see https://esdoc.org/manual/feature.html#ecmascript-proposal
/Users/alek/Desktop/pros/bs/src/types.js
3| import t, { reify } from 'flow-runtime'
4| import type { Type } from 'flow-runtime'
5| import type { Store } from './store'
6| import { type Errors } from './errors'
7| 
8| /**
9|  * * Method name must consist from one or more modules

TypeError: Cannot read property 'start' of undefined
    at Plugin._formatResult (/Users/alek/Desktop/pros/bs/node_modules/esdoc-lint-plugin/src/Plugin.js:141:42)
    at Plugin.onPublish (/Users/alek/Desktop/pros/bs/node_modules/esdoc-lint-plugin/src/Plugin.js:33:26)
    at Plugin._execHandler (/Users/alek/Desktop/pros/bs/node_modules/esdoc/out/src/Plugin/Plugin.js:55:26)
    at Plugin.onPublish (/Users/alek/Desktop/pros/bs/node_modules/esdoc/out/src/Plugin/Plugin.js:154:10)
    at Function._publish (/Users/alek/Desktop/pros/bs/node_modules/esdoc/out/src/ESDoc.js:354:24)
    at Function.generate (/Users/alek/Desktop/pros/bs/node_modules/esdoc/out/src/ESDoc.js:149:10)
    at ESDocCLI.exec (/Users/alek/Desktop/pros/bs/node_modules/esdoc/out/src/ESDocCLI.js:71:23)
    at Object.<anonymous> (/Users/alek/Desktop/pros/bs/node_modules/esdoc/out/src/ESDocCLI.js:182:7)
    at Module._compile (module.js:573:30)
    at Object.Module._extensions..js (module.js:584:10)

error Command failed with exit code 1.

.esdoc.json:

{
  "source": "./src",
  "destination": "./docs",
  "plugins": [
    { "name": "esdoc-flow-type-plugin", "option": { "enable": true } },
    { "name": "esdoc-ecmascript-proposal-plugin", "option": { "all": true } },
    { "name": "esdoc-standard-plugin" }
  ]
}
alekbarszczewski commented 6 years ago

Any plans on fixing this?

lll000111 commented 5 years ago

Is this still an issue? I just ran esdoc with the flow-type-plugin on a sizable Flow code base using lots and lots of import type and did not see this issue (I did see others though, there seems to be quite a bit of unsupported Flow syntax, object destructuring in function parameters for example, but it may be a general esdoc issue and not the Flow type annotation of the parameter).