Skip to content

Commit

Permalink
fix(empty-tags): ensure rule is still checked when a private tag …
Browse files Browse the repository at this point in the history
…is present despite even a `true` `ignorePrivate` setting.

This rule checks the `private` tag content so the rule should not be ignored even when the setting is present.
  • Loading branch information
brettz9 committed Dec 28, 2019
1 parent 47198cb commit c5b8e09
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .README/rules/empty-tags.md
Expand Up @@ -23,6 +23,10 @@ is set to "closure" (which allows types).
- `@public`
- `@static`

Note that `@private` will still be checked for content by this rule even with
`settings.jsdoc.ignorePrivate` set to `true` (a setting which normally
causes rules not to take effect).

#### Options

##### `tags`
Expand Down
13 changes: 13 additions & 0 deletions README.md
Expand Up @@ -3594,6 +3594,10 @@ is set to "closure" (which allows types).
- `@public`
- `@static`
Note that `@private` will still be checked for content by this rule even with
`settings.jsdoc.ignorePrivate` set to `true` (a setting which normally
causes rules not to take effect).
<a name="eslint-plugin-jsdoc-rules-empty-tags-options-7"></a>
#### Options
Expand Down Expand Up @@ -3652,6 +3656,15 @@ function quux () {
}
// Message: @private should be empty.
/**
* @private {someType}
*/
function quux () {
}
// Settings: {"jsdoc":{"ignorePrivate":true}}
// Message: @private should be empty.
````
The following patterns are not considered problems:
Expand Down
1 change: 1 addition & 0 deletions src/rules/emptyTags.js
Expand Up @@ -38,6 +38,7 @@ export default iterateJsdoc(({
}
});
}, {
checkPrivate: true,
iterateAllJsdocs: true,
meta: {
fixable: 'code',
Expand Down
21 changes: 21 additions & 0 deletions test/rules/assertions/emptyTags.js
Expand Up @@ -101,6 +101,27 @@ export default {
},
],
},
{
code: `
/**
* @private {someType}
*/
function quux () {
}
`,
errors: [
{
line: 3,
message: '@private should be empty.',
},
],
settings: {
jsdoc: {
ignorePrivate: true,
},
},
},
],
valid: [
{
Expand Down

0 comments on commit c5b8e09

Please sign in to comment.