Skip to content

Add option to insert blank lines before JSDoc comments #244

Description

@azat-io

Currently, there's no way to automatically add spacing before JSDoc comments, which can make interfaces and objects with many documented properties hard to read. I would like to be able to do that.

Before:

/** CSP policy configuration */
export interface CSPPolicy {
  /** Map of CSP directives to their values */
  directives?: Partial<Record<CSPDirective, CSPDirectiveValue>>
  /** Hash algorithm to use for inline scripts and styles */
  hashAlgorithm?: 'sha256' | 'sha384' | 'sha512'
  /** Whether to add hashes for inline scripts */
  useScriptHashes?: boolean
}

After:

/** CSP policy configuration */
export interface CSPPolicy {
  /** Map of CSP directives to their values */
  directives?: Partial<Record<CSPDirective, CSPDirectiveValue>>

  /** Hash algorithm to use for inline scripts and styles */
  hashAlgorithm?: 'sha256' | 'sha384' | 'sha512'

  /** Whether to add hashes for inline scripts */
  useScriptHashes?: boolean
}

Proposed solution

Add a new option like jsdocSpacingBefore or jsdocPaddingBefore that would:

  • Add a blank line before JSDoc comments.
  • Work for property/field documentation in interfaces, types, and objects.
  • Be configurable (boolean, defaulting to false for backward compatibility).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions