dprint / dprint-plugin-json

JSON code formatting plugin for dprint.
https://dprint.dev/plugins/json
MIT License
19 stars 5 forks source link

feat: add jsonTrailingCommaFiles #28

Closed dsherret closed 1 year ago

dsherret commented 1 year ago

This makes it that someone needs to explicitly opt into special file handling for json as jsonc.

Reasons:

  1. Treating .json files (event tsconfig.json) can cause problems in some respositories, leading to them needing to disable trailing commas for even jsonc: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/67139
  2. Someone may want this behaviour for more than just tsconfig.json (ex. for also tsconfig.base.json).
  3. Seems better for people to determine what works for their project or not.

To get the previous config someone can specify something like:

  "jsonTrailingCommaFiles": ["tsconfig.json", ".vscode/settings.json"]

FYI @Zamiell