Q:

Using Smarty in Javascript in PHPStorm

I recently switched to PHPStorm and it's great, but
I have a bunch of .js files that contain Smarty tags to insert a bit of scaffolding; but this breaks PHPStorm's syntax checker, highlighting all my code in red because it's not seeing the opening tags that the smarty tag will insert.
{include file="../../WidgetClassStart.js"}

    return widgets_Base.extend( {

The error is "'return' outside function definition".
Can I get PHPStorm's syntax checker / compiler to either evaluate the Smarty tag's contents or ignore this specific pattern (since it's the same everywhere) for that specific error?

A:

I ended up putting a 
var widget;

in WidgetClassStart.js;
In every widget I replaced "return ..." with
widget = ...

And then I return that var in the WidgetClassEnd.js file, 
return widget;

so now WidgetClassEnd.js is the only place this error occurs and all my widgets are at least free from red squiggly lines.

