Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make IntelliJ ignore javascript syntax errors in one .js file?

In my IntelliJ project I have this file:

MyMvnModule\src\main\webapp\WEB-INF\Owasp.csrfguard.js

This file contains these placeholders that are filled in by a servlet at run time:

} else if(%DOMAIN_STRICT% == false) {
...
}

IntelliJ sees that %DOMAIN_STRICT% is a syntax error which causes it to angry red underline every folder in the path to that file. Is there a way to keep intelliJ from syntax checking this one file so that this doesn't happen?

like image 610
David Avatar asked Jul 22 '15 20:07

David


People also ask

How do I ignore an error in IntelliJ?

In the Settings/Preferences dialog ( Ctrl+Alt+S ), select Editor | Inspections. Locate the inspection you want to disable, and clear the checkbox next to it. Apply the changes and close the dialog.

Is IntelliJ good for JavaScript?

With IntelliJ IDEA, you can develop modern web, mobile, and desktop applications with JavaScript and Node. js. IntelliJ IDEA also supports React, Angular, Vue. js, and other frameworks and provides tight integration with various tools for web development.

How add JS file in IntelliJ?

Press Ctrl+Alt+S to open the IDE settings and select Languages & Frameworks | JavaScript | Libraries. On the Libraries page, click Add. In the New Library dialog, specify the name of the external JavaScript library. ), and select Attach Files or Attach Directories from the list.


1 Answers

To change the highlighting level for the current file:

  1. Open the Highlighting Level pop-up window by doing one of the following:
    • On the main menu, choose Analyze | Configure Current File Analysis.
    • Press Ctrl+Shift+Alt+H.
    • Click the Hector icon on the status bar (bottom right-hand corner).
    • Right-click the code inspection indicator at the top of the scroll bar. Choose Customize Highlighting Level.
  2. Move the slider to one of the three available positions that define the highlighting level:
    • None: turn highlighting off.
    • Syntax: highlight syntax problems only.
    • Inspections: (default) highlight syntax problems and problems found by inspections.
like image 79
thatidiotguy Avatar answered Sep 22 '22 07:09

thatidiotguy