-
-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
publicOnly ignored when inside public functions that are missing jsdoc #812
Comments
This is a bit of an edge case, and only really relevant when applying eslint-plugin-jsdoc to code that didn't already use it. |
The applying of eslint-plugin-jsdoc to code that didn't already use it is handled within the Since the other example should trigger the rule since the main export is missing jsdoc, it appears you mean that what is happening is that we are misreporting the line number for |
Ah testing locally, it appears instead that we are reporting both the inner and outer in such a case when we should only be reporting one... |
Yes, that's what I'd meant. Sorry for the confusion! Outer correctly reports an error, but inner also reports an error, incorrectly. It's only really an issue when the fixer is enabled, as it creates an extra comment block. |
This is somewhat of a hackish solution, but will hopefully do the trick. |
🎉 This issue has been resolved in version 37.2.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Wow that was fast, thanks! That's fixed the problem with nested function declarations, but an equivalent problem still occurs with nested arrow functions. i.e. with export const outer = () => {
const inner = () => {
console.log('foo');
};
inner();
}; and here: export function outer() {
const inner = () => {
console.log('foo');
};
inner();
}; but not here: export const outer = () => {
function inner() {
console.log('foo');
}
inner();
}; My apologies for not mentioning arrow functions previously. Would you like me to raise a separate ticket? |
🎉 This issue has been resolved in version 37.2.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Superb, thanks! |
When the
publicOnly
option is specified, the rule seems to be triggered for local functions within public members, if the public member itself lacks jsdoc. This is similar to #654, but with an extra caveat.Expected behavior
Local (nested) functions should not trigger a linter failure if not documented, regardless of whether the enclosing public function is missing required jsdoc.
Actual behavior
Local (nested) functions trigger a linter failure if not documented, but only when the enclosing public function is missing required jsdoc.
ESLint Config
ESLint sample
The
inner
function here triggers the rule:But the
inner
function here does not:Environment
eslint-plugin-jsdoc
version: 37.2.0The text was updated successfully, but these errors were encountered: