JetBrains Rider 2019.2 Help

Code Inspections in JavaScript

Inspection

Description

Default Severity

Highlight problem line in test

This inspection highlights failed method calls or assertions in tests.

Warning
JSLint

Runs JSLint validator for specified JavaScript file.

Disabled

JSHint

Runs JSHint validator for specified JavaScript file.

Disabled

Closure Linter

Runs Closure Linter that enforces the guidelines set by the Google JavaScript Style Guide. The linter handlesstyle issues so that you can focus on the code.

Disabled

JSCS

Runs JSCS - JavaScript Code Style checker for specified JavaScript file.

Disabled

ESLint

Runs the ESLint linter.

The highlighting is based on the rule severity specified in the ESLint configuration file.Uncheck "Use rule severity from the configuration file" to use the same severity configured in this inspection for all ESLint rules.

Disabled

Standard Code Style

Reports errors according to JavaScript Standard Style.

The severity level of the inspection is applied only for the 'Inspect code...' action.

Disabled

JavaScript general errors

This inspection is for ability to suppress irrelevant JavaScript errors like assignment to const, continue without loop, e.t.c.
Generally, this is not required, but there may be cases when such errors are unexpectedly reported due to dynamic nature of JavaScriptor bugs in IDE's annotator implementation.

Error
Unresolved JavaScript variable

Checks that referenced variables and fields are valid.The validation works in JavaScript, html or jsp files.

Weak warning
Unresolved JavaScript function

Checks that called functions are valid.The validation works in JavaScript, html or jsp files.

Weak warning
Potentially invalid constructor usage

Reports potentially invalid constructor function usages such as: using non constructor in new, usingconstructor's prototype andconstructor call without new. Constructor function assumed to have upper case name (optional) or have explicit JSDoc @constructor tag.The validation works in JavaScript, html or jsp files.

Warning
Unnecessary semicolon

Reports unneeded semicolons.The validation works in JavaScript, html or jsp files.

Warning
Unneeded last comma in array literal

Reports when a trailing comma is used in array literals.

The warning is reported only when the JavaScript language version is set to JavaScript 1.8.5, ECMAScript 3 or 5.1.

Reports when a trailing comma is used in array literals.

Trailing commas in arrays are allowed according to these specifications, however, some browsers might throw an error when a trailing comma is used.

Reports when a trailing comma is used in array literals.

You can configure formatting options for trailing commas in Code Style | JavaScript or TypeScript | Punctuation.

Warning
Unneeded last comma in object literal

Reports when a trailing comma is used in object literals.

The warning is reported only when the JavaScript language version is set to JavaScript 1.8.5, ECMAScript 3 or 5.1.

Reports when a trailing comma is used in object literals.

Trailing commas in object literals are allowed according to these specifications, however, some browsers might throw an error when a trailing comma is used.

Reports when a trailing comma is used in object literals.

You can configure formatting options for trailing commas in Code Style | JavaScript or TypeScript | Punctuation.

Warning
Implicitly declared global JavaScript variable

Checks that variables are declared explicitly with a var statement.The validation works in JavaScript, html or jsp files.

Weak warning
Unused assignment

Checks JavaScript for unused assignments.The validation works in JavaScript, ActionScript, HTML and JSP files.

Warning
Variable declaration can be merged with the first assignment to the variable

This inspection suggests to move variables closer to their usages joining with the initializer expressionIf a variable is declared without an initializer, and it is used in the code much further or in a single nested scope, such variable may be joined with the first assignment as an initializer.

Info
Type mismatch

Checks that called function parameters, return values and assigned expressions are of the correct type.The validation works in JavaScript, html or jsp files.

Weak warning
Comparison of expressions having incompatible types

Checks that operands in comparisons have compatible types in JavaScript files. Operands of types without possible common values are reported.

Weak warning
Signature mismatch

Checks JavaScript called function arguments, return values, assigned expressions to be of correct type.The validation works in JavaScript, html or jsp files.

Weak warning
Validate JSDoc

Validates references in JavaScript/ActionScript documentation comments (JSDoc/ASDoc).

Warning
Duplicate JavaScript declaration

Checks that declarations are declared once in current scope.The validation works in JavaScript, TypeScript, html or jsp files.

Warning
Duplicate block scoped declaration

Checks that block scoped declarations (let/const) are not redeclared again.The validation works in JavaScript, TypeScript, html, or jsp files.

Error
Deprecated JavaScript symbol

Checks for using deprecated functions and variables.The validation works in JavaScript, html, or jsp files.

Weak warning
Suspicious '=+' assignment

Reports assignments in form 'a =+ b'.In most cases, assignments of form 'a =+ b' are typos, and the correct option is 'a += b'.

Warning
Referencing mutable variable from closure

Checks for accessing mutable variables in nested functions.The validation works in JavaScript, html, or jsp files.

Warning
Possibly incorrect target of indexed property access

Reports potentially invalid indexed property access such as Array[1].The validation works in JavaScript, html, or jsp files.

Warning
Potentially invalid reference to 'this' from closure

Checks for this to be the same in closure and in outer context.The validation works in JavaScript, html, or jsp files.

Warning
Potentially invalid reference to 'this' of a class from closure

Warns against a common mistake of trying to reference a member of an ECMAScript class via this. qualifier in a nested function that is not a lambda.
this in a nested function that is not a lambda is the function's own 'this' and doesn't relate to the outer class.

Warning
Unfiltered for..in loop

Checks for unfiltered for-in loops.The use of this construct results in processing inherited or unexpected properties. You need to filter own propertieswith hasOwnProperty() method. The validation works in JavaScript, html or jsp files.

Warning
Unused local symbol

Reports unused locally accessible parameters, local variables, functions, classes and private member declarations.The validation works in JavaScript, ActionScript, HTML and JSP files.

Warning
Unused ES6 / TypeScript imports

Reports unused JavaScript or TypeScript import bindings or specifiers.The validation works in ES6 and TypeScript files.

Warning
Missing await for an async function call

Missing await for an async function call results in having a Promise where a value was expected.

When the 'Report for promises in return statements' checkbox is checked, this inspection will also suggest adding 'await' in return statements.
While this is generally not necessary, it gives two main benefits.
The first one is that you won't forget to add 'await' when surrounding your code with try-catch.
The second one is that having explicit 'await' helps V8 runtime to provide async stack traces.

Weak warning
Missing React import with JSX

When using JSX, it's usually required to have import from React in the file scope. Otherwise, the code may not compile properly.

Weak warning
Possibly async function

Highlights usages of await in functions that were possibly intended to be async but are missing the async modifier.While it is possible to use await as an identifier, it is likely that it was intended to be used as an operatorand the containing function should be made async.

Weak warning
The 'await' operator can only be used in an 'async' function

Highlights usages of await-expressions outside async functions.While the new 'top-level async' proposal is on its way, currently it is still illegal to use await outside async functions.

Error
Redundant nesting in template literal

Reports nested instances of strings and template literals. Such instances can be inlined into the containing template string.

For example, `Hello, ${`Brave ${"New"}`} ${"World"}!` can be simplified to `Hello, Brave New World!`

Weak warning
Redundant 'await' expression

Reports redundant await usages, such as await await, or awaiting a non-promise result.
When the 'Report for promises' checkbox is checked, this inspection will also suggest removing 'await' before promises when applicable (in return statements, and with Promise.resolve/reject).
While this is not generally necessary, removing 'await' in such contexts gives you two problems.
The first one is that surrounding your code with try-catch and forgetting to add 'await' will change code semantics, and you may fail to notice that.
The second one is that not having explicit 'await' may prevent the V8 runtime from providing async stack traces.

Weak warning
Destructuring properties with the same key can be merged

Reports multiple destructuring properties with identical keys that can be merged

Weak warning
Property can be replaced with shorthand

Highlights and provides fixes to convert object properties to ES6 shorthand style.

var obj = {foo:foo}

Highlights and provides fixes to convert object properties to ES6 shorthand style.

var obj = {foo}

Info
Braces around arrow function body can be removed

Reports arrow functions where the body contains exactly one statement and can be converted to concise syntax without braces.

let incrementer = (x) => {return x + 1};

Reports arrow functions where the body contains exactly one statement and can be converted to concise syntax without braces.

let incrementer = (x) => x + 1;

Info
Unnecessary parentheses

Reports parentheses when they are redundant.

In expressions:

Reports parentheses when they are redundant.

Arrow function argument lists:

Reports parentheses when they are redundant.

TypeScript and Flow type declarations:

type Card = (Suit & Rank) | (Suit & Number)

Info
Suspicious usage of 'bind' with arrow function

Warns if bind is used together with arrow function.
Since arrow functions use lexical this, bind call will have no effect on them.
Please read more here.

Warning
'var' used instead of 'let' or 'const'

Reports var declarations that are used instead of let or const.
Both let and const are block-scoped and behave more strictly.

It helps to replace all var declarations with let or const declarations, depending on value semantics.Declarations might be moved to the top of the function or before the first usage of the variable to avoid Reference errors.
Check Conservatively convert var with Fix all action option to prevent any changes in these complex cases when using Fix all action.

Weak warning
'require()' is used instead of 'import'

Reports when require() is used and helps to replace the require() call with the import statement.

Enable Convert require() inside inner scopes with Fix all actionto convert all require() calls inside the nested functions and statements when using the Fix all action.

Please note that converting the require() statements inside inner scopes to the import statementsmay cause changes in the semantics of the code.Import statements are static module dependencies and are hoisted,which means that they are moved to the top of the current module. require() calls load modules dynamically.They can be executed conditionally and their scope is defined by the expression in which they are used.
Clear Convert require() inside inner scopes with Fix all action option to prevent any changes in these complex cases when using Fix all action.

Info
'module.exports' is used instead of 'export'

Reports when module.export is used and helps to replace it with the export or export default statement.

Please note that a quick-fix for converting module.export into export is not available for module.export inside functions or statements, because export statements can only be at the top level of a module.

Info
Function expression is used instead of arrow function

Helps to replace function expressions with arrow functions.

Info
String concatenation is used instead of string template

This inspection highlights string concatenations that can be replaced with a template string.

Info
'for..in' is used instead of 'for..of'

Converts for..inloops on arrays to for..of loops.
for..of loops, introduced in ECMAScript 6, iterate over iterable objects.For arrays, this construction should be preferred to for..in, since it is executed only for array values and not for array object's properties.

Info
Result of method call returning a promise is ignored

Reports function calls that return a Promise that is not later used.These are usually unintended and indicate an error.

Weak warning
Unused global symbol

Reports unused globally accessible public functions, variables, classes, and properties.The validation works in JavaScript, ActionScript, HTML and JSP files.

Warning
Suspicious name combination

Reports assignments and function calls where the name of the variable to whicha value is assigned or the function parameter does not seem to match the name of the value assigned to it.For example:

var x = 0; var y = x;
or
var x = 0, y = 0; var rc = new Rectangle(y, x, 20, 20);
The configuration pane allows to specify the names which should not be used together: the error is reportedif the parameter name or assignment target name contains words from one group and the name of the assigned or passedvariable contains words from a different group.

Warning
There is no locally stored library for the HTTP link.

Checks that URL of an external JavaScript library is associated witha locally stored file used for code completion and navigation.
Use 'Download library' quick fix (Alt+Enter) to solve the problem.

Warning
Mismatched query and update of collection

Reports collection fields or variables whose contents are either queried and not updated,or updated and not queried. Such mismatched queries and updates are pointless,and may indicate either dead code or a typographical error.

Use the tables below to specify which methods are update and/or query methods.The names are matched with the beginning of the method name.Query methods which return their result are automatically detected,only query methods which return their result in an argument need to be specified.

Warning
Bitwise operator usage

Reports suspicious usages of bitwise AND ("&") and OR ("|") operators.Usually it is a common typo and user expect a result according to the boolean operations AND ("&&") and OR ("||").

Warning
Closure compiler syntax

Checks code for warnings implied by Google Closure Compiler annotations.This includes correct usage of @abstract, @interface and @implements tags.

Warning
Undefined property assignment

Reports assignments to undefined properties of explicitly type-annotated variables.

Weak warning
Variable declarations are at the scope start

Checks that all local variables declarations are at the beginning of the current function.

Disabled

Primitive type object wrapper used

Checks for improper usage of wrappers for primitive types. Also, warning will be produced when property of primitive type ismodified, as assigned value will be lost.

Warning
Comparison with NaN

Checks code for comparisons with NaN. Comparisons like expr == NaN or expr === NaN are always evaluated to false.

Warning
jQuery usage efficiency

Checks that jQuery selectors are used in an efficient way.It warns about duplicated selectors which could be cached and optionally about attribute and pseudo-selectors usage.

Warning
@private and @protected members accessibility

Checks that JavaScript members marked with @private and @protected tags are visible in current context.

Warning
Constructor returns primitive value

Checks that function recognized as constructor does not return primitive values.When called with new, this value will be lost and object will be returned instead. To avoid warnings, you can explicitly specifyfunction's return type with @return tag.

Warning
JSDoc comment matches function signature

Checks that parameters defined within JSDoc comments match the function's actual parameters, i.e. have the same names and quantity.

Warning
Consecutive commas in array literal

Checks that array literal doesn't contain consecutive commas. Skipped element takes undefined value,but it could be done unintentionally, e.g. when commas are at the end of one line and at the beginning of the following.

Warning
Call to 'document.write()'

Reports method calls to document.write() or document.writeln().Most uses of these calls are better performed using explicitDOM calls such as getElementByID() andcreateElement(). Additionally, the write() andwriteln() calls will not work with XMLDOMs, including DOMs for XHTML if viewed as XML. This can result in difficulty to point out bugs.

Disabled

Use of 'innerHTML' property

Reports JavaScript accesses to DOM nodes as text using the innerHTML property.Most uses of innerHTML are better performed using explicitDOM calls such as getElementByID() andcreateElement(). Additionally,innerHTML will not work with XMLDOMs, including DOMs for XHTML if viewed as XML. This can lead to difficult todiagnose bugs.

Disabled

Platform detection

Reports common JavaScript patterns for detectingthe browser or operating system in which the script is being run. In additionto pointing out non-portable constructs, these platform detection patternsare often incomplete and easily fooled. For most cases, detection of individualenvironment features is preferable to attempting to detect the entire platform.Patterns detected includedocument.all,document.layers,navigator.userAgent,navigator.oscpu,navigator.appName,navigator.appCodeName, andnavigator.platform

Disabled

XHTML incompatibilities

Reports common JavaScript DOM patterns which may present problemswith XHTML documents. In particular, the patterns detected will behave completelydifferently depending on whether the document is loaded as XML or HTML.This can result in subtle bugs where script behaviour is dependent on the MIME-type of the document, rather than its content.Patterns detected includedocument.body,document.images,document.applets,document.links,document.forms, anddocument.anchors.

Disabled

Loop statement that doesn't loop

Reports for, while and do statementswhose bodies are guaranteed to execute at most once. Normally, this isan indication of a bug.

Warning
Infinite loop statement

Reports for, while, or do statements whichcan only exit by throwing an exception. While such statements may be correct, theyare often a symptom of coding errors.

Warning
Infinite recursion

Reports functions which must either recurseinfinitely or throw an exception. Functions reported by this inspection can notreturn normally.

Warning
Pointless statement or boolean expression

Reports pointless or pointlessly complicated boolean expressions or statements.

Warning
Pointless arithmetic expression

Reports pointless arithmetic expressions. Such expressions include adding or subtracting zero, multiplying byzero or one, division by one, and shift by zero. Such expressions may be the result of automated refactoringsnot completely followed through to completion, and in any case are unlikely to be what the developerintended to do.

Warning
Negated 'if' statement

Reports if statements which have an else branch and a negated condition.Flipping the order of the if and elsebranches will usually increase the clarity of such statements.

Disabled

Negated conditional expression

Reports conditional expressions whose conditions are negated.Flipping the order of the conditional expression branches will usually increase the clarity of suchstatements.

Disabled

'break' statement

Reports break statements. break statements that end case blocks are not reported.

Disabled

'break' statement with label

Reports labelled break statements.

Disabled

'continue' statement

Reports continue statements.

Disabled

'continue' statement with label

Reports labelled continue statements.

Disabled

'default' not last case in 'switch'

Reports switch statements where the default casecomes before some other case. This construct is unnecessarily confusing.

Disabled

Unnecessary 'continue' statement

Reports unnecessary continue statements at the end of loops. These statements may be safely removed.

Warning
Unnecessary 'return' statement

Reports unnecessary return statements. Unnecessary return statements are those whichreturn no value and occur just before the function would have "fallen through" the bottom.These statements may be safely removed.

Warning
Unnecessary label on 'break' statement

Reports labelled break statementswhose labels may be removed without changing the flow of control.

Warning
Unnecessary label on 'continue' statement

Reports labelled continue statementswhose labels may be removed without changing the flow of control.

Warning
Labeled statement

Reports labeled statements.

Disabled

Fallthrough in 'switch' statement

Reports cases where control can proceed from one branch of aswitch statement to the next. Such "fall-through" is oftena result of programmer error.

Warning
Nested 'switch' statement

Reports switch statements whichare nested in other switch statements. Such nested switch statements can bevery confusing, particularly if proper indenting is not followed.

Disabled

Duplicate condition in 'if' statement

Reports duplicate conditions in different branches of anif statement. While it may rarely be thedesired semantics, duplicate conditions usually represent programmer oversight.

Disabled

Constant conditional expression

Reports conditional expressions of the formtrue?result1:result2 or false?result1:result2 .These expressions sometimes occur as the result of automatic refactorings, and may obviously be simplified.

Warning
Conditional expression with identical branches

Reports ternary conditional expressions with identical then and else branches.Such statements are almost certainly programmer error.

Disabled

'if' statement with identical branches

Reports if statements with identical then and else branches. Such statements are almostcertainly programmer error.

Disabled

'if' statement with too many branches

Reports if statements with too manybranches. Such statements may be confusing, and areoften the sign of inadequate levels of design abstraction.

Use the field below to specify the maximum number of branches expected.

Disabled

Redundant 'if' statement

Reports if statements whichcan be simplified to single assignment orreturn statements. For example:

if(foo()) { return true; } else { return false; }
can be simplified to
return foo();

Warning
Redundant conditional expression

Reports conditional expressions of the form condition?true:false or condition?false:true. These expressions may be safely simplifiedto condition or !condition , respectively.

Warning
Unnecessary label

Reports unused labels.

Warning
'for' loop where update or condition does not use loop variable

Reports for loops where the condition or update does not use the for loop variable.

Disabled

Tail recursion

Reports tail recursion, that is when a function calls itselfas its last action before returning. Tail recursion can always be replaced by looping, which will be considerably faster.Some JavaScript engines perform this optimization, while others do not. Thus, tail recursive solutions may have considerably differentperformance characteristics on different environments.

Disabled

'for' loop may be replaced by 'while' loop

Reports for loopswhich contain neither initialization or update components, and can thus be replaced bysimpler while statements.

Use the checkbox below if you wish this inspection to ignore for loops with trivial or non-existent conditions.

Disabled

Result of assignment used

Reports assignment expressions where the result of the assignment isused in a containing expression. Such assignments are often indications of coding errorssuch as using = instead of ==.Moreover, they can result in confusion due to orderof operations, as evaluation of the assignment may effect the outer expression in unexpectedways.

Disabled

Assignment used as condition

Reports an assignment beingused as the condition of an if, while, for ordo statement. While occasionally intended,this usage is confusing, and often indicates a typo(= instead of ==).

Warning
Nested assignment

Reports assignment expressions nested inside other expressions. While admirably terse,such expressions may be confusing, and violate the general design principle that a given construct should do precisely one thing.

Disabled

Assignment to function parameter

Reports assignments to function parameters. It also reports attempts to increment ordecrement the variable.While occasionally intended, this construct can be extremely confusing, and is often the result of aprogrammer error.

Disabled

Assignment to 'for' loop parameter

Reports assignments to variables declared as a for loop parameter.While occasionally intended, this construct can be extremely confusing, and is often the result of aprogrammer error.

Disabled

Assignment replaceable with operator assignment

Reports assignment operations which can be replaced by operator assignment.Using operator assignment may be clearer, and theoretically more performant.

Disabled

Variable is assigned to itself

Reports assignments of the form x = x. These are pointless,and usually indicate programmer error.

Warning
Text label in 'switch' statement

Reports labelled statements inside of switch statements.While occasionally intended, this construction is often the result of a typo.

switch(x) { case 1: case2: //typo! case 3: break; }

Disabled

Non short-circuit boolean expression

Reports the non-short-circuit forms of boolean 'and' and 'or' (&and |). The non-short-circuit versions are occasionally useful, buttheir presence is often due to typos of the short-circuit forms (&&and ||), and may lead to subtle bugs.

Disabled

Result of object allocation ignored

Reports object allocation where the result of the object allocated is ignored.Such allocation expressions are legal JavaScript, but are usually either inadvertent, orevidence of a very odd object initialization strategy.

Disabled

Divide by zero

Reports division by zero or remainder by zero.

Disabled

Equality operator may cause type coercion

Reports usages of equality operators which may cause unexpected type coercions.It is considered a good practice to use the type-safe equality operators === and !==instead of their regular counterparts == and !=.

Depending on the option selected, this will either highlight:

  • All usages of == and != operators.

  • All usages except comparison with null. Some code styles allow using x == null as a replacement for x === null || x === undefined.

  • Only suspicious expressions, such as: == or != comparisons to 0, '', null, true, false, or undefined.

Warning
'debugger' statement

Reports debugger statements, used for interactionwith Javascript debuggers. Such statements should probably not be found in production code.

Disabled

Expression statement which is not assignment or call

Reports expression statements which are not assignments or calls.Such statements have no obvious semantics, and are normally the result of programmererror.

Weak warning
Duplicate case label

Reports duplicated case labels on switch statements.Such switch statements are normally an indication of programmer error.

Warning
Unreachable code

Reports code which can never be executed.Such code almost certainly represents a programming error

Warning
Function with inconsistent returns

Reports functions which return a value insome circumstances and return without a value in others. While legal,such code almost certainly represents a programming error.

Disabled

'this' expression which references the global object

Reports this expressions occurring outside of object literals or constructor bodies. Such thisexpressions are legal JavaScript, and reference the top-level "global" JavaScript object,but are largely useless.

Warning
Reserved word used as name

Reports JavaScript reserved words being used as a name. The JavaScript specificationreserves a number of words which are currently not used as keywords. Using those words as identifiers mayresult in broken code if later versions of JavaScript start using them as keywords.

Warning
String literal which breaks HTML parsing

Reports string literals which contain the sequence </. Such stringsare legal JavaScript, but may result in incorrect parsing of any HTML the JavaScript is embedded in.

Disabled

Function naming convention

Reports functions whose names are either too short, toolong, or do not follow the specified regular expression pattern.

Use the fields provided below to specify minimum length, maximum length and regular expression expected for function names. (Regular expressions are in standard java.util.regex format.)

Disabled

Class naming convention

Reports classes and functions annotated with JSDoc @constructor or @class tags whose names areeither too short, too long, or do not follow the specified regular expression pattern.

Use the fields provided below to specify minimum length, maximum length and regular expression expected for classes names. (Regular expressions are in standard java.util.regex format.)

Disabled

Local variable naming convention

Reports local variables whose names are either too short, toolong, or do not follow the specified regular expression pattern.

Use the fields provided below to specify minimum length, maximum length and regular expression expected for local variables names. (Regular expressions are in standard java.util.regex format.)

Disabled

Function parameter naming convention

Reports function parameters whose names are either too short,too long, or do not follow the specified regular expression pattern.

Use the fields provided below to specify minimum length, maximum length and regular expression expected for local variables names. (Regular expressions are in standard java.util.regex format.)

Disabled

Use of 'caller' property

Reports uses of the caller property in a JavaScript function.Use of this property to access the stack frame of the calling method can be extremely confusing, and result in subtle bugs.

Warning
Unnecessary 'block' statement

Reports unnecessary block statements. Block statements that are not used as the body of if, for,while, do, with, or try statements, or as thebody of a function declaration are reported. Since JavaScript blocks do not introduce new scopesas is common in Java and other languages, free-standing block statements may be the result ofcode confusion, and may result in subtle bugs.

Disabled

Conditional expression

Reports ternary conditional expressions. Some coding standardsprohibit such expressions, in favor of explicit ifstatements.

Disabled

Comma expression

Reports comma expressions. Commaexpressions are often a sign of overly clever code, and may lead to subtle bugs.Comma expressions in the initializer or update section of a forloop are ignored by this inspection.

Warning
Nested conditional expression

Reports ternary conditional expressions contained within other ternary conditions.Such nested conditionals may be extremely confusing, and best replaced by more explicit conditionallogic.

Disabled

Result of increment or decrement used

Reports increment (++) or decrement(--) expressions where the result of the assignment isused in a containing expression. Such assignments can result in confusion due to orderof operations, as evaluation of the assignment may effect the outer expression in unexpectedways.

Disabled

'with' statement

Reports with statements. withstatements result in potentially confusing implicit bindings, and may behavestrangely in setting new variables.

Warning
'void' expression

Reports void expressions. Since void behavescompletely differently in JavaScript and Java, these expressions maybe confusing.

Disabled

Overly complex arithmetic expression

Reports arithmetic expressions with too many terms. Such expressions may be confusing and bug-prone.

Use the field provided below to specify the maximum number of terms allowed in an arithmetic expression.

Disabled

Overly complex boolean expression

Reports boolean expressions with too many terms. Such expressions may be confusing and bug-prone.

Use the field provided below to specify the maximum number of terms allowed in an arithmetic expression.

Disabled

Nested function

Reports functions nested inside other functions.While JavaScript allows functions to be nested, such constructs may be confusing.Additionally, nested functions are prone to cause difficult-to-diagnose memoryleaks in certain browsers, including Microsoft Internet Explorer.

Use the checkbox below to prevent this inspection from reporting anonymous nested functions.

Disabled

Anonymous function

Reports anonymous functions. While often very handy,anonymous functions may be confusing, and are discouraged in some coding standards.

Disabled

Statement with empty body

Reports if, while, for, and with statements whose bodies are empty. Whileoccasionally useful, such statements are often the result of typos, and may cause confusion.

Use the checkbox below to select whether statements whose bodies are empty block statements will be reported by this inspection.

Warning
Octal Integer

Reports octal integer literals. Some coding standards prohibit theuse of octal literals, as they may be easily confused with decimal literals.

Warning
Confusing floating point literal

Reports floating point numbers which do not have a decimal point, numbers before the decimal point,and numbers after the decimal point. Such literals may be confusing, and violate several coding standards.

Disabled

Confusing sequence of '+' or '-'

Reports suspicions combinations of + or -characters in JavaScript code (e.g. a+++b. While legal, such sequences are confusing,and may have their semantics changed through changes in whitespace.

Disabled

Execution of dynamically generated JavaScript

Reports calls to the eval(), setTimeout(),and setInterval() functions, or allocation of a Functionobject. These functions are used to execute arbitrary strings of JavaScript text, oftendynamically generated. This can be very confusing, and may be a security risk.

Disabled

Magic number

Reports "magic numbers", i.e. literal numeric constants used without declaration."Magic numbers" can result in code whose intention is extremely unclear, and may result in errors if a "magicnumber" is changed in one code location but not another. The numbers 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0.0 and 1.0 are not reported by this inspection.

Disabled

Empty 'catch' block

Reports empty catch blocks.Empty catch blocks are a sign that errors are simply being ignored, rather than properly handled.

Disabled

Empty 'try' block

Reports empty try blocks.Empty try blocks are usually the result of a coding error.

Disabled

Empty 'finally' block

Reports empty finally blocks.Empty finally blocks are usually the result of a coding error.

Disabled

'return' inside 'finally' block

Reports return statements inside of finallyblocks. While occasionally intended, such return statements may maskexceptions thrown, and tremendously complicate debugging.

Warning
'throw' inside 'finally' block

Reports throw statements inside of finallyblocks. While occasionally intended, such throw statements may maskexceptions thrown, and tremendously complicate debugging.

Warning
'continue' or 'break' inside 'finally' block

Reports break or continue statements inside of finallyblocks. While occasionally intended, such statements are very confusing, may mask exceptions thrown, andtremendously complicate debugging.

Warning
Exception used for local control-flow

Reports throw statements whose exceptions are alwayscaught by containing try statements. Using throwstatements as a "goto" to change the local flow of control is likely to be confusing.

Warning
Unused 'catch' parameter

Reports catch parameters that are unused in theircorresponding blocks. This inspection will not report catch parametersnamed "ignore" or "ignored".

Use the checkbox below to disable this inspection for catch blocks with comments.

Disabled

Constant on left side of comparison

Reports on comparison operations with constant values on their left-hand side. Somecoding conventions specify that constants should be on the right-hand side of comparisons.

Disabled

Chained equality

Reports chained equality comparisons (i.e. a==b==c). Such comparisons are confusing.

Disabled

Chained function call

Reports function calls whose target is another function call.

Disabled

Nested function call

Reports function calls used as arguments to another function call.

Disabled

Constant on right side of comparison

Reports on comparison operations with constant values on their right-hand side. Somecoding conventions specify that constants should be on the left-hand side of comparisons.

Disabled

Unterminated statement

Reports statements that may be erroneously not terminated by a semicolon or a newline.

If 'terminate statements with semicolons' is selected in code style settings, reports all statements which do not end with a semicolon. While line-breaks may be used instead of semicolons to terminate JavaScript statements, some coding styles prefer the semicolon for consistency with the other languages.

Warning
Non-block statement body

Reports if, while, for, and with statements whose bodies are not block statements. Whilesuch statements are legal JavaScript, it is usually safer for downstream maintenance to usethe code blocks for statement bodies.

Disabled

Overly nested function

Reports functions whose bodies are contain statements too deeply nested within other statements.Functions with too much statement nesting may be confusing, and are a good sign that refactoring may be necessary.

Use the field provided below to specify the maximum acceptable nesting depth a function might have.

Disabled

Function with more than three negations

Reports functions with three or more negation operations (! or !=).Such functions may be unnecessarily confusing.

Disabled

Function with multiple loops

Reports functions containing multiple loop statements.

Disabled

Function with multiple return points

Reports functions with multiple return points.Some coding standards warn against functions with multiple returns, as they may make functionsmore difficult to understand and maintain.

Disabled

Overly complex function

Reports functions that have too high cyclomatic complexity.Cyclomatic complexity is basically a measurement of the number of branching points in a function. Functionswith too high a cyclomatic complexity may be confusing and difficult to test.

Use the field provided below to specify the maximum acceptable cyclomatic complexity a function might have.

Disabled

Function with too many parameters

Reports functions with too many parameters.Functions with too many parameters are often an indication of design weakness.

Use the field provided below to specify the maximum acceptable number of parameters a function might have.

Disabled

Overly long function

Reports overly long functions.Function length is calculated by counting up the number of non-empty statements in the function.Functions that are too long are error-prone, and difficult to test.

Use the field provided below to specify the maximum acceptable number of statements a function might have.

Disabled

Redundant local variable

Reports unnecessary local variables, which addnothing to the comprehensibility of a function. Variables caught include local variableswhich are immediately returned, local variables that are immediately assigned to anothervariable and then not used, and local variables which always have the same value as anotherlocal variable or parameter.

Use the checkbox below to have this inspection ignore variables which are immediatelyreturned or thrown. Some coding styles suggest using such variables for clarity andease of debugging.

Warning
Reuse of local variable

Reports where local variables are "reused", overwriting theirvalues with new values unrelated to their original use. Such local variable reuse may be confusing,as the intended semantics of the local variable may vary with each use. It may also beprone to bugs, if code changes result in values that were thought to be overwritten actuallybeing live. It is good practices to keep variable lifetimes as short as possible, and notreuse local variables for the sake of brevity.

Disabled

Pointless bitwise expression

Reports pointless bitwise expressions. Such expressions include anding with zero,oring by zero,and shift by zero. Such expressions may be the result of automated refactoringsnot completely followed through to completion, and in any case are unlikely to be what the developerintended to do.

Disabled

Shift operation by inappropriate constant

Reports shift operations where the value shifted by is constant and outside of the reasonable range. Integershift operations outside of the range 0..31 are reported.Shifting by negative or overly large values is almost certainly a coding error.

Warning
Incompatible bitwise mask operation

Reports bitwise mask expressions which are guaranteed toevaluate to true or false.Expressions checked are of the form (var & constant1) == constant2 or (var | constant1) == constant2 , where constant1 and constant2 are incompatible bitmask constants.

Warning
Method can be static

Checks for ActionScript, JavaScript and TypeScript methods which may safely be made static.A method may be static if it does not reference any of its class' non static methodsand non static fields and is not overridden in a sub class.

Use the first checkbox below to inspect only private methods.

Warning
Validate file references

Reports unresolved file references in JavaScript files, including CommonJS and AMD modules references.

Warning
Typeof comparing with non-standard value

Reports when literal string in a comparing with typeof is not one of the standard types:undefined, object, boolean, number, string, function or symbol.

Warning
Missing AMD module dependency

Inside an AMD module definition, checks that all used modules are specified as dependencies.

Suggests inserting the module dependency.

Inside an AMD module definition, checks that all used modules are specified as dependencies.

Works only in files in the scope of "HTML" JavaScript library.

Weak warning
Missing import statement

Checks that all modules are referenced through import statements.

Suggests inserting the import statement.

Checks that all modules are referenced through import statements.

When using libraries that define their own global symbols outside their visible JavaScript code (e.g. describe() in Mocha),
it is recommended that you add the corresponding TypeScript type definition file as a JavaScript library in Preferences | Languages & Frameworks | JavaScript | Libraries.

Weak warning
Missing require() statement

Checks that all modules are referenced through require().

Suggests inserting the require() call.

Checks that all modules are referenced through require().

Works only in files in the scope of Node.js Core JavaScript library.

Checks that all modules are referenced through require().

When using libraries that define their own global symbols outside their visible JavaScript code (e.g. describe() in Mocha),
it is recommended that you add the corresponding TypeScript type definition file as a JavaScript library in Preferences | Languages & Frameworks | JavaScript | Libraries.

Weak warning
Identifiers with non-ASCII symbols

Reports names containing non-ASCII symbols.

If 'Allow only ASCII names' option is used, reports all names containing non-ASCII symbols.
Otherwise reports all names, containing both ASCII and non-ASCII symbols.

Warning
Referencing 'arguments' outside of function

a

Checks that arguments references are inside a function body.

Error
Missing module dependency

Checks whether the module in the require() call or import statement exists, whether it is listed in package.json dependencies, and whether it is locally installed.

Suggests installing the module and/or including it into package.json.

Checks whether the module in the require() call or import statement exists, whether it is listed in package.json dependencies, and whether it is locally installed.

For require() calls, works only in files in the scope of Node.js Core JavaScript library.

Weak warning
Unresolved Ext JS xtype

Checks that Ext JS xtype references have corresponding class.

Warning
Non-strict mode used

Checks that JavaScript files are in strict mode.

Disabled

'switch' statement has missing branches

Reports switch statements on a variable of enum or union type when the statement covers not all the value options from the type.

Info
'switch' statement has no 'default' branch

Reports switch statements without default clause in case when not all possible values are enumerated.

Info
Unreachable 'case' branch of a 'switch' statement

Reports case branches of a switch statement that are unreachable in current context

Warning
'switch' statement is redundant and can be replaced

Reports unnecessary switch statements. Warns on switch statement with an empty body, only one case branch, or only single default branch.

Weak warning
Variable is declared and being used in different 'case' clauses

Reports variables that are declared in one case clause of a switch statement, and are used in a different caseclause of the same statement.For block-scope variables, this results in a ReferenceError being thrown.For var-variables, it signifies a potential error. This inspection can be disabled for var-variables if you use this pattern intentionally.

Warning
Validate imports

Validate ES6 imports.

Weak warning
Use of possibly unassigned property in a static initializer

Reports when a class member initializer references another non-hoisted class member that could be not initialized yet.

Class members initialization happens consequently for fields, thus, a field cannot reference another field declared later.

Warning
Unsound type guard check

typeof x type guard can be unsound in one of the following two cases:

  1. typeof x never corresponds to the specified value (e.g., typeof x === 'number' when x has type 'string | boolean')

  2. typeof x always corresponds to the specified value (e.g., typeof x === 'string' when x has type 'string')


x instanceof A type guard can be unsound in one of the following two cases:
  1. Type of x is not related to A

  2. Type of x is A or a subtype of A

Warning
Object is 'null' or 'undefined'

Reports errors caused by invoking a method,accessing a property or calling a function on an object that is undefined or null.

Warning
Flow errors

Reports errors from Flow in Inspect code.

Disabled

Missing .flowconfig

Checks that there’s a .flowconfig file in the project that covers a JavaScript file with the // @flow flag.

Warning
Code is not covered by Flow

Checks that JavaScript code is covered by the Flow type checker. To use this inspection, the Flow executable must be configured in Settings | Languages & Frameworks | JavaScript

Disabled

Flow flag is misplaced

Checks that the // @flow flag is located on the top of the file – otherwise this file will not be checked by Flow.

Warning
Validate webpack configuration

Validates options in the webpack configuration file (which name should start with `webpack`, e.g. `webpack.config.js`)against webpack Options Schema.

Disable this inspection to turn off validation and code completions inside the configuration object.

Warning
Mismatched dependencies in package.json

Reports dependencies in package.json that are not installed or don't match the specified version range.

Warning
Karma configuration file

Reports possible errors in file paths ('basePath', 'files') for *.conf.js files.

Warning
Coding assistance for Node.js core modules

Suggests configuring coding assistance for Node.js core modules.

Warning
Last modified: 17 September 2019