Add a TODO to enable strict deps checking for npm dependencies under fine-grained deps
PiperOrigin-RevId: 221523298
diff --git a/internal/tsc_wrapped/tsc_wrapped.ts b/internal/tsc_wrapped/tsc_wrapped.ts
index 89bcb0b..747be13 100644
--- a/internal/tsc_wrapped/tsc_wrapped.ts
+++ b/internal/tsc_wrapped/tsc_wrapped.ts
@@ -100,9 +100,18 @@
let diags: ts.Diagnostic[] = [];
// Install extra diagnostic plugins
if (!bazelOpts.disableStrictDeps) {
- const ignoredFilesPrefixes = [bazelOpts.nodeModulesPrefix];
- if (options.rootDir) {
- ignoredFilesPrefixes.push(path.resolve(options.rootDir, 'node_modules'));
+ const ignoredFilesPrefixes: string[] = [];
+ if (bazelOpts.nodeModulesPrefix) {
+ // Under Bazel, we exempt external files fetched from npm from strict
+ // deps. This is because we allow users to implicitly depend on all the
+ // node_modules.
+ // TODO(alexeagle): if users opt-in to fine-grained npm dependencies, we
+ // should be able to enforce strict deps for them.
+ ignoredFilesPrefixes.push(bazelOpts.nodeModulesPrefix);
+ if (options.rootDir) {
+ ignoredFilesPrefixes.push(
+ path.resolve(options.rootDir!, 'node_modules'));
+ }
}
program = strictDepsPlugin.wrap(program, {
...bazelOpts,