eslint-plugin-use-agnostic 0.9.9 → 0.9.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -46,7 +46,7 @@ const findExistingPath = (basePath) => {
|
|
|
46
46
|
* @returns The absolute resolved path or `null` if no path is found.
|
|
47
47
|
*/
|
|
48
48
|
export const resolveImportPath = (currentDir, importPath, cwd) => {
|
|
49
|
-
//
|
|
49
|
+
// Step 1: Resolve baseUrl and aliases (if tsconfig.json `paths` exists)
|
|
50
50
|
const config = loadConfig(cwd);
|
|
51
51
|
|
|
52
52
|
const resolveTSConfig =
|
|
@@ -58,7 +58,7 @@ export const resolveImportPath = (currentDir, importPath, cwd) => {
|
|
|
58
58
|
? resolveTSConfig(importPath, undefined, undefined, EXTENSIONS)
|
|
59
59
|
: null;
|
|
60
60
|
|
|
61
|
-
//
|
|
61
|
+
// Step 2: Resolve relative/absolute paths
|
|
62
62
|
const basePath = aliasedPath || path.resolve(currentDir, importPath);
|
|
63
63
|
|
|
64
64
|
// does not resolve on node_modules
|
|
@@ -74,7 +74,7 @@ export const resolveImportPath = (currentDir, importPath, cwd) => {
|
|
|
74
74
|
// Case 3: Directory import (e.g., `./components` → `./components/index.ts`)
|
|
75
75
|
const indexPath = path.join(basePath, "index");
|
|
76
76
|
const directoryImportPath = findExistingPath(indexPath);
|
|
77
|
-
if (directoryImportPath) return
|
|
77
|
+
if (directoryImportPath) return directoryImportPath;
|
|
78
78
|
|
|
79
79
|
return null; // not found
|
|
80
80
|
};
|