jscs-dev / node-jscs

:arrow_heading_up: JavaScript Code Style checker (unmaintained)
https://jscs-dev.github.io
MIT License
4.96k stars 510 forks source link

TypeError Cannot read property 'toLowerCase' of undefined #2042

Closed megahertz closed 8 years ago

megahertz commented 8 years ago

This exception raises on the following code:

var Class = function() {};
/**
 * @return {Class}
 */
Class.create = function() {
    return new this();
};

Stack:

TypeError: Cannot read property 'toLowerCase' of undefined
    at jsDocMatchType (/www/mg-model/node_modules/jscs-jsdoc/lib/jsdoc.js:544:24)
    at DocType.match (/www/mg-model/node_modules/jscs-jsdoc/lib/jsdoc.js:171:16)
    at /www/mg-model/node_modules/jscs-jsdoc/lib/rules/validate-jsdoc/check-return-types.js:23:23
    at Array.forEach (native)
    at Object.checkReturnTypes (/www/mg-model/node_modules/jscs-jsdoc/lib/rules/validate-jsdoc/check-return-types.js:22:31)
    at /www/mg-model/node_modules/jscs-jsdoc/lib/rules/validate-jsdoc.js:145:27
    at Array.forEach (native)
    at DocComment.<anonymous> (/www/mg-model/node_modules/jscs-jsdoc/lib/rules/validate-jsdoc.js:144:46)
    at Array.forEach (native)
    at DocComment.forEachTag [as iterate] (/www/mg-model/node_modules/jscs-jsdoc/lib/jsdoc.js:86:19)
markelog commented 8 years ago

/cc @zxqfox

qfox commented 8 years ago

Thanks for report!

davidrapin commented 8 years ago

Same error here:

Error running rule jsDoc: This is an issue with JSCS and not your codebase.
Please file an issue (with the stack trace below) at: https://github.com/jscs-dev/node-jscs/issues/new
TypeError: Cannot read property 'toLowerCase' of undefined
    at jsDocMatchType (/Users/david/Code/linkurious-server/node_modules/grunt-jscs/node_modules/jscs/node_modules/jscs-jsdoc/lib/jsdoc.js:544:24)
    at DocType.match (/Users/david/Code/linkurious-server/node_modules/grunt-jscs/node_modules/jscs/node_modules/jscs-jsdoc/lib/jsdoc.js:171:16)
    at /Users/david/Code/linkurious-server/node_modules/grunt-jscs/node_modules/jscs/node_modules/jscs-jsdoc/lib/rules/validate-jsdoc/check-return-types.js:23:23
    at Array.forEach (native)
    at Object.checkReturnTypes (/Users/david/Code/linkurious-server/node_modules/grunt-jscs/node_modules/jscs/node_modules/jscs-jsdoc/lib/rules/validate-jsdoc/check-return-types.js:22:31)
    at /Users/david/Code/linkurious-server/node_modules/grunt-jscs/node_modules/jscs/node_modules/jscs-jsdoc/lib/rules/validate-jsdoc.js:145:27
    at Array.forEach (native)
    at DocComment.<anonymous> (/Users/david/Code/linkurious-server/node_modules/grunt-jscs/node_modules/jscs/node_modules/jscs-jsdoc/lib/rules/validate-jsdoc.js:144:46)
    at Array.forEach (native)
    at DocComment.forEachTag [as iterate] (/Users/david/Code/linkurious-server/node_modules/grunt-jscs/node_modules/jscs/node_modules/jscs-jsdoc/lib/jsdoc.js:86:19) at ./test/data/graph/GraphSetup.js :
     1 |/**
--------^
     2 | * LINKURIOUS CONFIDENTIAL
     3 | * Copyright Linkurious SAS 2012 - 2015
>> 1 code style errors found!
Warning: Task "jscs:src" failed. Use --force to continue.
markelog commented 8 years ago

At this point only major and CST related bugs will be fixed.