Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

does not support JSONC #32

Closed
Zamiell opened this issue Dec 15, 2023 · 5 comments · Fixed by #33
Closed

does not support JSONC #32

Zamiell opened this issue Dec 15, 2023 · 5 comments · Fixed by #33

Comments

@Zamiell
Copy link

Zamiell commented Dec 15, 2023

Hello, and thanks for the package.

I tried it out on my repo and got the following error:

$ npx duel
The config file found at D:\Repositories\foo\tsconfig.json is not parsable as JSON.

The error message implies that duel is parsing the "tsconfig.json" file using JSON. But that is a bug, because "tsconfig.json" files are not JSON files, they are JSONC files. JSONC is a format which allows both comments and trailing commas.

You are supposed to parse it with something like the following:

import JSONC from "jsonc-parser";

const json = JSONC.parse(fileContents);

I believe that this is how TypeScript itself parses it, as well as VSCode, and so on.

@knightedcodemonkey
Copy link
Owner

Thanks for the reminder that tsconfig.json is not really JSON.

Not strictly necessary, but if you could provide an example of your configuration that would be helpful.

@Zamiell
Copy link
Author

Zamiell commented Dec 16, 2023

Sure thing, the tsconfig.json that I was using is here: https://github.com/IsaacScript/isaacscript/blob/main/packages/isaacscript-common-ts/tsconfig.json

@knightedcodemonkey
Copy link
Owner

You want to give #33 a look over? Specifically, I did not add support for allowEmptyContent...

@Zamiell
Copy link
Author

Zamiell commented Dec 16, 2023

seems fine, thanks

@knightedcodemonkey
Copy link
Owner

Published to npm v1.0.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants