Crash: esdoc-publish-html-plugin "SyntaxError: Invalid regular expression: /[~]function((string$/: Unterminated group"
lll000111 opened this issue · 2 comments
SyntaxError: Invalid regular expression: /[~]function((string$/: Unterminated group
at RegExp (<anonymous>)
at SingleDocBuilder._findByName (.\one\node_modules\esdoc-publish-html-plugin\out\src\Builder\DocBuilder.js:116:20)
at SingleDocBuilder._buildDocLinkHTML (.\one\node_modules\esdoc-publish-html-plugin\out\src\Builder\DocBuilder.js:768:22)
at SingleDocBuilder._buildTypeDocLinkHTML (.\one\node_modules\esdoc-publish-html-plugin\out\src\Builder\DocBuilder.js:750:19)
at ice.loop (.\one\node_modules\esdoc-publish-html-plugin\out\src\Builder\DocBuilder.js:896:29)
at IceCap.loop (.\one\node_modules\ice-cap\out\src\IceCap.js:261:9)
at SingleDocBuilder._buildProperties (.\one\node_modules\esdoc-publish-html-plugin\out\src\Builder\DocBuilder.js:887:9)
at ice.loop (.\one\node_modules\esdoc-publish-html-plugin\out\src\Builder\DocBuilder.js:456:37)
at IceCap.loop (.\one\node_modules\ice-cap\out\src\IceCap.js:261:9)
at SingleDocBuilder._buildDetailDocs (.\one\node_modules\esdoc-publish-html-plugin\out\src\Builder\DocBuilder.js:409:9)
I think the ORIGINAL string is
...
* @typedef {Object} SystemWriteStream
* @property {function(string|ArrayBuffer):undefined} write
...
At that point name
only is
function(string
So something got lost to begin with.
When I try a minimal @property {function(string)} write
SyntaxError: Invalid function type annotation: `function(string)`
Error source: https://github.com/esdoc/esdoc-plugins/blob/master/esdoc-publish-html-plugin/src/Builder/DocBuilder.js#L651
But that seems to be how you define function types??? Even WebStorm understands it, and I see that syntax recommended on StackOverflow, just one example of many: https://stackoverflow.com/a/38586423/544779
--
If you don't understand a syntax (bad enough), at the very least don't throw an error and stop EVERYTHING
This is a function syntax used by many, just one of numerous examples (not to mention that WebStorm would not have bothered to support this if that wasn't the case): https://stackoverflow.com/a/38586423/544779
Also, it should be supported at least through the Closure Compiler types, go to "Function Type": https://github.com/google/closure-compiler/wiki/Types-in-the-Closure-Type-System or https://github.com/google/closure-compiler/wiki/Annotating-Types#function-declarations or https://github.com/google/closure-compiler/wiki/Annotating-JavaScript-for-the-Closure-Compiler#function-type
output: /Users/greada/Documents/workspace/sinner/dekk/docs/api/class/@dekk/deck/src/deck.js~Deck.html
SyntaxError: Invalid regular expression: /[~](String$/: Unterminated group
at new RegExp (<anonymous>)
at ClassDocBuilder._findByName (/Users/greada/Documents/workspace/sinner/dekk/node_modules/esdoc-publish-html-plugin/out/src/Builder/DocBuilder.js:116:20)
at ClassDocBuilder._buildDocLinkHTML (/Users/greada/Documents/workspace/sinner/dekk/node_modules/esdoc-publish-html-plugin/out/src/Builder/DocBuilder.js:768:22)
at ClassDocBuilder._buildTypeDocLinkHTML (/Users/greada/Documents/workspace/sinner/dekk/node_modules/esdoc-publish-html-plugin/out/src/Builder/DocBuilder.js:748:23)
at inner.split.map.v (/Users/greada/Documents/workspace/sinner/dekk/node_modules/esdoc-publish-html-plugin/out/src/Builder/DocBuilder.js:708:28)
at Array.map (<anonymous>)
at ClassDocBuilder._buildTypeDocLinkHTML (/Users/greada/Documents/workspace/sinner/dekk/node_modules/esdoc-publish-html-plugin/out/src/Builder/DocBuilder.js:699:43)
at ClassDocBuilder._buildSignatureHTML (/Users/greada/Documents/workspace/sinner/dekk/node_modules/esdoc-publish-html-plugin/out/src/Builder/DocBuilder.js:846:36)
at ice.loop (/Users/greada/Documents/workspace/sinner/dekk/node_modules/esdoc-publish-html-plugin/out/src/Builder/DocBuilder.js:335:34)
at IceCap.loop (/Users/greada/Documents/workspace/sinner/dekk/node_modules/ice-cap/out/src/IceCap.js:261:9)
tracked from here:
output: /Users/greada/Documents/workspace/sinner/dekk/docs/api/class/@dekk/deck/src/deck.js~Deck.html
String [ { __docId__: 23,
kind: 'external',
name: 'String',
externalLink: 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String',
memberof: '@dekk/.external-ecmascript.js',
static: true,
longname: '@dekk/.external-ecmascript.js~String',
access: 'public',
description: '',
builtinExternal: true,
___id: 'T000002R000024',
___s: true,
descriptionRaw: '' } ]
String [ { __docId__: 23,
kind: 'external',
name: 'String',
externalLink: 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String',
memberof: '@dekk/.external-ecmascript.js',
static: true,
longname: '@dekk/.external-ecmascript.js~String',
access: 'public',
description: '',
builtinExternal: true,
___id: 'T000002R000024',
___s: true,
descriptionRaw: '' } ]
String [ { __docId__: 23,
kind: 'external',
name: 'String',
externalLink: 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String',
memberof: '@dekk/.external-ecmascript.js',
static: true,
longname: '@dekk/.external-ecmascript.js~String',
access: 'public',
description: '',
builtinExternal: true,
___id: 'T000002R000024',
___s: true,
descriptionRaw: '' } ]
Crashes:
* @return {{children: (ReactElement|ReactElement[]), animation: ?(String|Array), order: ?number}}
Works:
* @return {{children: (ReactElement|ReactElement[]), animation: (String|Array), order: ?number}}
difference:
?(String|Array) => (String|Array)