Open kuceb opened 5 years ago
Wouldn't it be more reasonable and easier to use JSON5 for this?
@Berkmann18 I know JSON5 can parse jsonc, but can it format it? The problem isn't the parsing, it's the formatting
Ah! I see. AFAIK, the json5
package can do that (well kind of) the same way you'll format JSON data using JSON.stringify
.
@Berkmann18 the problem is you'd lose comments, which is what happens today if you use this plugin to formal jsonc
Oh, good point!
Currently, this package does not lint/format
jsonc
files.I've looked into how
vscode
doesjsonc
parsing using https://github.com/Microsoft/node-jsonc-parser, which creates an AST, but haven't done the work to translate that into ESLint fixes.jsonc-parser
to format json-with-comments filesThis would be nice for:
tsconfig.json
,.vscode/*.json