Skip to content

Rule (or check-tag-names option) to check that tags do not appear in wrong context #466

@brettz9

Description

@brettz9

Ensure that the following tags are not present except on their given context (with a few only if another tag is present):

  • Only on functions or global: @param, @returns, @async, @generator, @constructs, @fires, @interface, @listens, @this, @yields, and possibly @override for some projects
  • Only on classes or functions: @class, @classdesc, @constructor, @hideconstructor, @implements (there is a rule for this, but it could be removed in favor of this rule; this one can also be global with @callback/@function)
  • Only on objects: possibly these if so chosen by a project: @enum, @event, @mixes, @mixin, @namespace
  • Only on objects (possibly requiring @namespace?) or global (if with @typedef): @property
  • Only with const keyword: @constant/@const
  • Only at global level: @external (@file too but adding with a new proposed rule), @function (don't really need except with interfaces), @callback, @typedef, @author, @module, (@license/@copyright if project determines so by option)
  • Not global: All tags besides those in the previous category and, unless accompanied by a @function or @callback tag, the function tags (which can be a part of interface); exceptions might include: @todo, @tutorial, @see, @description

Such a rule which checked all contexts for unexpected tags might also optionally prohibit overly generic tags being used when a more specific tag existed for that context, e.g., @name when @function was possible (or not even needed).


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions