Skip to content

Commit c5b8e09

Browse files
committed
fix(empty-tags): ensure rule is still checked when a private tag 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.
1 parent 47198cb commit c5b8e09

File tree

4 files changed

+39
-0
lines changed

4 files changed

+39
-0
lines changed

.README/rules/empty-tags.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ is set to "closure" (which allows types).
2323
- `@public`
2424
- `@static`
2525

26+
Note that `@private` will still be checked for content by this rule even with
27+
`settings.jsdoc.ignorePrivate` set to `true` (a setting which normally
28+
causes rules not to take effect).
29+
2630
#### Options
2731

2832
##### `tags`

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3594,6 +3594,10 @@ is set to "closure" (which allows types).
35943594
- `@public`
35953595
- `@static`
35963596
3597+
Note that `@private` will still be checked for content by this rule even with
3598+
`settings.jsdoc.ignorePrivate` set to `true` (a setting which normally
3599+
causes rules not to take effect).
3600+
35973601
<a name="eslint-plugin-jsdoc-rules-empty-tags-options-7"></a>
35983602
#### Options
35993603
@@ -3652,6 +3656,15 @@ function quux () {
36523656
36533657
}
36543658
// Message: @private should be empty.
3659+
3660+
/**
3661+
* @private {someType}
3662+
*/
3663+
function quux () {
3664+
3665+
}
3666+
// Settings: {"jsdoc":{"ignorePrivate":true}}
3667+
// Message: @private should be empty.
36553668
````
36563669
36573670
The following patterns are not considered problems:

src/rules/emptyTags.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export default iterateJsdoc(({
3838
}
3939
});
4040
}, {
41+
checkPrivate: true,
4142
iterateAllJsdocs: true,
4243
meta: {
4344
fixable: 'code',

test/rules/assertions/emptyTags.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,27 @@ export default {
101101
},
102102
],
103103
},
104+
{
105+
code: `
106+
/**
107+
* @private {someType}
108+
*/
109+
function quux () {
110+
111+
}
112+
`,
113+
errors: [
114+
{
115+
line: 3,
116+
message: '@private should be empty.',
117+
},
118+
],
119+
settings: {
120+
jsdoc: {
121+
ignorePrivate: true,
122+
},
123+
},
124+
},
104125
],
105126
valid: [
106127
{

0 commit comments

Comments
 (0)