Skip to content

Commit

Permalink
fix: reenable json5 parser
Browse files Browse the repository at this point in the history
continues #174
  • Loading branch information
antongolub committed Nov 1, 2024
1 parent 37d6688 commit 4dadb65
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/main/ts/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,14 @@ export const remove = fse.unlinkSync
export const unixify = (path: string): string => path.replace(/\\/g, '/')

export const resolveTsConfig = (file: string): TSConfig => populateSync(file, {
compilerOptions: 'merge'
parse({contents, ext}) {
if (ext === '.json')
return json5.parse(contents)
throw new Error(`Unsupported format: ${ext}`)
},
rules: {
compilerOptions: 'merge'
}
})

export const omitUndefinedKeys = <T extends Record<string, any>>(obj: T): T =>
Expand Down
1 change: 1 addition & 0 deletions src/test/fixtures/ts-project/tsconfig.es6.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"module": "esnext",
"outDir": "target/es6"
},
// json5 comment
"include": ["src/main/**/*.ts"]
}

0 comments on commit 4dadb65

Please sign in to comment.