ReSharper Help

Code Analysis in JavaScript

The key features of ReSharper's code analysis are also supported in JavaScript. You can find the detailed information on these features in the corresponding topics of the Code Analysis section. In the main topic of the section, you can also find the feature matrix and check what exactly is supported in JavaScript.

In this topic, you can find some examples of using code analysis features in JavaScript:

Code inspection

To look through the list of available inspections for JavaScript, open the Code Inspections | Inspection Severity options page, and then switch to the JS tab.


To find out whether the opened file contains errors or warnings, look at the Status Indicator, a colored icon at the top of the Marker Bar. You can place the mouse pointer over the Status Indicator and look at the tooltip to see the number of errors in the file.

After you get the summary information, you can concentrate on concrete problems. Choose one of the markers on the status bar and place the mouse pointer over it and get a tip about the issue. Click the marker to navigate directly to the code line.

As you see parameter context is displayed in grey:


At any time you can change the severity level of an inspection. The visual representation of the inspection changes correspondingly. If yuu set the 'Error' severity level for this inspection, the parameter is highlighted with a curly red underline:


Resolving global variables

ReSharper highlights usages of undefined variables as warnings. THere are cases, however, when these usages are valid. For instance, some variables can be defined directly in the markup.

One way to deal with this, is to disable or suppress the corresponding code inspection. However, you can define such variables using the // global comment. In this case, the inspection will stay active and help you to find typos in variable names.

You can place these comments either at the top of the current file or use a single file for all global variables of the project. Each variable requires a new comment, e.g.: // global variableName

Examples of quick-fixes

Terminate all unterminated statements in file
Use this quick-fix in order to terminate all unterminated JavaScript statements in current file.


Specify qualifier explicitly
In case an explicit quialifier is missing, use this quick-fix to add a qualifier.


Remove parameter
If a parameter is not used inside function body, this quick-fix will remove the parameter from function declaration


Declare local variable
When ReSharper finds out that a variable has been assigned without being declared, use this quick-fix to transform the assignment into a variable declaration.

After applying this quick-fix the statement is a proper variable declaration.

See Also

Last modified: 30 June 2015