Skip to content

Redundant empty line in jsdoc #11

@subframe7536

Description

@subframe7536

Describe the bug

The generated dts file may contains redundant empty lines.

Generated dist/migrator.d.ts

import { SchemaUpdater } from "./types.d-CKogjk-3.js";
import { Migration, MigrationProvider, MigratorProps } from "kysely";

//#region src/migrator/code-provider.d.ts
/**
* Create provider inside code
* @param migrations kysely migration, support Record or Array
* @param idLength index id length, default is 8
* @example
* ```ts
* import { createCodeProvider, useMigrator } from 'kysely-sqlite-builder/migrator'
*
* const provider = createCodeProvider({
*   '2024-01-01': {
*     up: async (db) => {
*       await db.schema.createTable('test').ifNotExists().column('name', 'text').execute()
*     }
*   },
*   '2024-01-02': {
*     up: async (db) => {
*       await db.schema.alterTable('test').addColumn('age', 'integer').execute()
*     },
*     down: async (db) => {
*       await db.schema.alterTable('test').dropColumn('age').execute()
*     }
*   }
* })
* await db.syncDB(useMigrator(provider, options))
*
* // or use array
* const providerArray = createCodeProvider([
*   {
*     up: async (db) => {
*       await db.schema.createTable('test').ifNotExists().column('name', 'text').execute()
*     }
*   },
*   {
*     up: async (db) => {
*       await db.schema.alterTable('test').addColumn('age', 'integer').execute()
*     },
*     down: async (db) => {
*       await db.schema.alterTable('test').dropColumn('age').execute()
*     }
*   }
* ])
* await db.syncDB(useMigrator(providerArray, options))
* ```
*/
declare function createCodeProvider(migrations: Record<string, Migration> | Migration[], idLength?: number): MigrationProvider;

//#endregion
//#region src/migrator/index.d.ts
/**

* Use migrator to migrate to latest

* @param provider migration provider

* @param options migrator options

*/
declare function useMigrator(provider: MigrationProvider, options?: Omit<MigratorProps, "db" | "provider">): SchemaUpdater;

//#endregion
export { createCodeProvider, useMigrator };

Fixed by modify this line

code: dtsMap.get(id)!.code,

to

code: dtsMap.get(id).code.split('\n').filter(l => l.trim().length).join('\n')

Reproduction

subframe7536/kysely-sqlite-builder#4

System Info

Windows 11

Used Package Manager

bun

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

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