Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jscs-jsdoc

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jscs-jsdoc

JSCS jsdoc plugin

  • 0.0.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
38K
decreased by-2.25%
Maintainers
1
Weekly downloads
 
Created
Source

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>

FAQs

Package last updated on 27 May 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc