ReSharper 2023.1 Help

Code Inspections in JavaScript

In JavaScript, ReSharper 2023.1 provides two kinds of code inspections: 4 inspections that detect errors such as broken syntax, unresolved symbols, compiler errors, and so on (you cannot configure or disable any of these inspections), and 113 proprietary code inspections, any of which you can disable or change its severity level.
These code inspections help you detect code issues in design time in all open files, and additionally they allow you to find code issues in specific scope.

Configurable JavaScript inspections are listed below, grouped by their categories.

Common Practices and Code Improvements (3 inspections)

This category groups inspections that hunt for medium severity issues that mainly affect code readability.

Inspection


ID


EditorConfig property

Default severity

Join local variable declaration and assignment


JoinDeclarationAndInitializerJs


resharper_join_declaration_and_initializer_js_highlighting

Suggestion

Statement termination does not match code style settings


StatementTermination


resharper_statement_termination_highlighting

Warning

Use of future reserved word


UsingOfReservedWord


resharper_using_of_reserved_word_highlighting

Warning

Constraints Violations (1 inspection)

This category includes code inspections, mostly with the warning severity level, which detect violations related to symbol attributes, including ReSharper's code annotations, and other similar issues.

Inspection


ID


EditorConfig property

Default severity

Inconsistent Naming


InconsistentNaming


resharper_inconsistent_naming_highlighting

Warning

Language Usage Opportunities (9 inspections)

This category includes code inspections, mostly with the suggestion severity level, which notify you when more advanced language constructs can be used. These inspections detect syntax of outdated language versions and suggest using features from more modern language versions. For most of the supported languages, language version can be detected automatically or set manually.

Inspection


ID


EditorConfig property

Default severity

A series of undefined-checks for properties can be replaced with destructuring


ReplaceUndefinedCheckingSeriesWithObjectDestructuring


resharper_replace_undefined_checking_series_with_object_destructuring_highlighting

Hint

Intermediate local variable is redundant and can be safely inlined


RedundantIntermediateVariable


resharper_redundant_intermediate_variable_highlighting

Hint

Intermediate local variable is redundant because it can be replaced with a destructuring swap expression


ReplaceWithDestructuringSwap


resharper_replace_with_destructuring_swap_highlighting

Hint

Local variable can be safely moved to inner block


VariableCanBeMovedToInnerBlock


resharper_variable_can_be_moved_to_inner_block_highlighting

Hint

String concatenation can be converted to a template string


StringConcatenationToTemplateString


resharper_string_concatenation_to_template_string_highlighting

Hint

Subsequent indexers can be replaced with a destructuring declaration or assignment


ReplaceIndicingWithArrayDestructuring


resharper_replace_indicing_with_array_destructuring_highlighting

Hint

Subsequent indexers in object literal fields can be simplified with destructuring


ReplaceIndicingWithShortHandPropertiesAfterDestructuring


resharper_replace_indicing_with_short_hand_properties_after_destructuring_highlighting

Hint

'var' variable can be made 'let' variable


VariableCanBeMadeLet


resharper_variable_can_be_made_let_highlighting

Hint

Variable can be made constant


VariableCanBeMadeConst


resharper_variable_can_be_made_const_highlighting

Hint

Potential Code Quality Issues (68 inspections)

This category includes inspections that detect critical issues (code smells), mostly with Error or Warning level. This category also includes inspections that ensure localization assistance.

Inspection


ID


EditorConfig property

Default severity

'?:' expression has identical true and false branches


ConditionalTernaryEqualBranch


resharper_conditional_ternary_equal_branch_highlighting

Warning

A trailing element of an array is elided


ElidedTrailingElement


resharper_elided_trailing_element_highlighting

Warning

Assignment to a variable inside a conditional statement


AssignmentInConditionExpression


resharper_assignment_in_condition_expression_highlighting

Warning

Assignment to an implicitly declared global variable


AssignToImplicitGlobalInFunctionScope


resharper_assign_to_implicit_global_in_function_scope_highlighting

Warning

Assignment to constant


AssignToConstant


resharper_assign_to_constant_highlighting

Error

Cannot resolve symbol


NotResolved


resharper_not_resolved_highlighting

Warning

Closure on a variable modified in loop of outer scope


ClosureOnModifiedVariable


resharper_closure_on_modified_variable_highlighting

Warning

Comma is expected in object literal


ObjectLiteralsAreNotCommaFree


resharper_object_literals_are_not_comma_free_highlighting

Error

Comma is not valid here


CommaNotValidHere


resharper_comma_not_valid_here_highlighting

Error

Comparison of 'typeof' expression with incorrect value


IncorrectOperandInTypeOfComparison


resharper_incorrect_operand_in_type_of_comparison_highlighting

Warning

Condition is always constant


ConditionIsAlwaysConst


resharper_condition_is_always_const_highlighting

Warning

Constructor call is not used or possibly used for side-effects


ConstructorCallNotUsed


resharper_constructor_call_not_used_highlighting

Warning

Declaration hides another declaration from an outer scope


DeclarationHides


resharper_declaration_hides_highlighting

Hint

Duplicate property declaration


DuplicatingPropertyDeclaration


resharper_duplicating_property_declaration_highlighting

Warning

Duplicate switch label


DuplicatingSwitchLabel


resharper_duplicating_switch_label_highlighting

Warning

ECMAScript 2015 feature usage when in ES 5 or lower


Es6Feature


resharper_es6_feature_highlighting

Error

ECMAScript 2016 feature usage when in ES 2015 or lower


Es7Feature


resharper_es7_feature_highlighting

Error

Error in XML doc comment reference


ErrorInXmlDocReference


resharper_error_in_xml_doc_reference_highlighting

Error

Experimental feature usage when language level set to stable


ExperimentalFeature


resharper_experimental_feature_highlighting

Error

Expression is always constant


ExpressionIsAlwaysConst


resharper_expression_is_always_const_highlighting

Warning

Expression is expected after 'throw' statement


ThrowMustBeFollowedByExpression


resharper_throw_must_be_followed_by_expression_highlighting

Error

Extending prototype of native object


NativeTypePrototypeExtending


resharper_native_type_prototype_extending_highlighting

Warning

Heuristically unreachable code


HeuristicallyUnreachableCode


resharper_heuristically_unreachable_code_highlighting

Warning

Illegal syntax in XML code comment


XmlDocCommentSyntaxProblem


resharper_xml_doc_comment_syntax_problem_highlighting

Warning

'import' keyword is not allowed here


ImportKeywordNotWithInvocation


resharper_import_keyword_not_with_invocation_highlighting

Error

Inconsistent function returns


InconsistentFunctionReturns


resharper_inconsistent_function_returns_highlighting

Warning

Invalid JSON syntax


InvalidJsonSyntax


resharper_invalid_json_syntax_highlighting

Error

Invocation of non-function expression


InvocationOfNonFunction


resharper_invocation_of_non_function_highlighting

Warning

Invoked expression is not a function value


InvokedExpressionMaybeNonFunction


resharper_invoked_expression_maybe_non_function_highlighting

Warning

JSON validation failed


JsonValidationFailed


resharper_json_validation_failed_highlighting

Error

Lexical declaration can only be declared inside a block


LexicalDeclarationNeedsBlock


resharper_lexical_declaration_needs_block_highlighting

Error

Local function is redefined later


LocalFunctionRedefinedLater


resharper_local_function_redefined_later_highlighting

Warning

L-value expected error


LValueIsExpected


resharper_l_value_is_expected_highlighting

Error

Misuse of 'this' qualifier in inner function


MisuseOfOwnerFunctionThis


resharper_misuse_of_owner_function_this_highlighting

Warning

Multiple declarations in 'for in' error


MultipleDeclarationsInForeach


resharper_multiple_declarations_in_foreach_highlighting

Error

Non-assigned constant


NonAssignedConstant


resharper_non_assigned_constant_highlighting

Error

Non-parenthesized object destructuring assignment cannot be used in an expression statement


ObjectDestructuringWithoutParentheses


resharper_object_destructuring_without_parentheses_highlighting

Error

Not all code paths return a value


NotAllPathsReturnValue


resharper_not_all_paths_return_value_highlighting

Warning

Object property declaration is expected


EmptyObjectPropertyDeclaration


resharper_empty_object_property_declaration_highlighting

Error

Overwriting prototype of native object


NativeTypePrototypeOverwriting


resharper_native_type_prototype_overwriting_highlighting

Warning

Parameter name 'arguments' clashes with pre-defined JS function-scope variable


FunctionParameterNamedArguments


resharper_function_parameter_named_arguments_highlighting

Warning

Parameter value is not used


ParameterValueIsNotUsed


resharper_parameter_value_is_not_used_highlighting

Warning

Path for reference comment is not found


JsPathNotFound


resharper_js_path_not_found_highlighting

Error

Possible mistake: ambiguous lambda block and object literal


SuspiciousLambdaBlock


resharper_suspicious_lambda_block_highlighting

Warning

Property getter cannot have parameters


PropertyGetterCannotHaveParameters


resharper_property_getter_cannot_have_parameters_highlighting

Error

Property setter must have a single parameter


PropertySetterMustHaveSingleParameter


resharper_property_setter_must_have_single_parameter_highlighting

Error

Qualifier can be 'null' or 'undefined'


QualifiedExpressionMaybeNull


resharper_qualified_expression_maybe_null_highlighting

Warning

Qualifier is 'null' or 'undefined'


QualifiedExpressionIsNull


resharper_qualified_expression_is_null_highlighting

Warning

Redeclaration of let/const


BlockScopeRedeclaration


resharper_block_scope_redeclaration_highlighting

Error

Return statement with a value in the global scope


ReturnFromGlobalScopetWithValue


resharper_return_from_global_scopet_with_value_highlighting

Warning

Similar expressions comparison


SimilarExpressionsComparison


resharper_similar_expressions_comparison_highlighting

Warning

Statement is possibly incorrectly broken by a newline


PossiblyIncorrectlyBrokenStatement


resharper_possibly_incorrectly_broken_statement_highlighting

Warning

'super' must be called before accessing 'this' in the constructor of a derived class


SuperCallProhibitsThis


resharper_super_call_prohibits_this_highlighting

Error

Suspicious expression statement


WrongExpressionStatement


resharper_wrong_expression_statement_highlighting

Warning

There is no .hasOwnProperty() check in a body of 'for in' loop. This will cause an enumeration of prototype properties.


MissingHasOwnPropertyInForeach


resharper_missing_has_own_property_in_foreach_highlighting

Warning

Trailing redundant comma in object properties list may result in an error


UnsafeCommaInObjectPropertiesList


resharper_unsafe_comma_in_object_properties_list_highlighting

Warning

Triple-slash directives are only valid at the top of the file


IncorrectTripleSlashLocation


resharper_incorrect_triple_slash_location_highlighting

Warning

Usage of possibly unassigned local variable


UsageOfPossiblyUnassignedValue


resharper_usage_of_possibly_unassigned_value_highlighting

Warning

Usage of unassigned local variable


UsageOfDefinitelyUnassignedValue


resharper_usage_of_definitely_unassigned_value_highlighting

Warning

Use 'break' or 'continue' outside of loop body


JumpMustBeInLoop


resharper_jump_must_be_in_loop_highlighting

Warning

Use of expression after break or continue


LabelOrSemicolonExpected


resharper_label_or_semicolon_expected_highlighting

Error

Use of implicitly declared global variable


UseOfImplicitGlobalInFunctionScope


resharper_use_of_implicit_global_in_function_scope_highlighting

Warning

Use of possibly unassigned property or global variable


PossiblyUnassignedProperty


resharper_possibly_unassigned_property_highlighting

Hint

Use of 'this' in global context


ThisInGlobalContext


resharper_this_in_global_context_highlighting

Warning

Using of 'arguments.caller' and 'arguments.callee'


CallerCalleeUsing


resharper_caller_callee_using_highlighting

Warning

Using of coerced equality (using of coerced equality operator with 'null' or 'undefined')


CoercedEqualsUsingWithNullUndefined


resharper_coerced_equals_using_with_null_undefined_highlighting

Disabled

Using of coerced equality (using of coerced equality operator)


CoercedEqualsUsing


resharper_coerced_equals_using_highlighting

Warning

Variable is used before it is declared


VariableUsedBeforeDeclared


resharper_variable_used_before_declared_highlighting

Warning

Redundancies in Code (4 inspections)

Code inspections in this category look for redundancies and dead code, which affect code readability and style, and could be safely removed. Some code redundancies cannot be fixed automatically, and quick-fixes for them are performed in the interactive mode, requiring the user input. But the majority of the redundancies can be fixed without user interaction, using either fix in scope or code cleanup.

Inspection


ID


EditorConfig property

Default severity

Assigned value is never used


AssignedValueIsNeverUsed


resharper_assigned_value_is_never_used_highlighting

Warning

Redundant block


RedundantBlock


resharper_redundant_block_highlighting

Warning

Redundant empty finally block


RedundantEmptyFinallyBlock


resharper_redundant_empty_finally_block_highlighting

Warning

Unreachable code


JsUnreachableCode


resharper_js_unreachable_code_highlighting

Warning

Redundancies in Symbol Declarations (11 inspections)

This category includes code inspections, mostly with the warning severity level, which detect empty and unused symbol declarations.

Inspection


ID


EditorConfig property

Default severity

Assignment of a local variable to itself is redundant


SameVariableAssignment


resharper_same_variable_assignment_highlighting

Warning

Duplicate local declaration


DuplicatingLocalDeclaration


resharper_duplicating_local_declaration_highlighting

Warning

Redundant 'else' block


RedundantElseBlock


resharper_redundant_else_block_highlighting

Warning

Redundant local class name


RedundantLocalClassName


resharper_redundant_local_class_name_highlighting

Hint

Redundant local function name


RedundantLocalFunctionName


resharper_redundant_local_function_name_highlighting

Hint

Type is never used (non-private accessibility)


UnusedType.Global


resharper_unused_type_global_highlighting

Suggestion

Type member is never used (non-private accessibility)


UnusedMember.Global


resharper_unused_member_global_highlighting

Suggestion

Unused local variable / function / class


UnusedLocals


resharper_unused_locals_highlighting

Warning

Unused parameter


UnusedParameter


resharper_unused_parameter_highlighting

Warning

Unused parameter of inherited member


UnusedInheritedParameter


resharper_unused_inherited_parameter_highlighting

Hint

Unused property or function


UnusedProperty


resharper_unused_property_highlighting

Warning

Spelling Issues (3 inspections)

These inspections detect typos in various contexts.

Inspection


ID


EditorConfig property

Default severity

Typo in comment


CommentTypo


resharper_comment_typo_highlighting

Suggestion

Typo in identifier


IdentifierTypo


resharper_identifier_typo_highlighting

Suggestion

Typo in string literal


StringLiteralTypo


resharper_string_literal_typo_highlighting

Suggestion

Strict Mode Violations (9 inspections)

 

Inspection


ID


EditorConfig property

Default severity

Calling 'delete' on non-qualified identifier in 'strict mode'


DeletingNonQualifiedReference


resharper_deleting_non_qualified_reference_highlighting

Error

Duplicate parameter declaration in 'strict mode'


DuplicatingParameterDeclarationError


resharper_duplicating_parameter_declaration_error_highlighting

Error

Duplicate property declaration in 'strict mode'


DuplicatingPropertyDeclarationError


resharper_duplicating_property_declaration_error_highlighting

Error

Octal literals and escape sequences using in 'strict mode'


OctalLiteralsNotAllowedError


resharper_octal_literals_not_allowed_error_highlighting

Error

Using of 'arguments.caller' and 'arguments.callee' in the 'strict mode'


CallerCalleeUsingError


resharper_caller_callee_using_error_highlighting

Error

Using of 'eval'/'arguments' name in the 'strict mode'


EvalArgumentsNameError


resharper_eval_arguments_name_error_highlighting

Error

Using of future reserved keywords in the 'strict mode'


UsingOfReservedWordError


resharper_using_of_reserved_word_error_highlighting

Error

Using of undeclared global variable


UndeclaredGlobalVariableUsing


resharper_undeclared_global_variable_using_highlighting

Warning

Using of 'with' statements in the 'strict mode'


WithStatementUsingError


resharper_with_statement_using_error_highlighting

Error

Syntax Style (5 inspections)

Inspections in this category detect violations of code syntax styles. In contrast to most code inspections, these inspections can either detect the same code construct as a code issue or not depending on the corresponding code style rule configured on the Code Editing | [Language] | Syntax Style page of ReSharper options (Alt+R, O). You can also fix issues that these inspection detect using code cleanup.

Inspection


ID


EditorConfig property

Default severity

Function is used before it is declared


FunctionsUsedBeforeDeclared


resharper_functions_used_before_declared_highlighting

Disabled

Function is used outside of scope which it is declared


FunctionUsedOutOfScope


resharper_function_used_out_of_scope_highlighting

Warning

Non-compliant quotes around string literal


StringLiteralWrongQuotes


resharper_string_literal_wrong_quotes_highlighting

Hint

Variable is used in inner scope before it is declared


VariableUsedInInnerScopeBeforeDeclared


resharper_variable_used_in_inner_scope_before_declared_highlighting

Warning

Variable is used outside of scope which it is declared


VariableUsedOutOfScope


resharper_variable_used_out_of_scope_highlighting

Warning

Last modified: 27 March 2023