Skip to content

Support JSONC for tsconfig.json #42

@timbrinded

Description

@timbrinded

Just starting off with borp, and the first thing i've seen is that it has issues with typical tsconfig files.

1. Doesn't support comments

{
	"compilerOptions": {
		"incremental": true,

		// Enable latest features
		"lib": ["ESNext", "ESNext.Disposable"],
		"target": "ESNext",


		// Bundler mode
		"moduleResolution": "bundler",
		"allowImportingTsExtensions": true,

		// Some stricter flags
		"noUnusedLocals": true,
		"noUnusedParameters": true,
		"noPropertyAccessFromIndexSignature": true,

		"downlevelIteration": true // Ensure async iteration is supported
	}
}

gives error:

❯ pnpm borp
SyntaxError: Expected double-quoted property name in JSON at position 50 (line 5 column 3)
    at JSON.parse (<anonymous>)
    at runWithTypeScript (file:///home/timbo/workspace/repo/node_modules/.pnpm/borp@0.14.0/node_modules/borp/lib/run.js:59:27)
    at async file:///home/timbo/workspace/repo/node_modules/.pnpm/borp@0.14.0/node_modules/borp/borp.js:126:18

2. Doesn't support extends

{
	"extends": "../tsconfig.json",
}

gives error:

❯ pnpm borp
SyntaxError: Expected double-quoted property name in JSON at position 34 (line 3 column 1)
    at JSON.parse (<anonymous>)
    at runWithTypeScript (file:///home/timbo/workspace/repo/node_modules/.pnpm/borp@0.14.0/node_modules/borp/lib/run.js:59:27)
    at async file:///home/timbo/workspace/repo/node_modules/.pnpm/borp@0.14.0/node_modules/borp/borp.js:126:18

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions