eslint-plugin-jsdoc
JSDoc specific linting rules for ESLint.
Reference to jscs-jsdoc
This table maps the rules between eslint-plugin-jsdoc
and jscs-jsdoc
.
Installation
Install ESLint either locally or globally.
$ npm install eslint
If you have installed ESLint
globally, you have to install JSDoc plugin globally too. Otherwise, install it locally.
$ npm install eslint-plugin-jsdoc
Configuration
Add plugins
section and specify eslint-plugin-jsdoc as a plugin.
{
"plugins": [
"jsdoc"
]
}
Finally, enable all of the rules that you would like to use.
{
"rules": {
"jsdoc/check-param-names": 1,
"jsdoc/check-tag-names": 1,
"jsdoc/check-types": 1,
"jsdoc/newline-after-description": 1,
"jsdoc/require-hyphen-before-description": 1,
"jsdoc/require-param": 1,
"jsdoc/require-param-description": 1,
"jsdoc/require-param-type": 1,
"jsdoc/require-returns-description": 1,
"jsdoc/require-returns-type": 1
}
}
Rules
check-param-names
Ensures that parameters names in JSDoc and in function declaration are equal.
The following patterns are considered problems:
function quux (bar, foo) {
}
function quux (foo) {
}
The following patterns are not considered problems:
function quux (foo) {
}
function quux (foo) {
}
function quux (foo, bar) {
}
function quux (foo, bar, baz) {
}
function quux (foo, bar) {
}
check-tag-names
Reports invalid block tag names.
Valid JSDoc 3 Block Tags are:
abstract
access
alias
augments
author
borrows
callback
class
classdesc
constant
constructs
copyright
default
deprecated
description
enum
event
example
exports
external
file
fires
function
global
ignore
implements
inheritdoc
inner
instance
interface
kind
lends
license
listens
member
memberof
mixes
mixin
module
name
namespace
override
param
private
property
protected
public
readonly
requires
returns
see
since
static
summary
this
throws
todo
tutorial
type
typedef
variation
version
The following patterns are considered problems:
function quux () {
}
function quux () {
}
The following patterns are not considered problems:
function quux (foo) {
}
check-types
Reports invalid types.
Ensures that case of native types is the same as in this list:
boolean
number
string
Object
Array
Date
RegExp
Affected tags:
class
constant
enum
member
module
namespace
param
property
returns
throws
type
typede
The following patterns are considered problems:
function quux (foo) {
}
The following patterns are not considered problems:
function quux (foo, bar, baz) {
}
newline-after-description
Enforces a consistent padding of the block description.
This rule takes one argument. If it is "always"
then a problem is raised when there is a newline after the description. If it is "never"
then a problem is raised when there is no newline after the description. The default value is "always"
.
The following patterns are considered problems:
function quux () {
}
function quux () {
}
The following patterns are not considered problems:
function quux () {
}
function quux () {
}
function quux () {
}
function quux () {
}
require-param-description
Requires that @param
tag has description
value.
The following patterns are considered problems:
function quux (foo) {
}
The following patterns are not considered problems:
function quux (foo) {
}
function quux (foo) {
}
require-param
Requires that all function parameters are documented.
The following patterns are considered problems:
function quux (foo) {
}
function quux (foo, bar) {
}
The following patterns are not considered problems:
function quux (foo) {
}
require-param-description
Requires that @param
tag has description
value.
The following patterns are considered problems:
function quux (foo) {
}
The following patterns are not considered problems:
function quux (foo) {
}
function quux (foo) {
}
require-param-type
Requires that @param
tag has type
value.
The following patterns are considered problems:
function quux (foo) {
}
The following patterns are not considered problems:
function quux (foo) {
}
function quux (foo) {
}
require-returns-description
Requires that @returns
tag has description
value.
The following patterns are considered problems:
function quux (foo) {
}
The following patterns are not considered problems:
function quux () {
}
function quux () {
}
require-returns-type
Requires that @returns
tag has type
value.
The following patterns are considered problems:
function quux () {
}
function quux () {
}
The following patterns are not considered problems:
function quux () {
}