|
| 1 | +### `match-name` |
| 2 | + |
| 3 | +Reports the name portion of a JSDoc tag if matching or not matching |
| 4 | +a given regular expression. |
| 5 | + |
| 6 | +Note that some tags do not possess names and anything appearing to be a |
| 7 | +name will actually be part of the description (e.g., for |
| 8 | +`@returns {type} notAName`). If you are defining your own tags, see the |
| 9 | +`structuredTags` setting (if `name: false`, this rule will not apply to |
| 10 | +that tag). |
| 11 | + |
| 12 | +#### Options |
| 13 | + |
| 14 | +A single options object with the following properties: |
| 15 | + |
| 16 | +##### `match` |
| 17 | + |
| 18 | +`match` is a required option containing an array of objects which determine |
| 19 | +the conditions whereby a name is reported as being problematic. |
| 20 | + |
| 21 | +These objects can have any combination of the following groups of optional |
| 22 | +properties, all of which act to confine one another: |
| 23 | + |
| 24 | +- `tags` - This array should include tag names or `*` to indicate the |
| 25 | + match will apply for all tags (except as confined by any context |
| 26 | + properties). If `*` is not used, then these rules will only apply to |
| 27 | + the specified tags. If `tags` is omitted, then `*` is assumed. |
| 28 | + |
| 29 | +- `allowName` - Indicates which names are allowed for the given tag (or `*`). |
| 30 | + Accepts a string regular expression (optionally wrapped between two |
| 31 | + `/` delimiters followed by optional flags) used to match the name. |
| 32 | +- `disallowName` - As with `allowName` but indicates names that are not |
| 33 | + allowed. |
| 34 | +- `replacement` - If `disallowName` is supplied and this value is present, it |
| 35 | + will replace the matched `disallowName` text. |
| 36 | + |
| 37 | +- `context` - AST to confine the allowing or disallowing to jsdoc blocks |
| 38 | + associated with a particular context. See the |
| 39 | + ["AST and Selectors"](#eslint-plugin-jsdoc-advanced-ast-and-selectors) |
| 40 | + section of our README for more on the expected format. |
| 41 | +- `comment` - As with `context` but AST for the JSDoc block comment and types |
| 42 | + |
| 43 | +- `message` - An optional custom message to use when there is a match. |
| 44 | + |
| 45 | +Note that `comment`, even if targeting a specific tag, is used to match the |
| 46 | +whole block. So if a `comment` finds its specific tag, it may still apply |
| 47 | +fixes found by the likes of `disallowName` even when a different tag has the |
| 48 | +disallowed name. An alternative is to ensure that `comment` finds the specific |
| 49 | +tag of the desired tag and/or name and no `disallowName` (or `allowName`) is |
| 50 | +supplied. In such a case, only one error will be reported, but no fixer will |
| 51 | +be applied, however. |
| 52 | + |
| 53 | +||| |
| 54 | +|---|---| |
| 55 | +|Context|everywhere| |
| 56 | +|Tags|(The tags specifie by `tags`, including any tag if `*` is set)| |
| 57 | +|Recommended|false| |
| 58 | +|Settings|`structuredTags`| |
| 59 | +|Options|`match`| |
| 60 | + |
| 61 | +<!-- assertions matchName --> |
0 commit comments