Skip to content

Remove preferredTypesDefined option, applying it automatically instead #304

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 4 additions & 21 deletions .README/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ Or one may set the targeted tag to an object with a custom `message`, but withou
}
```

Note that the preferred tags indicated in the `settings.jsdoc.tagNamePreference`
map will be assumed to be defined by `check-tag-names`.

The defaults in `eslint-plugin-jsdoc` (for tags which offer
aliases) are as follows:
Expand Down Expand Up @@ -236,24 +238,6 @@ This setting is utilized by the the rule for tag name checking
- `require-returns-description`
- `require-returns-type`

### Additional Tag Names

Use `settings.jsdoc.additionalTagNames` to configure additional, allowed JSDoc
tags in the rule `check-tag-names`. The format of the configuration is as follows:

```json
{
"rules": {},
"settings": {
"jsdoc": {
"additionalTagNames": {
"customTags": ["define", "record"]
}
}
}
}
```

### `@override`/`@augments`/`@extends`/`@implements` Without Accompanying `@param`/`@description`/`@example`/`@returns`

The following settings allows the element(s) they reference to be omitted
Expand Down Expand Up @@ -331,9 +315,8 @@ but restricted to `@param`. These settings are now deprecated.
`{{preferredType}}` (or `{{replacement}}`), noting that the latter is
of no use when one is merely forbidding a type).

If `no-undefined-types` has the option key `preferredTypesDefined` set to
`true`, the preferred types indicated in the `settings.jsdoc.preferredTypes`
map will be assumed to be defined.
Note that the preferred types indicated as targets in `settings.jsdoc.preferredTypes`
map will be assumed to be defined by `no-undefined-types`.

See the option of `check-types`, `unifyParentAndChildTypeChecks`, for
how the keys of `preferredTypes` may have `<>` or `.<>` (or just `.`)
Expand Down
18 changes: 17 additions & 1 deletion .README/rules/check-tag-names.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,26 @@ version
yields
```

Note that the tags indicated as replacements in `settings.jsdoc.tagNamePreference` will automatically be considered as valid.

#### Options

##### `definedTags`

Use an array of `definedTags` strings to configure additional, allowed JSDoc tags.
The format is as follows:

```json
{
"definedTags": ["define", "record"]
}
```

|||
|---|---|
|Context|everywhere|
|Tags|N/A|
|Settings|`tagNamePreference`, `additionalTagNames`|
|Options|`definedTags`|
|Settings|`tagNamePreference`|

<!-- assertions checkTagNames -->
10 changes: 5 additions & 5 deletions .README/rules/no-undefined-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ The following types are always considered defined.
- `any`, `*`
- `Array`, `Object`, `RegExp`, `Date`, `Function`

Note that preferred types indicated within `settings.jsdoc.preferredTypes` will
also be assumed to be defined.

#### Options

An option object may have the following keys:
An option object may have the following key:

- `preferredTypesDefined` - If this option is set to `true` and preferred
types are indicated within `settings.jsdoc.preferredTypes`, any such
types will be assumed to be defined as well. Defaults to `false`.
- `definedTypes` - This array can be populated to indicate other types which
are automatically considered as defined (in addition to globals, etc.).
Defaults to an empty array.
Expand All @@ -37,7 +37,7 @@ An option object may have the following keys:
|Tags|`class`, `constant`, `enum`, `implements`, `member`, `module`, `namespace`, `param`, `property`, `returns`, `throws`, `type`, `typedef`, `yields`|
|Aliases|`constructor`, `const`, `var`, `arg`, `argument`, `prop`, `return`, `exception`, `yield`|
|Closure-only|`package`, `private`, `protected`, `public`, `static`|
|Options|`preferredTypesDefined`, `definedTypes`|
|Options|`definedTypes`|
|Settings|`preferredTypes`|

<!-- assertions noUndefinedTypes -->
Loading