google / google/closure-compiler

--warning_level=VERBOSE overlays --jscomp_error=globalThis behavior

Open
#571 3 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
7.7k
Forks
1.2k
Avg merge
2d 12h
Merged PRs (30d)
6

Description

Consider the following source:

``` js
this.someVar = 3;
```

If I pass only flag `--jscomp_error=globalThis`, I get an error, as expected:

```
$ java -jar ~/Downloads/compiler.jar --jscomp_error=globalThis /tmp/globalThis_reproducer.js
/tmp/globalThis_reproducer.js:1: ERROR - dangerous use of the global this object
this.someVar = 3;
^
```

But if I additionally pass `--warning_level=VERBOSE` flag, I get only a warning:

```
$ java -jar ~/Downloads/compiler.jar --jscomp_error=globalThis --warning_level=VERBOSE /tmp/globalThis_reproducer.js
/tmp/globalThis_reproducer.js:1: WARNING - dangerous use of the global this object
this.someVar = 3;
^
```

[This doc](https://code.google.com/p/closure-compiler/wiki/Warnings) says that using the flags like --jscomp_error should give more fine-grained support over --warning-level flag, so I assume that current behavior is wrong.

I used this version:

```
$ java -jar ~/Downloads/compiler.jar --version
Closure Compiler (http://github.com/google/closure-compiler)
Version: v20140730
Built on: 2014/07/31 17:08
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.