Remove the ErrorOnUnresolvedImports flag.

Taze previously gave an option to error or warn on unresolved imports.  Warnings aren't visible to many users of taze (IDE users, cider users, in the presubmit).  To level the playing field the warning is now always an error.

PiperOrigin-RevId: 227916155
diff --git a/ts_auto_deps/updater/updater.go b/ts_auto_deps/updater/updater.go
index 1a97084..3f6980b 100644
--- a/ts_auto_deps/updater/updater.go
+++ b/ts_auto_deps/updater/updater.go
@@ -371,7 +371,7 @@
 
 // updateDeps adds missing dependencies and removes unnecessary dependencies
 // for the targets in the given DependencyReports to the build rules in bld.
-func updateDeps(bld *build.File, errorOnUnresolvedImports bool, reports []*arpb.DependencyReport) error {
+func updateDeps(bld *build.File, reports []*arpb.DependencyReport) error {
 	// First, check *all* reports on whether they were successful, so that users
 	// get the complete set of errors at once.
 	var errors []AnalysisFailureCause
@@ -433,20 +433,11 @@
 		}
 		hadUnresolved := len(report.UnresolvedImport) > 0
 		if hadUnresolved {
-			errMsg := fmt.Sprintf("ERROR in %s: unresolved imports %s.\nMaybe you are missing a "+
+			return fmt.Errorf("ERROR in %s: unresolved imports %s.\nMaybe you are missing a "+
 				"'// from ...'' comment, or the target BUILD files are incorrect?\n%s\n",
 				fullTarget, report.UnresolvedImport, strings.Join(report.GetFeedback(), "\n"))
-			if errorOnUnresolvedImports {
-				return fmt.Errorf(errMsg)
-			}
-			fmt.Fprintf(os.Stderr, errMsg)
-			fmt.Fprintf(os.Stderr, "Continuing.\n")
 		}
 		for _, d := range report.UnnecessaryDependency {
-			if hadUnresolved {
-				fmt.Fprintf(os.Stderr, "Keeping unnecessary dependency %s due to unresolved imports\n", d)
-				continue
-			}
 			platform.Infof("Removing dependency on %s from %s\n", d, fullTarget)
 			edit.ListAttributeDelete(r, "deps", d, pkg)
 		}
@@ -624,10 +615,10 @@
 
 // updateBUILDAfterBazelAnalyze applies the BUILD file updates that depend on bazel
 // analyze's DependencyReports, most notably updating any rules' deps.
-func (upd *Updater) updateBUILDAfterBazelAnalyze(ctx context.Context, isRoot bool, errorOnUnresolvedImports bool,
+func (upd *Updater) updateBUILDAfterBazelAnalyze(ctx context.Context, isRoot bool,
 	g3root string, buildFilePath string, bld *build.File, reports []*arpb.DependencyReport) (bool, error) {
 	platform.Infof("Updating deps")
-	if err := updateDeps(bld, errorOnUnresolvedImports, reports); err != nil {
+	if err := updateDeps(bld, reports); err != nil {
 		return false, err
 	}
 
@@ -715,10 +706,6 @@
 	// IsRoot indicates that the directory is a project's root directory, so a tsconfig
 	// rule should be created.
 	IsRoot bool
-	// ErrorOnUnresolvedImports indicates to ts_auto_deps that it should fail when it's unable
-	// to resolve the package for an import instead of printing a warning and continuing
-	// assuming the the user manually added an import to their BUILD for it.
-	ErrorOnUnresolvedImports bool
 }
 
 // UpdateBUILD drives the main process of creating/updating the BUILD file
@@ -771,7 +758,7 @@
 		return false, err
 	}
 
-	changedAfterBazelAnalyze, err := upd.updateBUILDAfterBazelAnalyze(ctx, options.IsRoot, options.ErrorOnUnresolvedImports, g3root, buildFilePath, bld, reports)
+	changedAfterBazelAnalyze, err := upd.updateBUILDAfterBazelAnalyze(ctx, options.IsRoot, g3root, buildFilePath, bld, reports)
 	if err != nil {
 		return false, err
 	}
diff --git a/ts_auto_deps/updater/updater_test.go b/ts_auto_deps/updater/updater_test.go
index f587baf..65dd3bb 100644
--- a/ts_auto_deps/updater/updater_test.go
+++ b/ts_auto_deps/updater/updater_test.go
@@ -214,7 +214,7 @@
 		if err != nil {
 			t.Errorf("parse %s after failed: %s", tst.name, err)
 		}
-		if err := updateDeps(bld, false, []*arpb.DependencyReport{report}); err != nil {
+		if err := updateDeps(bld, []*arpb.DependencyReport{report}); err != nil {
 			t.Errorf("update %s failed: %s", tst.name, err)
 		}
 		updated := string(build.Format(bld))
@@ -238,29 +238,12 @@
 		t.Fatal(err)
 	}
 
-	tests := []struct {
-		name                     string
-		errorOnUnresolvedImports bool
-		err                      error
-	}{
-		{
-			name:                     "Error",
-			errorOnUnresolvedImports: true,
-			err: fmt.Errorf("ERROR in %s: unresolved imports %s.\nMaybe you are missing a "+
-				"'// from ...'' comment, or the target BUILD files are incorrect?\n\n", "//foo:bar", []string{"unresolved/import"}),
-		},
-		{
-			name:                     "Warn",
-			errorOnUnresolvedImports: false,
-			err:                      nil,
-		},
-	}
+	expectedErr := fmt.Errorf("ERROR in %s: unresolved imports %s.\nMaybe you are missing a "+
+		"'// from ...'' comment, or the target BUILD files are incorrect?\n\n", "//foo:bar", []string{"unresolved/import"})
 
-	for _, tst := range tests {
-		err = updateDeps(bld, tst.errorOnUnresolvedImports, []*arpb.DependencyReport{report})
-		if !reflect.DeepEqual(err, tst.err) {
-			t.Errorf("update %s returned error %s: expected %s", tst.name, err, tst.err)
-		}
+	err = updateDeps(bld, []*arpb.DependencyReport{report})
+	if !reflect.DeepEqual(err, expectedErr) {
+		t.Errorf("returned error %s: expected %s", err, expectedErr)
 	}
 }