Comments (16)
@ronkorving Thanks again for contributing! Can you please provide a part of your jsdoc?
from jscs-jsdoc.
I think it's a bug inside code scan loop. For @returns
type checking or something.
I wish to have a part of your code ;-)
from jscs-jsdoc.
It's definitely part of the "checkReturnTypes" check (turning that to false
"fixes" the issue). Unfortunately, the project's code is not open source :( So I hope I can track down the origin of the issue myself. When I log the cases where these errors happen, I do get a lot of output, so it's kinda "all over the place". Any advice?
from jscs-jsdoc.
@ronkorving Thanks. Actually, there's a little hacky code scan algorithm. If you have some ideas about it please share it.
Btw, to repeat this bug I just need one function that causes an error, so no need to share all the code. Anyway thanks. Even it's not possible.
from jscs-jsdoc.
@ronkorving Look at ./lib/jsdoc-helpers.js
file. At jsDocSimplifyNode
and jsDocMatchType
functions.
https://github.com/zxqfox/jscs-jsdoc/blob/master/lib/jsdoc-helpers.js#L59
from jscs-jsdoc.
I found one!
* @returns {null}
That caused:
TypeError: Cannot read property 'type' of null
at Object.jsDocMatchType [as match] (/home/rk/mage/node_modules/jscs-jsdoc/lib/jsdoc-helpers.js:135:32)
at module.exports.check (/home/rk/mage/node_modules/jscs-jsdoc/lib/rules/validate-jsdoc.js:172:39)
at Array.forEach (native)
at Array.validateReturnsLine [as 1] (/home/rk/mage/node_modules/jscs-jsdoc/lib/rules/validate-jsdoc.js:171:43)
at /home/rk/mage/node_modules/jscs-jsdoc/lib/rules/validate-jsdoc.js:67:38
at Array.forEach (native)
at Object.JsFile.iterateNodesByType (/home/rk/mage/node_modules/jscs/lib/js-file.js:112:42)
at Object.module.exports.check (/home/rk/mage/node_modules/jscs-jsdoc/lib/rules/validate-jsdoc.js:39:14)
at StringChecker.checkString (/home/rk/mage/node_modules/jscs/lib/string-checker.js:219:22)
at Array.forEach (native)
The function is this:
exports.shard = function () {
return null;
};
from jscs-jsdoc.
@ronkorving Do you want to fix it by self? ;-) I can do it.
from jscs-jsdoc.
I have no idea about Esprima objects, so I don't really understand the problem to be honest (besides "it breaks and I can work around it"). If you can resolve this the proper way, I would be very grateful. Before you publish another release however, I will also try and track down that other error.
from jscs-jsdoc.
@ronkorving almost done ;-)
from jscs-jsdoc.
Ah, the other error was triggered by exactly the same line of JSDoc!
from jscs-jsdoc.
And here is its stack trace:
TypeError: Cannot read property 'type' of null
at Object.jsDocMatchType [as match] (/home/rk/mage/node_modules/jscs-jsdoc/lib/jsdoc-helpers.js:135:32)
at module.exports.check (/home/rk/mage/node_modules/jscs-jsdoc/lib/rules/validate-jsdoc.js:172:39)
at Array.forEach (native)
at Array.validateReturnsLine [as 1] (/home/rk/mage/node_modules/jscs-jsdoc/lib/rules/validate-jsdoc.js:171:43)
at /home/rk/mage/node_modules/jscs-jsdoc/lib/rules/validate-jsdoc.js:67:38
at Array.forEach (native)
at Object.JsFile.iterateNodesByType (/home/rk/mage/node_modules/jscs/lib/js-file.js:112:42)
at Object.module.exports.check (/home/rk/mage/node_modules/jscs-jsdoc/lib/rules/validate-jsdoc.js:39:14)
at StringChecker.checkString (/home/rk/mage/node_modules/jscs/lib/string-checker.js:219:22)
at Array.forEach (native)
from jscs-jsdoc.
@ronkorving Thanks, fixing it.
Btw, esprima objects are the same objects used by SpiderMonkey Parser API: https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API
from jscs-jsdoc.
@ronkorving Thanks again. It should works now.
from jscs-jsdoc.
Awesome! Thank you! I wasn't even sure anymore if {null} and {undefined} were legal or not.
from jscs-jsdoc.
Just tested it, and it no longer breaks, thanks!
from jscs-jsdoc.
@ronkorving Now it's legal ;-)
from jscs-jsdoc.
Related Issues (20)
- Separate checkTypes rule into checkTypes and checkNativeTypeCase HOT 1
- Add "trailingUnderscoreAccess" option
- requireDescriptionCompleteSentence is not allowed to be false or null HOT 1
- Support disabling rules in jsdoc HOT 10
- Parameter validation wrongly associates closure and doc block HOT 4
- requireDescriptionCompleteSentence: fails to recognize inlined links. HOT 2
- jsdoc incorrectly validates shorthand arrow functions with nested function signatures
- Merge checkParamNames and checkRedundantParams
- AssertionError with missing braces and multi-line description in @returns tag HOT 1
- Why can't support array[].property jsdoc syntax??
- Tags should be case insensitive HOT 2
- enforceExistence rule not work properly for anonymous function. HOT 3
- False positive "Unexpected data in tag constructor" for JSDuck HOT 1
- @listens tag is missing from jsdoc3.json
- Is there a way to switch off jsdoc enforceExistence for anonymous arrow functions? HOT 3
- Function is missing documentation for parameter `undefined` with default parameters HOT 1
- New Rule: enforce order of tags HOT 2
- Question : How to add custom code to check to jscs-jsdoc module? HOT 4
- an error with jsDoc HOT 1
- [Meta] Is this merging into ESLint? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jscs-jsdoc.