Skip to content
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 incorrectly triggered for local (nested) functions #654

Closed
Josmithr opened this issue Nov 5, 2020 · 1 comment
Closed

publicOnly incorrectly triggered for local (nested) functions #654

Josmithr opened this issue Nov 5, 2020 · 1 comment

Comments

@Josmithr
Copy link

Josmithr commented Nov 5, 2020

When the publicOnly option is specified, the rule seems to be triggered for local functions within public members. E.g. an exported function contains (as an implementation detail) a local function used by its own logic.

Expected behavior

Local (nested) function should not trigger a linter failure if not documented (since it is not public)

Actual behavior

Local (nested) function triggers a linter failure when not documented (despite not being public)

ESLint Config

I was able to reproduce the issue with this minimal configuration:

module.exports = {
	plugins: ['jsdoc'],
	rules: {
		'jsdoc/require-jsdoc': [
			'error',
			{
				publicOnly: true,
				enableFixer: false,
				require: {
					ClassDeclaration: true,
					ClassExpression: true,
					ArrowFunctionExpression: true,
					FunctionDeclaration: true,
					FunctionExpression: true,
					MethodDefinition: false,
				},
			},
		],
	},
};

ESLint sample

Simple example of a local function triggering the rule.

/**
 * Foo
 */
export function foo(): void {
	function bar(): void {
		console.log('bar');
	}

	console.log('foo');
}

eslint version: 7.12.1
eslint-plugin-jsdoc version: 30.7.6

@gajus
Copy link
Owner

gajus commented Nov 5, 2020

🎉 This issue has been resolved in version 30.7.7 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants