From b630c75ed456cd1ab36d718e8343a4a5bcb8b8dc Mon Sep 17 00:00:00 2001 From: Andrew Bradley Date: Mon, 31 Jan 2022 00:28:46 -0500 Subject: [PATCH] lint-fix --- src/cjs-resolve-filename-hook.ts | 24 ++++++++++++++++++------ src/index.ts | 6 ++++-- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/cjs-resolve-filename-hook.ts b/src/cjs-resolve-filename-hook.ts index 0cf7e385e..8ba7c2ebc 100644 --- a/src/cjs-resolve-filename-hook.ts +++ b/src/cjs-resolve-filename-hook.ts @@ -50,16 +50,21 @@ export function installCommonjsResolveHookIfNecessary(tsNodeService: Service) { ...rest ); } - if (!tsNodeService.enabled()) - return defer(); + if (!tsNodeService.enabled()) return defer(); // Map from emit to source extensions - if (!isMain && canReplaceJsWithTsExt(tsNodeService, request, parent?.filename)) { + if ( + !isMain && + canReplaceJsWithTsExt(tsNodeService, request, parent?.filename) + ) { try { return originalResolveFilename.call( this, request.slice(0, -3), - parent, isMain, options, ...rest + parent, + isMain, + options, + ...rest ); } catch (e) { const mainFile = defer(); @@ -68,7 +73,10 @@ export function installCommonjsResolveHookIfNecessary(tsNodeService: Service) { return originalResolveFilename.call( this, mainFile.slice(0, -3), - parent, isMain, options, ...rest + parent, + isMain, + options, + ...rest ); } return mainFile; @@ -80,7 +88,11 @@ export function installCommonjsResolveHookIfNecessary(tsNodeService: Service) { } } -function canReplaceJsWithTsExt(service: Service, request: string, parentPath?: string) { +function canReplaceJsWithTsExt( + service: Service, + request: string, + parentPath?: string +) { if (!parentPath || service.ignored(parentPath)) return false; if (isRelativeSpecifier(request) && request.slice(-3) === '.js') { if (!parentPath) return true; diff --git a/src/index.ts b/src/index.ts index 04f385c75..a5aaa2e21 100644 --- a/src/index.ts +++ b/src/index.ts @@ -25,7 +25,10 @@ import { } from './module-type-classifier'; import { createResolverFunctions } from './resolver-functions'; import type { createEsmHooks as createEsmHooksFn } from './esm'; -import {installCommonjsResolveHookIfNecessary, ModuleConstructorWithInternals} from './cjs-resolve-filename-hook'; +import { + installCommonjsResolveHookIfNecessary, + ModuleConstructorWithInternals, +} from './cjs-resolve-filename-hook'; export { TSCommon }; export { @@ -139,7 +142,6 @@ export interface ProcessEnv { TS_NODE_SKIP_PROJECT?: string; TS_NODE_SKIP_IGNORE?: string; TS_NODE_PREFER_TS_EXTS?: string; - TS_NODE_TRY_TS_EXT?: string; TS_NODE_IGNORE_DIAGNOSTICS?: string; TS_NODE_TRANSPILE_ONLY?: string; TS_NODE_TYPE_CHECK?: string;