diff --git a/lib/options-manager.js b/lib/options-manager.js index 45c313bf..8f411509 100644 --- a/lib/options-manager.js +++ b/lib/options-manager.js @@ -27,7 +27,7 @@ import { CACHE_DIR_NAME, } from './constants.js'; -const {__dirname, json, require} = createEsmUtils(import.meta); +const {__dirname, readJson, require} = createEsmUtils(import.meta); const {normalizePackageName} = Legacy.naming; const resolveModule = Legacy.ModuleResolver.resolve; @@ -161,7 +161,7 @@ const handleTSConfig = async options => { if (tsConfigProjectPath) { options.tsConfigPath = path.resolve(options.cwd, tsConfigProjectPath); - options.tsConfig = await json.load(options.tsConfigPath); + options.tsConfig = await readJson(options.tsConfigPath); } else { const tsConfigExplorer = cosmiconfig([], { searchPlaces: ['tsconfig.json'], diff --git a/package.json b/package.json index f8219077..34cdb5f6 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,7 @@ "eslint-plugin-node": "^11.1.0", "eslint-plugin-prettier": "^4.0.0", "eslint-plugin-unicorn": "^40.1.0", - "esm-utils": "^2.0.1", + "esm-utils": "^3.0.0", "find-cache-dir": "^3.3.2", "find-up": "^6.3.0", "get-stdin": "^9.0.0", diff --git a/test/options-manager.js b/test/options-manager.js index 59c2b3ab..2032f42b 100644 --- a/test/options-manager.js +++ b/test/options-manager.js @@ -7,11 +7,11 @@ import MurmurHash3 from 'imurmurhash'; import {DEFAULT_EXTENSION, DEFAULT_IGNORES, TSCONFIG_DEFAULTS} from '../lib/constants.js'; import * as manager from '../lib/options-manager.js'; -const {__dirname, require, json} = createEsmUtils(import.meta); -const parentConfig = json.loadSync('./fixtures/nested/package.json'); -const childConfig = json.loadSync('./fixtures/nested/child/package.json'); -const prettierConfig = json.loadSync('./fixtures/prettier/package.json'); -const enginesConfig = json.loadSync('./fixtures/engines/package.json'); +const {__dirname, require, readJson, readJsonSync} = createEsmUtils(import.meta); +const parentConfig = readJsonSync('./fixtures/nested/package.json'); +const childConfig = readJsonSync('./fixtures/nested/child/package.json'); +const prettierConfig = readJsonSync('./fixtures/prettier/package.json'); +const enginesConfig = readJsonSync('./fixtures/engines/package.json'); process.chdir(__dirname); @@ -552,7 +552,7 @@ test('mergeWithFileConfig: resolves expected typescript file options', async t = const cwd = path.resolve('fixtures', 'typescript', 'child'); const filePath = path.resolve(cwd, 'file.ts'); const tsConfigPath = path.resolve(cwd, 'tsconfig.json'); - const tsConfig = await json.load(tsConfigPath); + const tsConfig = await readJson(tsConfigPath); const {options} = await manager.mergeWithFileConfig({cwd, filePath}); const eslintConfigId = new MurmurHash3(path.resolve(cwd, 'package.json')).hash(tsConfigPath).result(); const expected = { @@ -574,7 +574,7 @@ test('mergeWithFileConfig: resolves expected tsx file options', async t => { const filePath = path.resolve(cwd, 'file.tsx'); const {options} = await manager.mergeWithFileConfig({cwd, filePath}); const tsConfigPath = path.resolve(cwd, 'tsconfig.json'); - const tsConfig = await json.load(tsConfigPath); + const tsConfig = await readJson(tsConfigPath); const eslintConfigId = new MurmurHash3(path.join(cwd, 'package.json')).hash(tsConfigPath).result(); const expected = { filePath,