-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ERROR: Bad --suppress value: JSC_DUPLICATE_NAMESPACE #359
Comments
Seems like a valid error if the js/pb/pb.js is providing a jspb.Message in addition to the one coming from the dep to ["@io_bazel_rules_closure//closure/protobuf:jspb"]. Looking at what com_github_stackb_grpc_js does, my rough guess is you are using protoc in a way that embeds jspb runtime into the generated code. |
Regardless of whether the error is valid or not should the compiler not respect the I think you are right about the duplicate namespace above. I've removed
But again I cannot suppress |
Seems like this is similar to #229 |
You can only suppress the ones and their aliases in
Feel free to send patches for missing ones that exists in com/google/javascript/jscomp/parsing/ParserConfig.properties JSC_DUPLICATE_NAMESPACE doesn't seem like in both of the lists. Has the error message suggested that you can suppress it? If not, doesn't seem like there is an issue here. Aside from all of this, you should not suppress these errors; it doesn't make sense to do so. Consider it more like fatal errors. Seems like the JS you are picking up from the protoc compiler is a bundled JS and not meant to be supplied into Closure Compiler. |
OK, sending a PR. For reference, here are the suppression codes by group:
private static ImmutableMap<DiagnosticType, String> initJsdocSuppressCodes() {
Map<DiagnosticType, String> builder = new HashMap<>();
builder.put(StrictModeCheck.USE_OF_WITH, "with");
for (String suppress : LEGAL_JSDOC_SUPPRESSIONS) {
if (GROUPS.forName(suppress) == null) {
continue;
}
for (DiagnosticType type : GROUPS.forName(suppress).getTypes()) {
builder.put(type, suppress);
}
}
if (HACK) {
StringBuilder sb = new StringBuilder();
for (Map.Entry<DiagnosticType, String> e : builder.entrySet()) {
sb.append(String.format("%s: %s\n", e.getValue(), e.getKey()));
}
throw new IllegalStateException("diagnostics:\n"+sb);
}
return ImmutableMap.copyOf(builder);
} |
And FWIW, I realize these are bizarre things to try and suppress. However, they occur within the i.js file that is generated by the JsChecker as follows: // write .i.js type summary for this library
if (!outputIjsFile.isEmpty()) {
Files.write(Paths.get(outputIjsFile), compiler.toSource().getBytes(UTF_8));
} I'm not sure, but it seems to me that |
Copies valid suppression values from commit 5e529e1 https://github.com/google/closure-compiler/blob/50713dceb16b369f8f317e5b49e8a9dec2b47496/src/com/google/javascript/jscomp/parsing/ParserConfig.properties See bazelbuild#359
This change adds a new boolean attribute to closure_js_library that allows the user to opt-out of "library level checks". These checks --triggered by the named output %{name}_typecheck--, add a node in the action graph to execute JsChecker against an "i.js" file that represents an "ABI" of the library javascript. While this is normally harmless, in certain circumstances the generated ijs file is syntactically incorrect and compilation errors against it represent a false-negative in the overall javascript compile action graph. This attribute provides a way for users to opt-out of compiling the ijs file in these circumstances. See bazelbuild#359
This change adds a new boolean attribute to closure_js_library that allows the user to opt-out of "library level checks". These checks --triggered by the named output %{name}_typecheck--, add a node in the action graph to execute JsChecker against an "i.js" file that represents an "ABI" of the library javascript. While this is normally harmless, in certain circumstances the generated ijs file is syntactically incorrect and compilation errors against it represent a false-negative in the overall javascript compile action graph. This attribute provides a way for users to opt-out of compiling the ijs file in these circumstances. See #359
I'm trying to compile a generated javascript protobuf file, and getting this error that I'm trying to suppress:
However, including this suppress code causes a different error
ERROR: Bad --suppress value: JSC_DUPLICATE_NAMESPACE
:Trying to track this down but I suspect it may be related to #347, but it's not so easy to bisect it.
Any ideas?
The text was updated successfully, but these errors were encountered: