Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/rules/extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,9 @@ export default createRule<Options, MessageId>({

const resolvedPath = resolve(importPath, context)

// get extension from resolved path, if possible.
// for unresolved, use source value.
const extension = path.extname(resolvedPath || importPath).slice(1)
Copy link
Member

@JounQin JounQin Jun 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is incorrect for resolving .xyz but ./abc.js or ./abc is imported.

const extension =
path.extname(importPath).slice(1) ||
(resolvedPath ? path.extname(resolvedPath).slice(1) : '')

// determine if this is a module
const isPackage =
Expand Down
Loading