Search code examples
javascriptunderscore.jsphpstormwebstorm

WebStorm do not inspect part of underscore template


I have the following template in bootstrap.js file:

enter image description here

As you can see, WebStorm shows errors because it can't parse the source correctly.

I'm wondering if there is any way:

  1. to completely disable inspection on that particular region in the file
  2. wrap it in the comments and specify for the template engine to remove these comments when rendering template.

Solution

  • WebStorm provides no support for UnderscoreJS (WEB-679). But, as the syntax looks similar to EJS, you can try the following:

    • associate the .js files with embedded template syntax with EJS file type, by adding <file_name>.js as a pattern there
    • when associating, choose 'javascript' as template data language for these files

    enter image description here