toonvanstrijp / nestjs-i18n

The i18n module for nestjs.
https://nestjs-i18n.com
Other
624 stars 102 forks source link

Configure Line Ending for generated types #587

Closed tkalmar closed 8 months ago

tkalmar commented 8 months ago

Clear and concise description of the problem

As a developer i want to implement my application typesafe and therefore i use the type-generation provided by this library. I work in an team and some people are using windows where others are using mac or linux. The generated source file for the types is under source control so we need a way to control the line ending of the generated files. At the moment linux/mac users get 'lf' line endings where windows user get 'crlf' line endings. This makes it hard to spot changes in the generated file because the diff is most the whole file because of different line endings

Suggested solution

Would be great to have an configuration option for this

Alternative

use the newLine CompilerOption so we can override the behaviour in tsconfig.json

Additional context

No response

Validations

rubiin commented 8 months ago

You can always use lint-staged to run prettier on such files. Nevertheless, will add that missing config

tkalmar commented 8 months ago

Does this config influence how code is generated in projects which use this module? i doubt it, with use the newLine CompilerOption so we can override the behaviour in tsconfig.json i meant to read the value from our config and change perhaps the printer here: https://github.com/toonvanstrijp/nestjs-i18n/blob/main/src/utils/typescript.ts#L45 to use the configuration if available and not fallback to the plattform default