If you use typescript you can init a default tsconfig.json, and that json will have javascript // and /* */ comments in it. I've encountered a situation with ts-jest where I need to require my tsconfig and parse it, but jest is not parsing it because json doesn't allow comments. see this I'm not sure how typescript handles it, but it seems to deviate from the rule.
// this fails if tsconfig has comments
const tsconfig = require('./tsconfig')
I want to keep the comments because they are really helpful to understand and maintain my tsconfig.json, and I want to require my config to be able to avoid duplicating code and make things more dynamic.
Is there a way to require a json file with comments using nodejs?