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

Require that "*/" go on its own line for multiline blocks #738

Closed
danvk opened this issue May 16, 2021 · 4 comments · Fixed by #739
Closed

Require that "*/" go on its own line for multiline blocks #738

danvk opened this issue May 16, 2021 · 4 comments · Fixed by #739

Comments

@danvk
Copy link

danvk commented May 16, 2021

Motivation

I'd like to require that the trailing */ in multiline comments go on its own line:

Bad:

/**
 * This is a multline
 * jsdoc comment with a bad ending */

Good:

/**
 * This is a multline
 * jsdoc comment with a good ending
 */

Current behavior

The multiline-blocks rule distinguishes single and multiline block forms, but does not enforce that the ending */ be on its own line for multiline blocks.

Desired behavior

I'd like to enforce that the */ go on its own line for multiline comments.

So this would be an error:

/**
 * This is a multline
 * jsdoc comment with a bad ending */

It's important to allow this for one line comments, hwoever:

/** This is a single line jsdoc comment with a fine ending. */

Alternatives considered

The no-multi-asterisks rule feels somewhat related but also does not enforce this. See #199 (comment)

@brettz9
Copy link
Collaborator

brettz9 commented May 16, 2021

Sounds good...I'd like to add this as a noFinalLineText option on multiline-blocks (as a complement to the existing noZeroLineText option).

@brettz9
Copy link
Collaborator

brettz9 commented May 16, 2021

By the way, although no-multi-asterisks currently changes:

      /**
       * Desc.
       *
       * */

to the misaligned:

      /**
       * Desc.
       *
        */

...I think this is ok because the whitespace was indeed there and we have the check-alignment rule to handle the alignment.

For the proposed noFinalLineText, I similarly don't think the rule should be checking for such cases of a delimiter and whitespace preceding the */--only for non-whitespace text since the other rules handle this.

brettz9 added a commit to brettz9/eslint-plugin-jsdoc that referenced this issue May 16, 2021
brettz9 added a commit to brettz9/eslint-plugin-jsdoc that referenced this issue May 16, 2021
brettz9 added a commit to brettz9/eslint-plugin-jsdoc that referenced this issue May 16, 2021
brettz9 added a commit to brettz9/eslint-plugin-jsdoc that referenced this issue May 17, 2021
@gajus
Copy link
Owner

gajus commented May 17, 2021

🎉 This issue has been resolved in version 34.7.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@gajus gajus added the released label May 17, 2021
@danvk
Copy link
Author

danvk commented May 18, 2021

Confirmed that this is working exactly as I'd hoped on my repo. Thanks so much @brettz9!

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

Successfully merging a pull request may close this issue.

3 participants