Skip to content

Commit b630c75

Browse files
cspotcodecalebboyd
authored andcommitted
lint-fix
1 parent c5bd5db commit b630c75

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

src/cjs-resolve-filename-hook.ts

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,21 @@ export function installCommonjsResolveHookIfNecessary(tsNodeService: Service) {
5050
...rest
5151
);
5252
}
53-
if (!tsNodeService.enabled())
54-
return defer();
53+
if (!tsNodeService.enabled()) return defer();
5554

5655
// Map from emit to source extensions
57-
if (!isMain && canReplaceJsWithTsExt(tsNodeService, request, parent?.filename)) {
56+
if (
57+
!isMain &&
58+
canReplaceJsWithTsExt(tsNodeService, request, parent?.filename)
59+
) {
5860
try {
5961
return originalResolveFilename.call(
6062
this,
6163
request.slice(0, -3),
62-
parent, isMain, options, ...rest
64+
parent,
65+
isMain,
66+
options,
67+
...rest
6368
);
6469
} catch (e) {
6570
const mainFile = defer();
@@ -68,7 +73,10 @@ export function installCommonjsResolveHookIfNecessary(tsNodeService: Service) {
6873
return originalResolveFilename.call(
6974
this,
7075
mainFile.slice(0, -3),
71-
parent, isMain, options, ...rest
76+
parent,
77+
isMain,
78+
options,
79+
...rest
7280
);
7381
}
7482
return mainFile;
@@ -80,7 +88,11 @@ export function installCommonjsResolveHookIfNecessary(tsNodeService: Service) {
8088
}
8189
}
8290

83-
function canReplaceJsWithTsExt(service: Service, request: string, parentPath?: string) {
91+
function canReplaceJsWithTsExt(
92+
service: Service,
93+
request: string,
94+
parentPath?: string
95+
) {
8496
if (!parentPath || service.ignored(parentPath)) return false;
8597
if (isRelativeSpecifier(request) && request.slice(-3) === '.js') {
8698
if (!parentPath) return true;

src/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ import {
2525
} from './module-type-classifier';
2626
import { createResolverFunctions } from './resolver-functions';
2727
import type { createEsmHooks as createEsmHooksFn } from './esm';
28-
import {installCommonjsResolveHookIfNecessary, ModuleConstructorWithInternals} from './cjs-resolve-filename-hook';
28+
import {
29+
installCommonjsResolveHookIfNecessary,
30+
ModuleConstructorWithInternals,
31+
} from './cjs-resolve-filename-hook';
2932

3033
export { TSCommon };
3134
export {
@@ -139,7 +142,6 @@ export interface ProcessEnv {
139142
TS_NODE_SKIP_PROJECT?: string;
140143
TS_NODE_SKIP_IGNORE?: string;
141144
TS_NODE_PREFER_TS_EXTS?: string;
142-
TS_NODE_TRY_TS_EXT?: string;
143145
TS_NODE_IGNORE_DIAGNOSTICS?: string;
144146
TS_NODE_TRANSPILE_ONLY?: string;
145147
TS_NODE_TYPE_CHECK?: string;

0 commit comments

Comments
 (0)