Giter VIP home page Giter VIP logo

jscs-jsdoc's Introduction

jsdoc

Build Status NPM version Dependency Status

jscs-jsdoc plugin for jscs.

Friendly packages

Plugin installation

jscs-jsdoc can be installed using npm. Install it globally if you are using globally installed jscs

npm -g install jscs-jsdoc

Or install it into your project

npm install jscs-jsdoc --save-dev

Usage

To use plugin you should add it to configuration file .jscsrc:

{
    "additionalRules": [
        "node_modules/jscs-jsdoc/lib/rules/*.js"
    ],
    "jsDoc": {
    }
}

Configuration

jsDoc

Enables JsDoc validation.

Type: Object

Values:

  • "checkParamNames" ensures param names in jsdoc and in function declaration are equal
  • "requireParamTypes" ensures params in jsdoc contains type
  • "checkRedundantParams" reports redundant params in jsdoc
  • "checkReturnTypes" tries to compare function result type with declared type in jsdoc
  • "requireReturnTypes" ensures returns in jsdoc contains type
  • "checkRedundantReturns" reports redundant returns in jsdoc
  • "checkTypes" reports invalid types in jsdoc

Example

"jsDoc": {
    "checkParamNames": true,
    "checkRedundantParams": true,
    "requireParamTypes": true,
    "checkReturnTypes": true,
    "checkRedundantReturns": true,
    "requireReturnTypes": true,
    "checkTypes": true
}
Valid
/**
 * Adds style error to the list
 *
 * @param {String} message
 * @param {Number|Object} line
 * @param {Number} [column]
 * @returns {String[]}
 */
add: function(message, line, column) {
    return ['foo', 'bar'];
}
Invalid
/**
 * Adds style error to the list
 *
 * @param {String} message
 * @param {Number,Object} line
 * @param {Number} [column]
 * @returns {String}
 */
add: function() {
}

Browser Usage

NOT SUPPORTED ATM. SORRY.

File jscs-jsdoc-browser.js contains browser-compatible version of jscs-jsdoc.

Download and include jscs-jsdoc-browser.js into your page just after jscs-browser.js.

<script src="jscs-browser.js"></script>
<script src="jscs-jsdoc-browser.js"></script>
<script>
    var checker = new JscsStringChecker();
    checker.registerDefaultRules();
    checker.configure({'jsDoc': {/*...*/}});
    var errors = checker.checkString('var x, y = 1;');
    errors.getErrorList().forEach(function(error) {
        console.log(errors.explainError(error));
    });
</script>

jscs-jsdoc's People

Watchers

Andrew Rota avatar James Cloos avatar

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.