-
-
Notifications
You must be signed in to change notification settings - Fork 163
Description
Note: This needs to be reviewed, as others not marked as such may have since been implemented.
This is a request for a rule to validate descriptions more precisely based on the tag.
While this would be a lot of work, here is one more immediate to-do:
-
no-undefined-types
might use the pattern ofvalid-types
to check for types within tags recognized as having a type. - Handle assorted other tags in rules like
require-description
,require-description-complete-sentence
, and especiallymatch-description
(see below)
Ported from eslint/eslint#11043
When a JSDoc code comment has certain tags present elsewhere in a block (and which is not one of those covered by the function/class-based detection of the current behavior), a description that fails to match the regular expression of matchDescription
(or equivalent separate config) should also be able to apply.
Note that some of these may now be possible in match-description
, though perhaps these as possibilities may be made explicit there.
These tags should, as I see it, be comprised of:
- Flagging an object of potentially broad purpose calling for a description
@module
,@mixin
,@namespace
,@external
/@host
- Though more specialized in some ways,
@typedef
,@event
objects may also be of enough importance for a description -
@interface
if present should call for a description, particularly when within virtual comments where the lack of an associated function or class would necessitate its own warning - While these may or may not be of general interest, they are generic enough that they may merit requiring a description as well:
@global
,@kind
and@type
-
@variation
,@version
, and@since
, though more concrete, typically are associated with documentation as well
Besides certain tags flagging the need for a description by their presence, certain other tags require a description and I think there should be an option for matchDescription
to match within these tags.
-
@summary
and@file
/@fileoverview
/@overview
, fields which are descriptive in content and broad in purpose - While the current code checks classes, I'm not sure whether
@classdesc
can occur separately from a class, e.g., as its own separate comment, and if so, its text should also be queryable. - Some additional fields, though fairly specialized, like
@copyright
,@example
,@see
,@todo
also have descriptive text areas which should never or rarely be empty;@throws
/@exception
,@yields
/@yield
and@property
/@prop
do likewise along with a possible type (and@property
/@prop
with a name as well) -
@deprecated
might be better filled (to point to a replacement) - allows free form text but really shouldn't be empty (
@throws
,@exception
)
Other tags may expect something additional and would be worthy of having a rule, but are less like "descriptions":
-
@author
(with name and email; partly implemented but could allow checking againstpackage.json
contributors
andauthor
fields) - a concrete technical name (
@class
(optional),@constructs
(optional));@event
or@fires
/@emits
or@listens
(<className>#[event:]<eventName>
),@exports
,@external
/@host
,@function
(optional),@interface
,@mixin
,@requires
- a choice of names (
@kind
) feat(check-values
): add checking ofkind
#837 - a type
@enum
(optional),@implements
;@package
(for Closure only),@private
(for Closure only),@protected
(for Closure only); not@public
or@static
for Closure?;@throws
/@exception
,@type
,@typedef
(type and name path)) - a type and name (
@constant
/@const
(optional),@member
/@var
,@module
,@namespace
) - a name path (
@alias
,@augments
/@extends
,@borrows
(namepath "as" namepath),@callback
,@lends
,@memberof
,@mixes
,@name
,@see
,@this
,@tutorial
) - a value (
@default
/@defaultvalue
) Lint default param/property values and@default
/@defaultvalue
#473 - a version or identifier (
@license
,@since
,@version
) - a status (
@access
(package|private|protected|public) - a link (
@link
/@linkcode
/@linkplain
) - inline identifier reference (block and inline
@tutorial
should point to config file tutorial IDs)
...and thus seem less like "descriptions" as per the rule name under discussion).
And a few seem they might benefit from insisting on no description as they don't seem to allow it:
-
@abstract
,@async
,@generator
,@global
,@hideconstructor
,@ignore
,@inheritdoc
,@inner
,@instance
,@override
,@readonly
(and see access types above referencing Closure under types above)
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.