Skip to content

Files

Latest commit

 

History

History
148 lines (111 loc) · 2.85 KB

require-hyphen-before-param-description.md

File metadata and controls

148 lines (111 loc) · 2.85 KB

Pattern: Missing hyphen before @param description

Issue: -

Description

Requires a hyphen before the @param description.

Options

This rule takes one optional string argument and an optional options object.

If the string is "always" then a problem is raised when there is no hyphen before the description. If it is "never" then a problem is raised when there is a hyphen before the description. The default value is "always".

The options object may have the following properties:

  • checkProperties - Boolean on whether to also apply the rule to @property tags.
Context everywhere
Tags param and optionally property
Aliases arg, argument; optionally prop
Options (a string matching `"always"

The following patterns are considered problems:

/**
 * @param foo Foo.
 */
function quux () {

}
// Options: ["always"]
// Message: There must be a hyphen before @param description.

/**
 * @param foo Foo.
 */
function quux () {

}
// Message: There must be a hyphen before @param description.

/**
 * @param foo - Foo.
 */
function quux () {

}
// Options: ["never"]
// Message: There must be no hyphen before @param description.

/**
 * @param foo - foo
 * @param foo foo
 */
function quux () {

}
// Options: ["always"]
// Message: There must be a hyphen before @param description.

/**
 * @param foo foo
 * bar
 * @param bar - bar
 */
function quux () {

}
// Options: ["always"]
// Message: There must be a hyphen before @param description.

/**
 * @param foo
 */
function quux (foo) {

}
// Settings: {"jsdoc":{"tagNamePreference":{"param":false}}}
// Message: Unexpected tag `@param`

/**
 * @typedef {SomeType} ATypeDefName
 * @property foo Foo.
 */
// Options: ["always",{"checkProperties":true}]
// Message: There must be a hyphen before @property description.

/**
 * @typedef {SomeType} ATypeDefName
 * @property foo - Foo.
 */
// Options: ["never",{"checkProperties":true}]
// Message: There must be no hyphen before @property description.

The following patterns are not considered problems:

/**
 * @param foo - Foo.
 */
function quux () {

}
// Options: ["always"]

/**
 * @param foo Foo.
 */
function quux () {

}
// Options: ["never"]

/**
 * @param foo
 */
function quux () {

}

/**
 * @typedef {SomeType} ATypeDefName
 * @property foo - Foo.
 */
// Options: ["always",{"checkProperties":true}]

/**
 * @typedef {SomeType} ATypeDefName
 * @property foo Foo.
 */
// Options: ["never",{"checkProperties":true}]

Further Reading