Skip to content
← Back to rules

jsdoc/require-param-type Pedantic

🛠️ An auto-fix is available for this rule.

What it does

Requires that each @param tag has a type value (within curly brackets).

Why is this bad?

The type of a parameter should be documented.

Examples

Examples of incorrect code for this rule:

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

Examples of correct code for this rule:

javascript
/** @param {SomeType} foo */
function quux(foo) {}

Configuration

This rule accepts a configuration object with the following properties:

defaultDestructuredRootType

type: string

default: "object"

The type string to set by default for destructured roots. Defaults to "object".

setDefaultDestructuredRootType

type: boolean

default: false

Whether to set a default destructured root type. For example, you may wish to avoid manually having to set the type for a @param corresponding to a destructured root object as it is always going to be an object. Uses defaultDestructuredRootType for the type string. Defaults to false.

How to use

To enable this rule using the config file or in the CLI, you can use:

json
{
  "plugins": ["jsdoc"],
  "rules": {
    "jsdoc/require-param-type": "error"
  }
}
ts
import { defineConfig } from "oxlint";

export default defineConfig({
  plugins: ["jsdoc"],
  rules: {
    "jsdoc/require-param-type": "error",
  },
});
bash
oxlint --deny jsdoc/require-param-type --jsdoc-plugin

Version

This rule was added in v0.4.4.

References