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.20
  • Source
  • npm
  • Socket score

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

jscs-jsdoc

Build Status NPM version Dependency Status

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

But better 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
  • "checkTypes" reports invalid types
  • "checkRedundantReturns" reports redundant returns in jsdoc
  • "checkRedundantAccess" reports redundant access declarations
  • "leadingUnderscoreAccess" ensures access declaration is set for _underscored function names
  • "enforceExistence" ensures jsdoc declarations exists for functions and methods
Example
"jsDoc": {
    "checkParamNames": true,
    "checkRedundantParams": true,
    "requireParamTypes": true,
    "checkReturnTypes": true,
    "requireReturnTypes": true,
    "checkTypes": true,
    "checkRedundantReturns": true,
    "checkRedundantAccess": true,
    "leadingUnderscoreAccess": "private",
    "enforceExistence": true
}
Valid
/**
 * Adds style error to the list
 *
 * @private
 * @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
 *
 * @protected
 * @param {String} message
 * @param {Number,Object} line
 * @param {Number} [column]
 * @returns {String}
 */
_add: function() {
    if (true) {
        return false;
    }
    return 15;
}

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 10 Nov 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