jsverse/transloco-keys-manager

Feature: parse config files with comments and trailing commas

vkrol opened this issue · 0 comments

vkrol commented

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe

@angular/cli allows us to have comments and commas in the configuration files, but transloco-keys-manager uses cosmiconfig which uses a strict JSON parser that prohibits this.

Describe the solution you'd like

Suggested solution: use the loaders option https://github.com/davidtheclark/cosmiconfig#loaders of the cosmiconfig library to override the parser for JSON files and use jsonc-parser https://www.npmjs.com/package/jsonc-parser instead of the strict parser. jsonc-parser is chosen because it has been used recently in @angular/cli angular/angular-cli@04c6acc#diff-9f6a6f625c893e60dee5d065adb03321a3c48b8e734bba33d9324bcf767d7590R12.

Describe alternatives you've considered

Leave it as is, but in this case, transloco-keys-manager can't be used in those projects that use comments or trailing commas in angular.json, workspace.json, or project.json.

Describe alternatives you've considered

--

Describe alternatives you've considered

--

Additional context

The solution to a similar problem in vscode-angular-schematics: cyrilletuzi/vscode-angular-schematics#168.
Nx also uses jsonc-parser: nrwl/nx#5859.

I would like to make a pull request for this feature

It's already created: #147.