Skip to content

Commit

Permalink
docs(valid-types): add mention of param and property as name-de…
Browse files Browse the repository at this point in the history
…fining tags
  • Loading branch information
brettz9 committed Jul 11, 2020
1 parent 36ad91f commit d4f2cfa
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
10 changes: 8 additions & 2 deletions .README/rules/valid-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ determine whether to use jsdoctypeparser's "permissive" mode or the stricter

Also impacts behaviors on namepath (or event)-defining and pointing tags:

1. Name(path)-defining tags requiring namepath: `@external`, `@host`, `@name`, `@typedef`
1. Name(path)-defining tags requiring namepath: `@external`, `@host`,
`@name`, `@typedef`; `@param` (`@arg`, `@argument`) and `@property`
(`@prop`) also fall into this category, but while this rule will check
their namepath validity, we leave the requiring of the name portion
to the rules `require-param-name` and `require-property-name`,
respectively.
1. Name(path)-defining tags (which may have value without namepath or their
namepath can be expressed elsewhere on the block): `@event`, `@callback`,
`@class`, `@constructor`, `@constant`, `@const`,
Expand All @@ -31,7 +36,8 @@ Also impacts behaviors on namepath (or event)-defining and pointing tags:
`false` as these tags might have some indicative value without a path
or may allow a name expressed elsewhere on the block (but sets 1 and 3 will
always fail if empty)
- For the special case of set 6, i.e., `@borrows <that namepath> as <this namepath>`,
- For the special case of set 6, i.e.,
`@borrows <that namepath> as <this namepath>`,
check that both namepaths are present and valid and ensure there is an `as `
between them. In the case of `<this namepath>`, it can be preceded by
one of the name path operators, `#`, `.`, or `~`.
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13499,7 +13499,12 @@ determine whether to use jsdoctypeparser's "permissive" mode or the stricter

Also impacts behaviors on namepath (or event)-defining and pointing tags:

1. Name(path)-defining tags requiring namepath: `@external`, `@host`, `@name`, `@typedef`
1. Name(path)-defining tags requiring namepath: `@external`, `@host`,
`@name`, `@typedef`; `@param` (`@arg`, `@argument`) and `@property`
(`@prop`) also fall into this category, but while this rule will check
their namepath validity, we leave the requiring of the name portion
to the rules `require-param-name` and `require-property-name`,
respectively.
1. Name(path)-defining tags (which may have value without namepath or their
namepath can be expressed elsewhere on the block): `@event`, `@callback`,
`@class`, `@constructor`, `@constant`, `@const`,
Expand All @@ -13521,7 +13526,8 @@ Also impacts behaviors on namepath (or event)-defining and pointing tags:
`false` as these tags might have some indicative value without a path
or may allow a name expressed elsewhere on the block (but sets 1 and 3 will
always fail if empty)
- For the special case of set 6, i.e., `@borrows <that namepath> as <this namepath>`,
- For the special case of set 6, i.e.,
`@borrows <that namepath> as <this namepath>`,
check that both namepaths are present and valid and ensure there is an `as `
between them. In the case of `<this namepath>`, it can be preceded by
one of the name path operators, `#`, `.`, or `~`.
Expand Down
5 changes: 3 additions & 2 deletions src/rules/validTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ export default iterateJsdoc(({
utils.tagMightHaveNamePosition(tag.tag)
) && Boolean(tag.name) && !(tag.tag === 'see' && !checkSeesForNamepaths);

// Don't handle `param` here though it does require name as handled by
// `require-param-name` and `require-property-name`
// Don't handle `@param` here though it does require name as handled by
// `require-param-name` (`@property` would similarly seem to require one,
// but is handled by `require-property-name`)
const mustHaveNameOrNamepathPosition = ![
'param', 'arg', 'argument',
'property', 'prop',
Expand Down

0 comments on commit d4f2cfa

Please sign in to comment.