Skip to content

lines-before-block should not trigger for the first item inside functions and constructors #1379

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

Closed
LukeAbby opened this issue May 9, 2025 · 1 comment · Fixed by #1383
Closed

Comments

@LukeAbby
Copy link
Contributor

LukeAbby commented May 9, 2025

ESLint Config

{
    "jsdoc/lines-before-block": "error"
}

ESLint sample

declare class SomeClass {
  // Not ok:
  constructor(
    /** Some doc */
    param: number,
  );

  // Not ok:
  method(
    /** Some doc */
    param: number,
  ): void;

  // Ok:
  /** Some doc */
  prop: number;
}

// Not ok:
type SomeFunctionAlias =
   /**
     * @param param - Some doc.
     */
    (param: number) => void;

// Not ok:
type SomeFunctionAlias2 = (
   /**
     * @param param - Some doc.
     */
    param: number
) => void;

Environment

  • Node version: v20.15.0
  • ESLint version v9.26.0
  • eslint-plugin-jsdoc version: ^50.6.11

Expected behavior

I expected there to be a configuration option to be able to avoid having to add newlines before all of the places linted in that snippet.

Actual behavior

The rule requires adding a newline but this causes conflicts with Prettier. Subjectively I also think it looks ugly.

Copy link

🎉 This issue has been resolved in version 50.6.13 🎉

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

Successfully merging a pull request may close this issue.

1 participant