Skip to content
← Back to rules

jsdoc/require-param Pedantic

🚧 An auto-fix is planned for this rule, but not implemented at this time.

What it does ​

Requires that all function parameters are documented with JSDoc @param tags.

Why is this bad? ​

The rule is aimed at enforcing code quality and maintainability by requiring that all function parameters are documented.

Examples ​

Examples of incorrect code for this rule:

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

Examples of correct code for this rule:

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

Configuration ​

This rule accepts a configuration object with the following properties:

checkConstructors ​

type: boolean

default: false

Whether to check constructor methods.

checkDestructured ​

type: boolean

default: true

Whether to check destructured parameters.

checkDestructuredRoots ​

type: boolean

default: true

Whether to check destructured parameters when you have code like function doSomething({ a, b }) { ... }. Because there is no named parameter in this example, when this option is true you must have a @param tag that corresponds to {a, b}.

checkGetters ​

type: boolean

default: true

Whether to check getter methods.

checkRestProperty ​

type: boolean

default: false

Whether to check rest properties.

checkSetters ​

type: boolean

default: true

Whether to check setter methods.

checkTypesPattern ​

type: string

default: "^(?:[oO]bject|[aA]rray|PlainObject|Generic(?:Object|Array))$"

Regex pattern to match types that exempt parameters from checking.

exemptedBy ​

type: string[]

default: ["inheritdoc"]

List of JSDoc tags that exempt functions from @param checking.

ignoreWhenAllParamsMissing ​

type: boolean

default: false

Set to true to ignore reporting when all params are missing. Defaults to false.

interfaceExemptsParamsCheck ​

type: boolean

default: false

Set if you wish TypeScript interfaces to exempt checks for the existence of @param's. Will check for a type defining the function itself (on a variable declaration) or if there is a single destructured object with a type. Defaults to false.

useDefaultObjectProperties ​

type: boolean

default: false

Set to true if you wish to expect documentation of properties on objects supplied as default values. 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": "error"
  }
}
ts
import { defineConfig } from "oxlint";

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

Version ​

This rule was added in v0.4.3.

References ​