privatenumber / pkgroll

📦 Zero-config package bundler for Node.js + TypeScript
MIT License
1.21k stars 29 forks source link

Styles in `.editorconfig` aren't applied to type definition file #96

Closed rtritto closed 1 month ago

rtritto commented 1 month ago

Problem

I'm using a .editorconfig with indent_style = space and indent_size = 2. These settings, on bundle dist, the indent_size = 2 setting is applied only to index.mjs and not to generated index.d.mts.

Current output where indent size is 4:

// /dist/index.d.mts
declare const autoloadRoutes: ({ parameter1 }: {
    parameter1?: string;
}) => boolean;

export { autoloadRoutes };

Expected behavior

// /dist/index.d.mts
declare const autoloadRoutes: ({ parameter1 }: {
  parameter1?: string;
}) => boolean;

export { autoloadRoutes };

Minimal reproduction URL

https://github.com/rtritto/test-pkgroll/tree/bug-styles-type-definition

Version

2.5.0

Node.js version

22.9.0

Package manager

yarn

Operating system

Windows

Bugs are expected to be fixed by those affected by it

Compensating engineering work financially will speed up resolution

privatenumber commented 1 month ago

Thank you for reporting this. However, please note that pkgroll is a bundler, and the files in the output (such as index.d.mts) are compiled files meant to be consumed by programs, not necessarily formatted for human readability. As such, they aren't expected to adhere to .editorconfig settings, which is standard behavior across bundlers.

If you need the output to follow a specific format, I recommend passing the files through a tool like Prettier or using ESLint's autofix feature after bundling.