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

check-alignment has false-positive when not using star prefixes #1351

Open
sindresorhus opened this issue Jan 21, 2025 · 1 comment
Open

Comments

@sindresorhus
Copy link

Expected behavior

I expected this to be allowed:

/**
@param {string} text
*/
const a = x => x;

When not using star prefix, the proper alignment means that the start and end of the comment don't have any indentation.

For example, this should be caught:

/**
@param {string} text
 */
const a = x => x;

Actual behavior

It complains.

ESLint Config

{
  'jsdoc/check-alignment': 'error'
}

ESLint sample

Already shared.

Environment

  • Node version: 22.12.0
  • ESLint version 9.18
  • eslint-plugin-jsdoc version: 50.6.2
@brettz9
Copy link
Collaborator

brettz9 commented Jan 22, 2025

That would be contrary to how the rule currently works. The rule tries to align against the first asterisk in a straight line. It is also the pattern used on the JSDoc site.

I suppose we could in theory add an option to enforce the following pattern which dropped the space (or potentially others like aligning on the second asterisk):

/**
* // With asterisks
*/
function quux () {}
/**
 // Without asterisks
*/
function quux () {}

I'm personally not inclined to work on it, and I'm personally a little ambivalent about encouraging deviation from more standard patterns, but given our general support for different styles, I suppose we could accept a PR.

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