GithubHelp home page GithubHelp logo

Comments (16)

qfox avatar qfox commented on June 9, 2024

@ronkorving Thanks again for contributing! Can you please provide a part of your jsdoc?

from jscs-jsdoc.

qfox avatar qfox commented on June 9, 2024

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.

ronkorving avatar ronkorving commented on June 9, 2024

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.

qfox avatar qfox commented on June 9, 2024

@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.

qfox avatar qfox commented on June 9, 2024

@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.

ronkorving avatar ronkorving commented on June 9, 2024

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.

qfox avatar qfox commented on June 9, 2024

@ronkorving Do you want to fix it by self? ;-) I can do it.

from jscs-jsdoc.

ronkorving avatar ronkorving commented on June 9, 2024

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.

qfox avatar qfox commented on June 9, 2024

@ronkorving almost done ;-)

from jscs-jsdoc.

ronkorving avatar ronkorving commented on June 9, 2024

Ah, the other error was triggered by exactly the same line of JSDoc!

from jscs-jsdoc.

ronkorving avatar ronkorving commented on June 9, 2024

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.

qfox avatar qfox commented on June 9, 2024

@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.

qfox avatar qfox commented on June 9, 2024

@ronkorving Thanks again. It should works now.

from jscs-jsdoc.

ronkorving avatar ronkorving commented on June 9, 2024

Awesome! Thank you! I wasn't even sure anymore if {null} and {undefined} were legal or not.

from jscs-jsdoc.

ronkorving avatar ronkorving commented on June 9, 2024

Just tested it, and it no longer breaks, thanks!

from jscs-jsdoc.

qfox avatar qfox commented on June 9, 2024

@ronkorving Now it's legal ;-)

from jscs-jsdoc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.