From 211804323ee39f7b396e6438d9bfcdc2e4d9b42e Mon Sep 17 00:00:00 2001 From: Bill Collins Date: Thu, 19 Dec 2024 10:48:23 +0000 Subject: [PATCH] Fix remaining linting errors --- src/node-resolver.ts | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/node-resolver.ts b/src/node-resolver.ts index 5079cd92f..fa0ad4a74 100644 --- a/src/node-resolver.ts +++ b/src/node-resolver.ts @@ -1,6 +1,6 @@ import fs from 'node:fs' import { isBuiltin } from 'node:module' -import { dirname } from 'node:path' +import path from 'node:path' import { ResolverFactory, CachedInputFileSystem } from 'enhanced-resolve' import type { ResolveOptions } from 'enhanced-resolve' @@ -25,9 +25,9 @@ type NodeResolverOptions = { export function createNodeResolver({ extensions = ['.mjs', '.cjs', '.js', '.json', '.node'], conditionNames = ['default', 'module', 'import', 'require'], - mainFields = ['main'], - exportsFields = ['exports'], - mainFiles = ['index'], + mainFields: _mainFields = ['main'], + exportsFields: _exportsFields = ['exports'], + mainFiles: _mainFiles = ['index'], fileSystem = new CachedInputFileSystem(fs, 4 * 1000), ...restOptions }: Partial = {}): NewResolver { @@ -54,9 +54,13 @@ export function createNodeResolver({ } try { - const path = resolver.resolveSync({}, dirname(sourceFile), modulePath) - if (path) { - return { found: true, path } + const resolved = resolver.resolveSync( + {}, + path.dirname(sourceFile), + modulePath, + ) + if (resolved) { + return { found: true, path: resolved } } return { found: false } } catch {