Skip to content

Commit

Permalink
Merge pull request #76 from github/feat-follow-symlinks-in-dependency…
Browse files Browse the repository at this point in the history
…-graph

feat: follow symlinks in dependency graph
  • Loading branch information
keithamus committed Oct 21, 2019
2 parents 40f8d9a + 754038c commit dc2f3e8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/dependency-graph.js
Expand Up @@ -41,10 +41,15 @@ function gatherImported() {

for (const {imports} of dependencyGraph.values()) {
for (const [importedFilename, importedIdentifiers] of imports) {
filenames.add(importedFilename)
// require.resolve will expand any symlinks to their fully qualified
// directories. We can use this (with the absolute path given in
// importedFilename to quickly expand symlinks, which allows us to have
// symlinks (aka workspaces) in node_modules, and not fail the lint.
const fullyQualifiedImportedFilename = require.resolve(importedFilename)
filenames.add(fullyQualifiedImportedFilename)

for (const importedIdentifier of importedIdentifiers) {
identifiers.add(`${importedFilename}#${importedIdentifier}`)
identifiers.add(`${fullyQualifiedImportedFilename}#${importedIdentifier}`)
}
}
}
Expand Down

0 comments on commit dc2f3e8

Please sign in to comment.