Index of all built-in rules available for JavaScript
Table of Contents
Best Practices
Rules which enforce generally accepted best practices.
- AvoidWithStatement: Avoid using with - it’s bad news
- ConsistentReturn: ECMAScript does provide for return types on functions, and therefore there is no solid rule as to…
- GlobalVariable: This rule helps to avoid using accidently global variables by simply missing the "var" declaratio…
- ScopeForInVariable: A for-in loop in which the variable name is not explicitly scoped to the enclosing scope with the…
- UseBaseWithParseInt: This rule checks for usages of parseInt. While the second parameter is optional and usually defau…
Code Style
Rules which enforce a specific coding style.
- AssignmentInOperand: Avoid assignments in operands; this can make code more complicated and harder to read. This is s…
- ForLoopsMustUseBraces: Avoid using ‘for’ statements without using curly braces.
- IfElseStmtsMustUseBraces: Avoid using if..else statements without using curly braces.
- IfStmtsMustUseBraces: Avoid using if statements without using curly braces.
- NoElseReturn: The else block in a if-else-construct is unnecessary if the ‘if’ block contains a return. Then th…
- UnnecessaryBlock: An unnecessary Block is present. Such Blocks are often used in other languages to introduce a ne…
- UnnecessaryParentheses: Unnecessary parentheses should be removed.
- UnreachableCode: A ‘return’, ‘break’, ‘continue’, or ‘throw’ statement should be the last in a block. Statements a…
- WhileLoopsMustUseBraces: Avoid using ‘while’ statements without using curly braces.
Error Prone
Rules to detect constructs that are either broken, extremely confusing or prone to runtime errors.
- AvoidTrailingComma: This rule helps improve code portability due to differences in browser treatment of trailing comm…
- EqualComparison: Using == in condition may lead to unexpected results, as the variables are automatically casted t…
- InaccurateNumericLiteral: The numeric literal will have a different value at runtime, which can happen if you provide too m…
- InnaccurateNumericLiteral: Deprecated The rule has been renamed. Use instead InaccurateNumericLiteral.
Performance
Rules that flag suboptimal code.
- AvoidConsoleStatements: Using the console for logging in production might negatively impact performance. In addition, log…