Skip to content

Commit 306e467

Browse files
committed
Trim trailing slashes in import paths
1 parent 286074a commit 306e467

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

rules/import-style.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ const getNamespaceIdentifier = moduleName => {
153153
return specialCases[moduleName];
154154
}
155155

156-
// Get the last part of the path and remove extension
157-
const lastPart = moduleName.split('/').pop().split('.')[0];
156+
// Trim trailing slashes and get the last part of the path and remove extension
157+
const lastPart = moduleName.replace(/\/+$/, '').split('/').pop().split('.')[0];
158158

159159
// For scoped packages, we want the package name, not the scope
160160
// @scope/package -> package

0 commit comments

Comments
 (0)