[SalesForce] Lightning support for eval() in Summer 18

I thought that eval() was supported in Lightning in Summer 18. According to the release notes, it is:

The eval() function is now available in Locker Service, even when
Strict CSP is enabled. This addition improves support for third-party
libraries that evaluate code dynamically.

I've tried to use it (I have a component with admin-defined formula fields to be evaluated client-side), but I cannot save a component which uses eval(). In a simple test-case, my controller contains the following:

return eval('1');

When I try to save (even in Dev Console, I ruled out my IDE and I did check the API version in 43), I get an error from the linter:

ESLINT_ERROR: {c:SafeEval – CONTROLLER} line:col [18:20] –> Invalid
SecureWindow API, eval was blacklisted : Source

I can get to it indirectly by having a static resource to wrapper up the eval like this:

window.nebcEval = function (expressionToEval) {
    return eval(expressionToEval);
}

Does this mean eval() is only supported in a static resource?

Best Answer

Aidan, we have found an issue with the liner, and in some scenarios, it blocked eval and returned the error that you have encountered. We have submitted fix, and you should have it within a couple of weeks in your environment!