Skip to content

Commit 767a788

Browse files
henriklundgrengajus
authored andcommitted
fix: @ private skip require checks (#86)
* fix: @Private skip require checks * style: fix lint issues
1 parent e496523 commit 767a788

File tree

4 files changed

+28
-2
lines changed

4 files changed

+28
-2
lines changed

src/rules/requireExample.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,15 @@ export default iterateJsdoc(({
1212
tag: targetTagName
1313
});
1414

15+
if (utils.hasTag('private')) {
16+
return;
17+
}
18+
1519
if (_.isEmpty(functionExamples)) {
16-
return report('Missing JSDoc @' + targetTagName + ' declaration.');
20+
report('Missing JSDoc @' + targetTagName + ' declaration.');
1721
}
1822

19-
return _.forEach(functionExamples, (example) => {
23+
_.forEach(functionExamples, (example) => {
2024
const exampleContent = _.compact((example.name + ' ' + example.description).trim().split('\n'));
2125

2226
if (_.isEmpty(exampleContent)) {

src/rules/requireParam.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ export default iterateJsdoc(({
88
const functionParameterNames = utils.getFunctionParameterNames();
99
const jsdocParameterNames = utils.getJsdocParameterNames();
1010

11+
if (utils.hasTag('private')) {
12+
return;
13+
}
14+
1115
// inheritdoc implies that all documentation is inherited; see http://usejsdoc.org/tags-inheritdoc.html
1216
if (utils.hasTag('inheritdoc')) {
1317
return;

test/rules/assertions/requireExample.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,15 @@ export default {
6767
*/
6868
function quux () {
6969
70+
}
71+
`
72+
},
73+
{
74+
code: `
75+
/**
76+
* @private
77+
*/
78+
function quux () {
7079
}
7180
`
7281
}

test/rules/assertions/requireParam.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,15 @@ export default {
133133
allowOverrideWithoutParam: true
134134
}
135135
}
136+
},
137+
{
138+
code: `
139+
/**
140+
* @private
141+
*/
142+
function quux (foo) {
143+
}
144+
`
136145
}
137146
]
138147
};

0 commit comments

Comments
 (0)