ReSharper 2020.1 Help

Code Inspections in JavaScript

In JavaScript, ReSharper 2020.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.
InspectionIDEditorConfig propertyDefault severity
Join local variable declaration and assignmentJoinDeclarationAndInitializerJsresharper_join_declaration_and_initializer_js_highlightingSuggestion
Statement termination doesn't match code styleStatementTerminationresharper_statement_termination_highlightingWarning
Use of future reserved wordUsingOfReservedWordresharper_using_of_reserved_word_highlightingWarning

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.
InspectionIDEditorConfig propertyDefault severity
Inconsistent NamingInconsistentNamingresharper_inconsistent_naming_highlightingWarning

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.
InspectionIDEditorConfig propertyDefault severity
A series of undefined-checks for properties can be replaced with destructuringReplaceUndefinedCheckingSeriesWithObjectDestructuringresharper_replace_undefined_checking_series_with_object_destructuring_highlightingHint
Intermediate local variable is redundant and can be safely inlinedRedundantIntermediateVariableresharper_redundant_intermediate_variable_highlightingHint
Intermediate local variable is redundant because it can be replaced with a destructuring swap expressionReplaceWithDestructuringSwapresharper_replace_with_destructuring_swap_highlightingHint
Local variable can be safely moved to inner blockVariableCanBeMovedToInnerBlockresharper_variable_can_be_moved_to_inner_block_highlightingHint
String concatenation can be converted to a template stringStringConcatenationToTemplateStringresharper_string_concatenation_to_template_string_highlightingHint
Subsequent indexers can be replaced by a destructuring declaration or assignmentReplaceIndicingWithArrayDestructuringresharper_replace_indicing_with_array_destructuring_highlightingHint
Subsequent indexers in object literal fields can be simplified with destructuringReplaceIndicingWithShortHandPropertiesAfterDestructuringresharper_replace_indicing_with_short_hand_properties_after_destructuring_highlightingHint
'var' variable can be made 'let' variableVariableCanBeMadeLetresharper_variable_can_be_made_let_highlightingHint
Variable can be made constantVariableCanBeMadeConstresharper_variable_can_be_made_const_highlightingHint

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.
InspectionIDEditorConfig propertyDefault severity
'?:' expression has identical true and false branchesConditionalTernaryEqualBranchresharper_conditional_ternary_equal_branch_highlightingWarning
A trailing element of an array is elidedElidedTrailingElementresharper_elided_trailing_element_highlightingWarning
Assignment to a variable inside a conditional statementAssignmentInConditionExpressionresharper_assignment_in_condition_expression_highlightingWarning
Assignment to an implicitly declared global variableAssignToImplicitGlobalInFunctionScoperesharper_assign_to_implicit_global_in_function_scope_highlightingWarning
Assignment to constantAssignToConstantresharper_assign_to_constant_highlightingError
Cannot resolve symbolNotResolvedresharper_not_resolved_highlightingWarning
Closure on a variable modified in loop of outer scopeClosureOnModifiedVariableresharper_closure_on_modified_variable_highlightingWarning
Comma is expected in object literalObjectLiteralsAreNotCommaFreeresharper_object_literals_are_not_comma_free_highlightingError
Comma is not valid hereCommaNotValidHereresharper_comma_not_valid_here_highlightingError
Comparison of 'typeof' expression with incorrect valueIncorrectOperandInTypeOfComparisonresharper_incorrect_operand_in_type_of_comparison_highlightingWarning
Condition is always constantConditionIsAlwaysConstresharper_condition_is_always_const_highlightingWarning
Constructor call is not used or possibly used for side-effectsConstructorCallNotUsedresharper_constructor_call_not_used_highlightingWarning
Declaration hides another declaration from an outer scopeDeclarationHidesresharper_declaration_hides_highlightingHint
Duplicate property declarationDuplicatingPropertyDeclarationresharper_duplicating_property_declaration_highlightingWarning
Duplicate switch labelDuplicatingSwitchLabelresharper_duplicating_switch_label_highlightingWarning
ECMAScript 2015 feature usage when in ES 5 or lowerEs6Featureresharper_es6_feature_highlightingError
ECMAScript 2016 feature usage when in ES 2015 or lowerEs7Featureresharper_es7_feature_highlightingError
Error in XML doc comment referenceErrorInXmlDocReferenceresharper_error_in_xml_doc_reference_highlightingError
Experimental feature usage when language level set to stableExperimentalFeatureresharper_experimental_feature_highlightingError
Expression is always constantExpressionIsAlwaysConstresharper_expression_is_always_const_highlightingWarning
Expression is expected after 'throw' statementThrowMustBeFollowedByExpressionresharper_throw_must_be_followed_by_expression_highlightingError
Extending prototype of native objectNativeTypePrototypeExtendingresharper_native_type_prototype_extending_highlightingWarning
Heuristically unreachable codeHeuristicallyUnreachableCoderesharper_heuristically_unreachable_code_highlightingWarning
Illegal syntax in XML code commentXmlDocCommentSyntaxProblemresharper_xml_doc_comment_syntax_problem_highlightingWarning
'import' keyword is not allowed here.ImportKeywordNotWithInvocationresharper_import_keyword_not_with_invocation_highlightingError
Inconsistent function returnsInconsistentFunctionReturnsresharper_inconsistent_function_returns_highlightingWarning
Invalid JSON syntaxInvalidJsonSyntaxresharper_invalid_json_syntax_highlightingError
Invocation of non-function expressionInvocationOfNonFunctionresharper_invocation_of_non_function_highlightingWarning
Invoked expression is not a function valueInvokedExpressionMaybeNonFunctionresharper_invoked_expression_maybe_non_function_highlightingWarning
JSON validation failedJsonValidationFailedresharper_json_validation_failed_highlightingError
Lexical declaration can only be declared inside a block.LexicalDeclarationNeedsBlockresharper_lexical_declaration_needs_block_highlightingError
Local function is redefined laterLocalFunctionRedefinedLaterresharper_local_function_redefined_later_highlightingWarning
L-value expected errorLValueIsExpectedresharper_l_value_is_expected_highlightingError
Misuse of 'this' qualifier in inner functionMisuseOfOwnerFunctionThisresharper_misuse_of_owner_function_this_highlightingWarning
Multiple declarations in 'for in' errorMultipleDeclarationsInForeachresharper_multiple_declarations_in_foreach_highlightingError
Non-assigned constantNonAssignedConstantresharper_non_assigned_constant_highlightingError
Non-parenthesized object destructuring assignment cannot be used in an expression statementObjectDestructuringWithoutParenthesesresharper_object_destructuring_without_parentheses_highlightingError
Not all code paths return a valueNotAllPathsReturnValueresharper_not_all_paths_return_value_highlightingWarning
Object property declaration is expectedEmptyObjectPropertyDeclarationresharper_empty_object_property_declaration_highlightingError
Overwriting prototype of native objectNativeTypePrototypeOverwritingresharper_native_type_prototype_overwriting_highlightingWarning
Parameter name 'arguments' clashes with pre-defined JS function-scope variableFunctionParameterNamedArgumentsresharper_function_parameter_named_arguments_highlightingWarning
Parameter value is not usedParameterValueIsNotUsedresharper_parameter_value_is_not_used_highlightingWarning
Path for reference comment not foundJsPathNotFoundresharper_js_path_not_found_highlightingError
Possible mistake: ambiguous lambda block and object literalSuspiciousLambdaBlockresharper_suspicious_lambda_block_highlightingWarning
Property getter cannot have parametersPropertyGetterCannotHaveParametersresharper_property_getter_cannot_have_parameters_highlightingError
Property setter must have a single parameterPropertySetterMustHaveSingleParameterresharper_property_setter_must_have_single_parameter_highlightingError
Qualifier can be 'null' or 'undefined'QualifiedExpressionMaybeNullresharper_qualified_expression_maybe_null_highlightingWarning
Qualifier is 'null' or 'undefined'QualifiedExpressionIsNullresharper_qualified_expression_is_null_highlightingWarning
Redeclaration of let/constBlockScopeRedeclarationresharper_block_scope_redeclaration_highlightingError
Return statement with a value in the global scopeReturnFromGlobalScopetWithValueresharper_return_from_global_scopet_with_value_highlightingWarning
Similar expressions comparisonSimilarExpressionsComparisonresharper_similar_expressions_comparison_highlightingWarning
Statement is possibly incorrectly broken by a newlinePossiblyIncorrectlyBrokenStatementresharper_possibly_incorrectly_broken_statement_highlightingWarning
'super' must be called before accessing 'this' in the constructor of a derived class.SuperCallProhibitsThisresharper_super_call_prohibits_this_highlightingError
Suspicious expression statementWrongExpressionStatementresharper_wrong_expression_statement_highlightingWarning
There is no .hasOwnProperty() check in a body of 'for in' loop. This will cause an enumeration of prototype propertiesMissingHasOwnPropertyInForeachresharper_missing_has_own_property_in_foreach_highlightingWarning
Trailing redundant comma in object properties list may be errorUnsafeCommaInObjectPropertiesListresharper_unsafe_comma_in_object_properties_list_highlightingWarning
Triple-slash directives are only valid at the top of the fileIncorrectTripleSlashLocationresharper_incorrect_triple_slash_location_highlightingWarning
Usage of possibly unassigned local variableUsageOfPossiblyUnassignedValueresharper_usage_of_possibly_unassigned_value_highlightingWarning
Usage of unassigned local variableUsageOfDefinitelyUnassignedValueresharper_usage_of_definitely_unassigned_value_highlightingWarning
Use 'break' or 'continue' outside of loop bodyJumpMustBeInLoopresharper_jump_must_be_in_loop_highlightingWarning
Use of expression after break or continueLabelOrSemicolonExpectedresharper_label_or_semicolon_expected_highlightingError
Use of implicitly declared global variableUseOfImplicitGlobalInFunctionScoperesharper_use_of_implicit_global_in_function_scope_highlightingWarning
Use of possibly unassigned property or global variablePossiblyUnassignedPropertyresharper_possibly_unassigned_property_highlightingHint
Use of 'this' in global contextThisInGlobalContextresharper_this_in_global_context_highlightingWarning
Using of 'arguments.caller' and 'arguments.callee'CallerCalleeUsingresharper_caller_callee_using_highlightingWarning
Using of coerced equality (using of coerced equality operator with 'null' or 'undefined')CoercedEqualsUsingWithNullUndefinedresharper_coerced_equals_using_with_null_undefined_highlightingDisabled
Using of coerced equality (using of coerced equality operator)CoercedEqualsUsingresharper_coerced_equals_using_highlightingWarning
Variable is used before it is declaredVariableUsedBeforeDeclaredresharper_variable_used_before_declared_highlightingWarning

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.
InspectionIDEditorConfig propertyDefault severity
Assigned value is never usedAssignedValueIsNeverUsedresharper_assigned_value_is_never_used_highlightingWarning
Redundant blockRedundantBlockresharper_redundant_block_highlightingWarning
Redundant empty finally blockRedundantEmptyFinallyBlockresharper_redundant_empty_finally_block_highlightingWarning
Unreachable codeJsUnreachableCoderesharper_js_unreachable_code_highlightingWarning

Redundancies in Symbol Declarations (11 inspections)

This category includes code inspections, mostly with the warning severity level, which detect empty and unused symbol declarations.
InspectionIDEditorConfig propertyDefault severity
Assignment of a local variable to itself is redundantSameVariableAssignmentresharper_same_variable_assignment_highlightingWarning
Duplicate local declarationDuplicatingLocalDeclarationresharper_duplicating_local_declaration_highlightingWarning
Redundant 'else' blockRedundantElseBlockresharper_redundant_else_block_highlightingWarning
Redundant local class nameRedundantLocalClassNameresharper_redundant_local_class_name_highlightingHint
Redundant local function nameRedundantLocalFunctionNameresharper_redundant_local_function_name_highlightingHint
Type is never used (non-private accessibility)UnusedType.Globalresharper_unused_type_global_highlightingSuggestion
Type member is never used (non-private accessibility)UnusedMember.Globalresharper_unused_member_global_highlightingSuggestion
Unused local variable / function / classUnusedLocalsresharper_unused_locals_highlightingWarning
Unused parameterUnusedParameterresharper_unused_parameter_highlightingWarning
Unused parameter of inherited memberUnusedInheritedParameterresharper_unused_inherited_parameter_highlightingHint
Unused property or functionUnusedPropertyresharper_unused_property_highlightingWarning

Spelling issues (3 inspections)

These inspections detect typos in various contexts.
InspectionIDEditorConfig propertyDefault severity
Typo in commentCommentTyporesharper_comment_typo_highlightingSuggestion
Typo in identifierIdentifierTyporesharper_identifier_typo_highlightingSuggestion
Typo in string literalStringLiteralTyporesharper_string_literal_typo_highlightingSuggestion

Strict mode violations (9 inspections)

 

InspectionIDEditorConfig propertyDefault severity
Calling 'delete' on non-qualified identifier in 'strict mode'DeletingNonQualifiedReferenceresharper_deleting_non_qualified_reference_highlightingError
Duplicate parameter declaration in 'strict mode'DuplicatingParameterDeclarationErrorresharper_duplicating_parameter_declaration_error_highlightingError
Duplicate property declaration in 'strict mode'DuplicatingPropertyDeclarationErrorresharper_duplicating_property_declaration_error_highlightingError
Octal literals and escape sequences using in 'strict mode'OctalLiteralsNotAllowedErrorresharper_octal_literals_not_allowed_error_highlightingError
Using of 'arguments.caller' and 'arguments.callee' in 'strict mode'CallerCalleeUsingErrorresharper_caller_callee_using_error_highlightingError
Using of 'eval'/'arguments' name in 'strict mode'EvalArgumentsNameErrorresharper_eval_arguments_name_error_highlightingError
Using of future reserved keywords in 'strict mode'UsingOfReservedWordErrorresharper_using_of_reserved_word_error_highlightingError
Using of undeclared global variableUndeclaredGlobalVariableUsingresharper_undeclared_global_variable_using_highlightingWarning
Using of 'with' statements in 'strict mode'WithStatementUsingErrorresharper_with_statement_using_error_highlightingError

Syntax Style (5 inspections)

Inspections in this category detect violations of code syntax styles. In contrast to most of other 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.
InspectionIDEditorConfig propertyDefault severity
Function is used before it is declaredFunctionsUsedBeforeDeclaredresharper_functions_used_before_declared_highlightingDisabled
Function is used outside of scope which it is declaredFunctionUsedOutOfScoperesharper_function_used_out_of_scope_highlightingWarning
Non-compliant quotes around string literalStringLiteralWrongQuotesresharper_string_literal_wrong_quotes_highlightingHint
Variable is used in inner scope before it is declaredVariableUsedInInnerScopeBeforeDeclaredresharper_variable_used_in_inner_scope_before_declared_highlightingWarning
Variable is used outside of scope which it is declaredVariableUsedOutOfScoperesharper_variable_used_out_of_scope_highlightingWarning
Last modified: 22 July 2020