Skip to content

Commit 975daf3

Browse files
authored
Merge pull request #7 from Monchi/distinct-paths
2 parents 5eb1011 + e69dd8c commit 975daf3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/lib/import.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,11 @@ export function getCodeFixActionByName(
8181
function getModulePathsToImport(options: PluginOptions, project: ts.server.Project): string[] {
8282
const currentDir = project.getCurrentDirectory();
8383

84-
return options.paths.flatMap((dirPath) => {
84+
const modulePaths = options.paths.flatMap((dirPath) => {
8585
return project.readDirectory(path.resolve(currentDir, dirPath), ['.ts', '.js']);
8686
});
87+
88+
return [...new Set(modulePaths)];
8789
}
8890

8991
function getFileNameWithoutExt(filePath: string): string {

0 commit comments

Comments
 (0)