Skip to content

Commit 2118043

Browse files
committed
Fix remaining linting errors
1 parent 37fa82d commit 2118043

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/node-resolver.ts

+11-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import fs from 'node:fs'
22
import { isBuiltin } from 'node:module'
3-
import { dirname } from 'node:path'
3+
import path from 'node:path'
44

55
import { ResolverFactory, CachedInputFileSystem } from 'enhanced-resolve'
66
import type { ResolveOptions } from 'enhanced-resolve'
@@ -25,9 +25,9 @@ type NodeResolverOptions = {
2525
export function createNodeResolver({
2626
extensions = ['.mjs', '.cjs', '.js', '.json', '.node'],
2727
conditionNames = ['default', 'module', 'import', 'require'],
28-
mainFields = ['main'],
29-
exportsFields = ['exports'],
30-
mainFiles = ['index'],
28+
mainFields: _mainFields = ['main'],
29+
exportsFields: _exportsFields = ['exports'],
30+
mainFiles: _mainFiles = ['index'],
3131
fileSystem = new CachedInputFileSystem(fs, 4 * 1000),
3232
...restOptions
3333
}: Partial<NodeResolverOptions> = {}): NewResolver {
@@ -54,9 +54,13 @@ export function createNodeResolver({
5454
}
5555

5656
try {
57-
const path = resolver.resolveSync({}, dirname(sourceFile), modulePath)
58-
if (path) {
59-
return { found: true, path }
57+
const resolved = resolver.resolveSync(
58+
{},
59+
path.dirname(sourceFile),
60+
modulePath,
61+
)
62+
if (resolved) {
63+
return { found: true, path: resolved }
6064
}
6165
return { found: false }
6266
} catch {

0 commit comments

Comments
 (0)