All rules

Parameter table that does not match the signature

parameter-table-mismatchon by defaultJapanese / English

A parameter in only one of a signature and the parameter table under it

Example

Flagged
## measure ```ts measure(text: string, tabSize = 4): number ``` | Parameter | Type | Description | | --- | --- | --- | | `text` | string | The line to measure | | `tabWidth` | number | The width of one tab |
What chaff prints
4:23 `tabSize` is in only one of the signature of `measure` and its parameter table 10:4 `tabWidth` is in only one of the signature of `measure` and its parameter table
Fixed
## measure ```ts measure(text: string, tabSize = 4): number ``` | Parameter | Type | Description | | --- | --- | --- | | `text` | string | The line to measure | | `tabSize` | number | The width of one tab |
What chaff prints
no finding
chaff.yaml used for this example
genre: technical/readme

How to fix

Check the function's real parameters, and correct the table or the signature.

Why it matters

When an API reference's signature and the parameter table under it list different parameters, the reader cannot tell which is right, and passes a parameter that does not exist or never learns of one that does. It happens when a parameter is added or renamed in one place only. When a code block declares exactly one function (with function or def, or with a return type) and a table whose first header is Parameter or Argument follows it before the next heading or code block, the two are compared. A parameter only in the table is pointed out on its row, and one only in the signature on the signature.

What it does not flag

A call (wrap(text, 10);), a code block that declares two or more functions, a destructured parameter ({ a, b }), self and this, a table whose first header is not a parameter word (Option, Field), a table after another heading or code block, and a table whose rows do not start with | are not compared. A declaration with its types before the names (Java's String wrap(String text)) is not read. options.prefix in a table is read as a field of options.

Turning it off or relaxing it

Silence this one spot (in the document)
<!-- stet: parameter-table-mismatch — reason -->
Relax it for the team (the reason is kept as a comment in chaff.yaml)
npx chaffjs relax parameter-table-mismatch --why "reason"
Turn it off for the team (chaff.yaml)
rules: parameter-table-mismatch: off
Technical details
Layer
L1
Status
stable
Severity
warning
Languages
Japanese and English
Suited to
technical, docs, blog, legal, academic, literature, speech
Reads from the document
markdown

Levels

Set a level for this rule under rules in chaff.yaml. With nothing set, it runs at the level its genre gives it (see By genre below).

stricterror
normalwarning
relaxedinfo

This rule has no limit to count to. A level sets how a finding is marked: relaxed keeps the finding and marks it a step lower.

By genre

Runs by default in
technical/spec, technical/readme, blog/tech, blog/essay, blog/owned-media, docs/manual, docs/faq, docs/glossary
Turned off by the genre in
legal/contract, legal/statute, legal/judgment, legal/patent, academic/paper, literature/fiction, literature/essay, literature/poetry, literature/play, speech/address, speech/transcript
Not suited to, and not run in
business/proposal, business/report, business/email, business/press-release, business/meeting-notes

Genres

Message

`{name}` is in only one of the signature of `{function}` and its parameter table

This page is built from the rule's definition file:packages/chaff/rules/parameter-table-mismatch.yaml