google / google/closure-compiler
Side-effect of (0, obj.method)() is warned as no side-effect
Open
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
Babel produces code that utilizes `(0, obj.method)()` in order to make a function call without the context being `obj` since `obj` is just a placeholder object for the methods that were imported.
When running code through Closure Compiler, it produces a warning:
```
JSC_USELESS_CODE: Suspicious code. This code lacks side-effects. Is there a bug? at line 165
dateStart = (0, _utilities.dateNow)();
```
That code does have the side-effect of calling `dateNow` without the context of `_utilities`.
The original code (before babel) stems from:
``` js
import { dateNow } from './utilities';
...
dateStart = dateNow();
```
Contributor guide
Assessment
This issue has not been assessed yet.