GithubHelp home page GithubHelp logo

Comments (4)

qfox avatar qfox commented on June 2, 2024

There are two solutions from my pov:

  • make some kind of dictionaries with these sets (and their formats)
  • make a set of flexible rules to configure and make presets with right values for them

I think better to have presets. But if you've make some basic realization e.g. jsduck set I'll do the rest. So PR is welcome. Thanks for ideas!

upd: Btw, we can parse JSDuck set from their wiki. And I think there're same possible solutions for JSDoc3 and Google Closure tag sets. Tag is what you calling "Annotation Name". Anywhere in code you'll see "tag".

from jscs-jsdoc.

pigulla avatar pigulla commented on June 2, 2024

I've created a PR with a first draft for presets for JSDuck 5, JSDoc 3 and the Closure Compiler.

As far as validation is concerned, that's about as far as I would want to go. Although I'm not sure where we should define which tags expect a type expression that needs to be validated. For instance, the syntax for @this is "@this" <type-expression> whereas it is "@param" <type-expression> <description> for the @param tag.
Maybe the most straight forward solution is to simply assume that everything that directly follows a tag and that looks like a type expression (i.e., is in curly braces) actually is meant to be one.

Also, it's probably a good idea to extend the configuration like so:

"jsDoc": {
    "checkAnnotations": "jsduck"  // whitelists JSDuck tags
    // equivalent to
    "checkAnnotations": {
        "preset": "jsduck"
    }
    // which can be extended to
    "checkAnnotations": {
        "preset": "jsduck",
        "extra": {
            "mycustomtag": false
        }
    }
}

because we need to take into account that tools like JSDuck allows the definition of custom tags.

from jscs-jsdoc.

qfox avatar qfox commented on June 2, 2024

Wow, nice work. Atm all tags parsing with rule @tag( {type})?( name)?( description)? I thinking about strict typing (more than true/false) for values in presets. As I can see there are boolean tags (flags) like @abstract, @chainable, etc. There are also valuable tags like @link, @see, @uses?. Typed tags like @type, @return[s], @param. And others. I propose to use true value for default behaviour (just tag filtering/checking), "boolean" for no data after tags, "typed" for @type. Probably we can also use regexes for custom tags.

Another idea is to use patterns for tags. For example:

{
  "type": "<type> <description>",
  "var": "<type> <description>",
  "param": "<type> <name> <description>",
  "returns": "<type> <description>"
}

What you think?

from jscs-jsdoc.

qfox avatar qfox commented on June 2, 2024

@pigulla I've made some basic functionality for this. Can you take a look at PR?

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.