Skip to content

Side-effect of (0, obj.method)() is warned as no side-effect #1868

@jameshartig

Description

@jameshartig

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:

import { dateNow } from './utilities';
...
dateStart = dateNow();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions