Skip to content

Commit

Permalink
feat(check-tag-names): allow rejecting normally valid tag names and/o…
Browse files Browse the repository at this point in the history
…r providing custom error messages when suggesting tags to reject or replace (fixes #108)

Reporting normally valid tags may be of interest for tags like `@todo`. This is implemented by allowing the user to set targeted `tagNamePreference` tags to `false` or to an object with only a `message` and no `replacement`

Custom messages for `check-tag-names` are implemented by allowing the user to set targeted `tagNamePreference` tags to an object with `message` and `replacement` (mirroring `preferredTypes` behavior). Note that for other rules leveraging `tagNamePreference` (via `utils.getPreferredTagName`) to find the user's preferred tag name, the `replacement` will be used in the likes of error messages but not the `message`.

Also, for various (param, return, and description-related) rules which have used `tagNamePreference` (via the `utils.getPreferredTagName` utility), report to user if they have blocked (probably inadvertently) and not indicated a replacement for the relevant tag needed by the rule in the `tagNamePreference` setting.

Also, ensure `require-param-name` and `check-examples` report preferred tag name (not necessarily `param` or `example`, respectively) and err if `example` is a rejected tag
  • Loading branch information
brettz9 committed Jul 5, 2019
1 parent 609d57b commit a367c48
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/iterateJsdoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,11 @@ const getSettings = (context) => {
// `check-tag-names` and many require/param rules
settings.tagNamePreference = _.get(context, 'settings.jsdoc.tagNamePreference') || {};

// `require-param`, `require-description`, `require-example`, `require-returns`
settings.overrideReplacesDocs = _.get(context, 'settings.jsdoc.overrideReplacesDocs');
settings.implementsReplacesDocs = _.get(context, 'settings.jsdoc.implementsReplacesDocs');
settings.augmentsExtendsReplacesDocs = _.get(context, 'settings.jsdoc.augmentsExtendsReplacesDocs');

// `check-tag-names` only
settings.additionalTagNames = _.get(context, 'settings.jsdoc.additionalTagNames') || {};

Expand All @@ -271,11 +276,6 @@ const getSettings = (context) => {
settings.captionRequired = Boolean(_.get(context, 'settings.jsdoc.captionRequired'));
settings.noDefaultExampleRules = Boolean(_.get(context, 'settings.jsdoc.noDefaultExampleRules'));

// `require-param`, `require-description`, `require-example`, `require-returns`
settings.overrideReplacesDocs = _.get(context, 'settings.jsdoc.overrideReplacesDocs');
settings.implementsReplacesDocs = _.get(context, 'settings.jsdoc.implementsReplacesDocs');
settings.augmentsExtendsReplacesDocs = _.get(context, 'settings.jsdoc.augmentsExtendsReplacesDocs');

// `require-param` only (deprecated)
settings.allowOverrideWithoutParam = _.get(context, 'settings.jsdoc.allowOverrideWithoutParam');
settings.allowImplementsWithoutParam = _.get(context, 'settings.jsdoc.allowImplementsWithoutParam');
Expand Down

0 comments on commit a367c48

Please sign in to comment.