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

Prevent line break between JSDoc comment and following (non comment) statement #1211

Open
thislooksfun opened this issue Mar 5, 2024 · 1 comment

Comments

@thislooksfun
Copy link

Motivation

Currently it's possible to write the following code. Notice the space between
the comment and the function its describing. This is perfectly valid, but is
stylistically bad (in my opinion), and I'd like a rule to prevent (and hopefully
auto-fix) this scenario.

/**
 * This is a description of some function!
 */

function someFunction() {
   // ...
}

Current behavior

There is no such rule.

Desired behavior

I would like a new rule with the following behavior:

This should be considered an error:

/** This is a description of some function!*/

function someFunction() {}

These should not be considered errors:

/** This is a description of some function! */
// extra comment
function someFunction() {}
/** Standalone comment (e.g. a type definition) */

/** The actual description */
function someFunction() {}
/* Regular block comment */

function someFunction() {}
// Regular line comment

function someFunction() {}

Alternatives considered

This could maybe be done with other rules, but I couldn't find any other rule or combination of rules that would apply specifically to doc comments and not all block comments.

@brettz9
Copy link
Collaborator

brettz9 commented Mar 5, 2024

Any such rule should leverage maxLines and minLines from settings.

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

2 participants