Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update esm-utils to v3 #655

Merged
merged 1 commit into from Mar 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/options-manager.js
Expand Up @@ -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;

Expand Down Expand Up @@ -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'],
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -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",
Expand Down
14 changes: 7 additions & 7 deletions test/options-manager.js
Expand Up @@ -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);

Expand Down Expand Up @@ -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 = {
Expand All @@ -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,
Expand Down