diff --git a/lib/dependency-graph.js b/lib/dependency-graph.js index 56b9b6bc..45997395 100644 --- a/lib/dependency-graph.js +++ b/lib/dependency-graph.js @@ -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}`) } } }