diff --git a/lib/options-manager.js b/lib/options-manager.js index 9df909ce..c275914f 100644 --- a/lib/options-manager.js +++ b/lib/options-manager.js @@ -129,7 +129,7 @@ const mergeWithFileConfig = async options => { options.ts = true; const config = makeTSConfig(tsConfig, tsConfigPath, [options.filePath]); await fs.mkdir(path.dirname(options.tsConfigPath), {recursive: true}); - await fs.writeFile(options.tsConfigPath, JSON.stringify(config), 'utf8'); + await fs.writeFile(options.tsConfigPath, JSON.stringify(config)); } return {options, prettierOptions}; diff --git a/test/options-manager.js b/test/options-manager.js index efc632d3..d66bc5c1 100644 --- a/test/options-manager.js +++ b/test/options-manager.js @@ -557,7 +557,7 @@ test('mergeWithFileConfig: typescript files', async t => { const expectedConfigPath = new RegExp(`${slash(cwd)}/node_modules/.cache/xo-linter/tsconfig\\..*\\.json[\\/]?$`, 'u'); t.regex(slash(options.tsConfigPath), expectedConfigPath); t.deepEqual(omit(options, 'tsConfigPath'), expected); - t.deepEqual(JSON.parse(await fs.readFile(options.tsConfigPath, 'utf8')), { + t.deepEqual(JSON.parse(await fs.readFile(options.tsConfigPath)), { extends: path.resolve(cwd, 'tsconfig.json'), files: [path.resolve(cwd, 'file.ts')], include: [slash(path.resolve(cwd, '**/*.ts')), slash(path.resolve(cwd, '**/*.tsx'))], @@ -579,7 +579,7 @@ test('mergeWithFileConfig: tsx files', async t => { const expectedConfigPath = new RegExp(`${slash(cwd)}/node_modules/.cache/xo-linter/tsconfig\\..*\\.json[\\/]?$`, 'u'); t.regex(slash(options.tsConfigPath), expectedConfigPath); t.deepEqual(omit(options, 'tsConfigPath'), expected); - t.deepEqual(JSON.parse(await fs.readFile(options.tsConfigPath, 'utf8')), { + t.deepEqual(JSON.parse(await fs.readFile(options.tsConfigPath)), { extends: path.resolve(cwd, 'tsconfig.json'), files: [path.resolve(cwd, 'file.tsx')], include: [slash(path.resolve(cwd, '**/*.ts')), slash(path.resolve(cwd, '**/*.tsx'))],