It looks like the code to parse type expressions from the comments does not work properly with nested curly braces:
// test.js
/**
* @return {{a: number, b: string}}
*/
function foo() {
return {};
}
// .jscsrc
{
"additionalRules": [
"node_modules/jscs-jsdoc/lib/rules/*.js"
],
"jsDoc": {
"checkTypes": true
}
}
// jscs --config .jscsrc test.js
Invalid JsDoc type definition at test.js :
1 |/**
2 | * @return {{a: number, b: string}}
-----------^
3 | */
4 |function foo() {
1 code style error found.
If you look at the string that gets passed to jsDocParseType you will notice that it is {a: number, b: string, so it is missing the closing curly brace.
It looks like the code to parse type expressions from the comments does not work properly with nested curly braces:
If you look at the string that gets passed to jsDocParseType you will notice that it is
{a: number, b: string, so it is missing the closing curly brace.