radare/radare2-webui

View on GitHub
www/lib/r2.js

Summary

Maintainability
F
6 days
Test Coverage

File r2.js has 567 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* radare2 Copyleft 2013-2016 pancake */

var r2 = {};

// TODO: avoid globals
Severity: Major
Found in www/lib/r2.js - About 1 day to fix

    Function filter_asm has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
    Open

    r2.filter_asm = function(x, display) {
        var curoff = backward ? prev_curoff : next_curoff;
        ;
        var lastoff = backward ? prev_lastoff : next_lastoff;
        ;
    Severity: Minor
    Found in www/lib/r2.js - About 1 day to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function has too many statements (54). Maximum allowed is 30.
    Open

    r2.filter_asm = function(x, display) {
    Severity: Minor
    Found in www/lib/r2.js by eslint

    enforce a maximum number of statements allowed in function blocks (max-statements)

    The max-statements rule allows you to specify the maximum number of statements allowed in a function.

    function foo() {
      var bar = 1; // one statement
      var baz = 2; // two statements
      var qux = 3; // three statements
    }

    Rule Details

    This rule enforces a maximum number of statements allowed in function blocks.

    Options

    This rule has a number or object option:

    • "max" (default 10) enforces a maximum number of statements allows in function blocks

    Deprecated: The object property maximum is deprecated; please use the object property max instead.

    This rule has an object option:

    • "ignoreTopLevelFunctions": true ignores top-level functions

    max

    Examples of incorrect code for this rule with the default { "max": 10 } option:

    /*eslint max-statements: ["error", 10]*/
    /*eslint-env es6*/
    
    function foo() {
      var foo1 = 1;
      var foo2 = 2;
      var foo3 = 3;
      var foo4 = 4;
      var foo5 = 5;
      var foo6 = 6;
      var foo7 = 7;
      var foo8 = 8;
      var foo9 = 9;
      var foo10 = 10;
    
      var foo11 = 11; // Too many.
    }
    
    let foo = () => {
      var foo1 = 1;
      var foo2 = 2;
      var foo3 = 3;
      var foo4 = 4;
      var foo5 = 5;
      var foo6 = 6;
      var foo7 = 7;
      var foo8 = 8;
      var foo9 = 9;
      var foo10 = 10;
    
      var foo11 = 11; // Too many.
    };

    Examples of correct code for this rule with the default { "max": 10 } option:

    /*eslint max-statements: ["error", 10]*/
    /*eslint-env es6*/
    
    function foo() {
      var foo1 = 1;
      var foo2 = 2;
      var foo3 = 3;
      var foo4 = 4;
      var foo5 = 5;
      var foo6 = 6;
      var foo7 = 7;
      var foo8 = 8;
      var foo9 = 9;
      var foo10 = 10;
      return function () {
    
        // The number of statements in the inner function does not count toward the
        // statement maximum.
    
        return 42;
      };
    }
    
    let foo = () => {
      var foo1 = 1;
      var foo2 = 2;
      var foo3 = 3;
      var foo4 = 4;
      var foo5 = 5;
      var foo6 = 6;
      var foo7 = 7;
      var foo8 = 8;
      var foo9 = 9;
      var foo10 = 10;
      return function () {
    
        // The number of statements in the inner function does not count toward the
        // statement maximum.
    
        return 42;
      };
    }

    ignoreTopLevelFunctions

    Examples of additional correct code for this rule with the { "max": 10 }, { "ignoreTopLevelFunctions": true } options:

    /*eslint max-statements: ["error", 10, { "ignoreTopLevelFunctions": true }]*/
    
    function foo() {
      var foo1 = 1;
      var foo2 = 2;
      var foo3 = 3;
      var foo4 = 4;
      var foo5 = 5;
      var foo6 = 6;
      var foo7 = 7;
      var foo8 = 8;
      var foo9 = 9;
      var foo10 = 10;
      var foo11 = 11;
    }

    Related Rules

    • [complexity](complexity.md)
    • [max-depth](max-depth.md)
    • [max-len](max-len.md)
    • [max-nested-callbacks](max-nested-callbacks.md)
    • [max-params](max-params.md) Source: http://eslint.org/docs/rules/

    Function Ajax has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

    function Ajax(method, uri, body, fn, err) {
        if (typeof (XMLHttpRequest) == 'undefined') {
            return false;
        }
        if (r2.asyncMode == 'fake') {
    Severity: Minor
    Found in www/lib/r2.js - About 3 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function has a complexity of 23.
    Open

    r2.filter_asm = function(x, display) {
    Severity: Minor
    Found in www/lib/r2.js by eslint

    Limit Cyclomatic Complexity (complexity)

    Cyclomatic complexity measures the number of linearly independent paths through a program's source code. This rule allows setting a cyclomatic complexity threshold.

    function a(x) {
        if (true) {
            return x; // 1st path
        } else if (false) {
            return x+1; // 2nd path
        } else {
            return 4; // 3rd path
        }
    }

    Rule Details

    This rule is aimed at reducing code complexity by capping the amount of cyclomatic complexity allowed in a program. As such, it will warn when the cyclomatic complexity crosses the configured threshold (default is 20).

    Examples of incorrect code for a maximum of 2:

    /*eslint complexity: ["error", 2]*/
    
    function a(x) {
        if (true) {
            return x;
        } else if (false) {
            return x+1;
        } else {
            return 4; // 3rd path
        }
    }

    Examples of correct code for a maximum of 2:

    /*eslint complexity: ["error", 2]*/
    
    function a(x) {
        if (true) {
            return x;
        } else {
            return 4;
        }
    }

    Options

    Optionally, you may specify a max object property:

    "complexity": ["error", 2]

    is equivalent to

    "complexity": ["error", { "max": 2 }]

    Deprecated: the object property maximum is deprecated. Please use the property max instead.

    When Not To Use It

    If you can't determine an appropriate complexity limit for your code, then it's best to disable this rule.

    Further Reading

    Related Rules

    • [max-depth](max-depth.md)
    • [max-len](max-len.md)
    • [max-nested-callbacks](max-nested-callbacks.md)
    • [max-params](max-params.md)
    • [max-statements](max-statements.md) Source: http://eslint.org/docs/rules/

    Function getTextLogger has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

    r2.getTextLogger = function(obj) {
        if (typeof (obj) != 'object') {
            obj = {};
        }
        obj.last = 0;
    Severity: Minor
    Found in www/lib/r2.js - About 3 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function filter_asm has 80 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    r2.filter_asm = function(x, display) {
        var curoff = backward ? prev_curoff : next_curoff;
        ;
        var lastoff = backward ? prev_lastoff : next_lastoff;
        ;
    Severity: Major
    Found in www/lib/r2.js - About 3 hrs to fix

      Function getTextLogger has 63 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      r2.getTextLogger = function(obj) {
          if (typeof (obj) != 'object') {
              obj = {};
          }
          obj.last = 0;
      Severity: Major
      Found in www/lib/r2.js - About 2 hrs to fix

        Function 'Ajax' has a complexity of 12.
        Open

        function Ajax(method, uri, body, fn, err) {
        Severity: Minor
        Found in www/lib/r2.js by eslint

        Limit Cyclomatic Complexity (complexity)

        Cyclomatic complexity measures the number of linearly independent paths through a program's source code. This rule allows setting a cyclomatic complexity threshold.

        function a(x) {
            if (true) {
                return x; // 1st path
            } else if (false) {
                return x+1; // 2nd path
            } else {
                return 4; // 3rd path
            }
        }

        Rule Details

        This rule is aimed at reducing code complexity by capping the amount of cyclomatic complexity allowed in a program. As such, it will warn when the cyclomatic complexity crosses the configured threshold (default is 20).

        Examples of incorrect code for a maximum of 2:

        /*eslint complexity: ["error", 2]*/
        
        function a(x) {
            if (true) {
                return x;
            } else if (false) {
                return x+1;
            } else {
                return 4; // 3rd path
            }
        }

        Examples of correct code for a maximum of 2:

        /*eslint complexity: ["error", 2]*/
        
        function a(x) {
            if (true) {
                return x;
            } else {
                return 4;
            }
        }

        Options

        Optionally, you may specify a max object property:

        "complexity": ["error", 2]

        is equivalent to

        "complexity": ["error", { "max": 2 }]

        Deprecated: the object property maximum is deprecated. Please use the property max instead.

        When Not To Use It

        If you can't determine an appropriate complexity limit for your code, then it's best to disable this rule.

        Further Reading

        Related Rules

        • [max-depth](max-depth.md)
        • [max-len](max-len.md)
        • [max-nested-callbacks](max-nested-callbacks.md)
        • [max-params](max-params.md)
        • [max-statements](max-statements.md) Source: http://eslint.org/docs/rules/

        Function Ajax has 59 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function Ajax(method, uri, body, fn, err) {
            if (typeof (XMLHttpRequest) == 'undefined') {
                return false;
            }
            if (r2.asyncMode == 'fake') {
        Severity: Major
        Found in www/lib/r2.js - About 2 hrs to fix

          Function update_flags has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          r2.update_flags = function() {
              r2.cmd('fs *;fj|', function(x) {
          
                  var fs = JSON.parse(x);
                  if (fs !== undefined && fs !== null) {
          Severity: Minor
          Found in www/lib/r2.js - About 1 hr to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Avoid deeply nested control flow statements.
          Open

                      for (var i = 0; i < lines.length; i++) {
                          var elems = lines[i].split(/ /g);
                          var name = '';
                          var addr = '';
                          for (var j = 0; j < elems.length; j++) {
          Severity: Major
          Found in www/lib/r2.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                            if (!space) continue;
            Severity: Major
            Found in www/lib/r2.js - About 45 mins to fix

              Function Ajax has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              function Ajax(method, uri, body, fn, err) {
              Severity: Minor
              Found in www/lib/r2.js - About 35 mins to fix

                Function get_address_type has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                r2.get_address_type = function(address) {
                    var offset = parseInt(address, 16);
                    for (var i in r2.sections) {
                        if (offset >= r2.sections[i].addr && offset < r2.sections[i].addr + r2.sections[i].size) {
                            if (r2.sections[i].flags.indexOf('x') > -1) {
                Severity: Minor
                Found in www/lib/r2.js - About 35 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Avoid too many return statements within this function.
                Open

                    return true;
                Severity: Major
                Found in www/lib/r2.js - About 30 mins to fix

                  Function get_flag_address has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  r2.get_flag_address = function(name) {
                      for (var f in r2.flags) {
                          for (var v in r2.flags[f]) {
                              if (name == r2.flags[f][v].name) return f;
                          }
                  Severity: Minor
                  Found in www/lib/r2.js - About 25 mins to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Function _internal_cmd has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function _internal_cmd(c, cb, err) {
                      if (typeof (r2cmd) != 'undefined') {
                          hascmd = r2cmd;
                      }
                      if (hascmd) {
                  Severity: Minor
                  Found in www/lib/r2.js - About 25 mins to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Function cmds has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  r2.cmds = function(cmds, cb) {
                      if (cmds.length == 0) return;
                      var cmd = cmds[0];
                      cmds = cmds.splice(1);
                      function lala() {
                  Severity: Minor
                  Found in www/lib/r2.js - About 25 mins to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  The body of a for-in should be wrapped in an if statement to filter unwanted properties from the prototype.
                  Open

                      for (var a in obj) {
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Require Guarding for-in (guard-for-in)

                  Looping over objects with a for in loop will include properties that are inherited through the prototype chain. This behavior can lead to unexpected items in your for loop.

                  for (key in foo) {
                      doSomething(key);
                  }

                  Note that simply checking foo.hasOwnProperty(key) is likely to cause an error in some cases; see [no-prototype-builtins](no-prototype-builtins.md).

                  Rule Details

                  This rule is aimed at preventing unexpected behavior that could arise from using a for in loop without filtering the results in the loop. As such, it will warn when for in loops do not filter their results with an if statement.

                  Examples of incorrect code for this rule:

                  /*eslint guard-for-in: "error"*/
                  
                  for (key in foo) {
                      doSomething(key);
                  }

                  Examples of correct code for this rule:

                  /*eslint guard-for-in: "error"*/
                  
                  for (key in foo) {
                      if (Object.prototype.hasOwnProperty.call(foo, key)) {
                          doSomething(key);
                      }
                      if ({}.hasOwnProperty.call(foo, key)) {
                          doSomething(key);
                      }
                  }

                  Related Rules

                  • [no-prototype-builtins](no-prototype-builtins.md)

                  Further Reading

                  Expected '===' and instead saw '=='.
                  Open

                          if (typeof (r) == 'function') {
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Require === and !== (eqeqeq)

                  It is considered good practice to use the type-safe equality operators === and !== instead of their regular counterparts == and !=.

                  The reason for this is that == and != do type coercion which follows the rather obscure Abstract Equality Comparison Algorithm. For instance, the following statements are all considered true:

                  • [] == false
                  • [] == ![]
                  • 3 == "03"

                  If one of those occurs in an innocent-looking statement such as a == b the actual problem is very difficult to spot.

                  Rule Details

                  This rule is aimed at eliminating the type-unsafe equality operators.

                  Examples of incorrect code for this rule:

                  /*eslint eqeqeq: "error"*/
                  
                  if (x == 42) { }
                  
                  if ("" == text) { }
                  
                  if (obj.getStuff() != undefined) { }

                  The --fix option on the command line automatically fixes some problems reported by this rule. A problem is only fixed if one of the operands is a typeof expression, or if both operands are literals with the same type.

                  Options

                  always

                  The "always" option (default) enforces the use of === and !== in every situation (except when you opt-in to more specific handling of null [see below]).

                  Examples of incorrect code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a == b
                  foo == true
                  bananas != 1
                  value == undefined
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  Examples of correct code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a === b
                  foo === true
                  bananas !== 1
                  value === undefined
                  typeof foo === 'undefined'
                  'hello' !== 'world'
                  0 === 0
                  true === true
                  foo === null

                  This rule optionally takes a second argument, which should be an object with the following supported properties:

                  • "null": Customize how this rule treats null literals. Possible values:
                    • always (default) - Always use === or !==.
                    • never - Never use === or !== with null.
                    • ignore - Do not apply this rule to null.

                  smart

                  The "smart" option enforces the use of === and !== except for these cases:

                  • Comparing two literal values
                  • Evaluating the value of typeof
                  • Comparing against null

                  Examples of incorrect code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  // comparing two variables requires ===
                  a == b
                  
                  // only one side is a literal
                  foo == true
                  bananas != 1
                  
                  // comparing to undefined requires ===
                  value == undefined

                  Examples of correct code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  allow-null

                  Deprecated: Instead of using this option use "always" and pass a "null" option property with value "ignore". This will tell eslint to always enforce strict equality except when comparing with the null literal.

                  ["error", "always", {"null": "ignore"}]

                  When Not To Use It

                  If you don't want to enforce a style for using equality operators, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

                  Expected '===' and instead saw '=='.
                  Open

                      if (r2.asyncMode == 'fake') {
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Require === and !== (eqeqeq)

                  It is considered good practice to use the type-safe equality operators === and !== instead of their regular counterparts == and !=.

                  The reason for this is that == and != do type coercion which follows the rather obscure Abstract Equality Comparison Algorithm. For instance, the following statements are all considered true:

                  • [] == false
                  • [] == ![]
                  • 3 == "03"

                  If one of those occurs in an innocent-looking statement such as a == b the actual problem is very difficult to spot.

                  Rule Details

                  This rule is aimed at eliminating the type-unsafe equality operators.

                  Examples of incorrect code for this rule:

                  /*eslint eqeqeq: "error"*/
                  
                  if (x == 42) { }
                  
                  if ("" == text) { }
                  
                  if (obj.getStuff() != undefined) { }

                  The --fix option on the command line automatically fixes some problems reported by this rule. A problem is only fixed if one of the operands is a typeof expression, or if both operands are literals with the same type.

                  Options

                  always

                  The "always" option (default) enforces the use of === and !== in every situation (except when you opt-in to more specific handling of null [see below]).

                  Examples of incorrect code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a == b
                  foo == true
                  bananas != 1
                  value == undefined
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  Examples of correct code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a === b
                  foo === true
                  bananas !== 1
                  value === undefined
                  typeof foo === 'undefined'
                  'hello' !== 'world'
                  0 === 0
                  true === true
                  foo === null

                  This rule optionally takes a second argument, which should be an object with the following supported properties:

                  • "null": Customize how this rule treats null literals. Possible values:
                    • always (default) - Always use === or !==.
                    • never - Never use === or !== with null.
                    • ignore - Do not apply this rule to null.

                  smart

                  The "smart" option enforces the use of === and !== except for these cases:

                  • Comparing two literal values
                  • Evaluating the value of typeof
                  • Comparing against null

                  Examples of incorrect code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  // comparing two variables requires ===
                  a == b
                  
                  // only one side is a literal
                  foo == true
                  bananas != 1
                  
                  // comparing to undefined requires ===
                  value == undefined

                  Examples of correct code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  allow-null

                  Deprecated: Instead of using this option use "always" and pass a "null" option property with value "ignore". This will tell eslint to always enforce strict equality except when comparing with the null literal.

                  ["error", "always", {"null": "ignore"}]

                  When Not To Use It

                  If you don't want to enforce a style for using equality operators, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

                  Expected return with your callback function.
                  Open

                                  callback();
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Enforce Return After Callback (callback-return)

                  The callback pattern is at the heart of most I/O and event-driven programming in JavaScript.

                  function doSomething(err, callback) {
                      if (err) {
                          return callback(err);
                      }
                      callback();
                  }

                  To prevent calling the callback multiple times it is important to return anytime the callback is triggered outside of the main function body. Neglecting this technique often leads to issues where you do something more than once. For example, in the case of an HTTP request, you may try to send HTTP headers more than once leading Node.js to throw a Can't render headers after they are sent to the client. error.

                  Rule Details

                  This rule is aimed at ensuring that callbacks used outside of the main function block are always part-of or immediately preceding a return statement. This rule decides what is a callback based on the name of the function being called.

                  Options

                  The rule takes a single option - an array of possible callback names - which may include object methods. The default callback names are callback, cb, next.

                  Default callback names

                  Examples of incorrect code for this rule with the default ["callback", "cb", "next"] option:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          callback(err);
                      }
                      callback();
                  }

                  Examples of correct code for this rule with the default ["callback", "cb", "next"] option:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          return callback(err);
                      }
                      callback();
                  }

                  Supplied callback names

                  Examples of incorrect code for this rule with the option ["done", "send.error", "send.success"]:

                  /*eslint callback-return: ["error", ["done", "send.error", "send.success"]]*/
                  
                  function foo(err, done) {
                      if (err) {
                          done(err);
                      }
                      done();
                  }
                  
                  function bar(err, send) {
                      if (err) {
                          send.error(err);
                      }
                      send.success();
                  }

                  Examples of correct code for this rule with the option ["done", "send.error", "send.success"]:

                  /*eslint callback-return: ["error", ["done", "send.error", "send.success"]]*/
                  
                  function foo(err, done) {
                      if (err) {
                          return done(err);
                      }
                      done();
                  }
                  
                  function bar(err, send) {
                      if (err) {
                          return send.error(err);
                      }
                      send.success();
                  }

                  Known Limitations

                  Because it is difficult to understand the meaning of a program through static analysis, this rule has limitations:

                  • false negatives when this rule reports correct code, but the program calls the callback more than one time (which is incorrect behavior)
                  • false positives when this rule reports incorrect code, but the program calls the callback only one time (which is correct behavior)

                  Passing the callback by reference

                  The static analysis of this rule does not detect that the program calls the callback if it is an argument of a function (for example, setTimeout).

                  Example of a false negative when this rule reports correct code:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          setTimeout(callback, 0); // this is bad, but WILL NOT warn
                      }
                      callback();
                  }

                  Triggering the callback within a nested function

                  The static analysis of this rule does not detect that the program calls the callback from within a nested function or an immediately-invoked function expression (IIFE).

                  Example of a false negative when this rule reports correct code:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          process.nextTick(function() {
                              return callback(); // this is bad, but WILL NOT warn
                          });
                      }
                      callback();
                  }

                  If/else statements

                  The static analysis of this rule does not detect that the program calls the callback only one time in each branch of an if statement.

                  Example of a false positive when this rule reports incorrect code:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          callback(err); // this is fine, but WILL warn
                      } else {
                          callback();    // this is fine, but WILL warn
                      }
                  }

                  When Not To Use It

                  There are some cases where you might want to call a callback function more than once. In those cases this rule may lead to incorrect behavior. In those cases you may want to reserve a special name for those callbacks and not include that in the list of callbacks that trigger warnings.

                  Further Reading

                  Related Rules

                  Empty block statement.
                  Open

                  } catch (e) {}
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  disallow empty block statements (no-empty)

                  Empty block statements, while not technically errors, usually occur due to refactoring that wasn't completed. They can cause confusion when reading code.

                  Rule Details

                  This rule disallows empty block statements. This rule ignores block statements which contain a comment (for example, in an empty catch or finally block of a try statement to indicate that execution should continue regardless of errors).

                  Examples of incorrect code for this rule:

                  /*eslint no-empty: "error"*/
                  
                  if (foo) {
                  }
                  
                  while (foo) {
                  }
                  
                  switch(foo) {
                  }
                  
                  try {
                      doSomething();
                  } catch(ex) {
                  
                  } finally {
                  
                  }

                  Examples of correct code for this rule:

                  /*eslint no-empty: "error"*/
                  
                  if (foo) {
                      // empty
                  }
                  
                  while (foo) {
                      /* empty */
                  }
                  
                  try {
                      doSomething();
                  } catch (ex) {
                      // continue regardless of error
                  }
                  
                  try {
                      doSomething();
                  } finally {
                      /* continue regardless of error */
                  }

                  Options

                  This rule has an object option for exceptions:

                  • "allowEmptyCatch": true allows empty catch clauses (that is, which do not contain a comment)

                  allowEmptyCatch

                  Examples of additional correct code for this rule with the { "allowEmptyCatch": true } option:

                  /* eslint no-empty: ["error", { "allowEmptyCatch": true }] */
                  try {
                      doSomething();
                  } catch (ex) {}
                  
                  try {
                      doSomething();
                  }
                  catch (ex) {}
                  finally {
                      /* continue regardless of error */
                  }

                  When Not To Use It

                  If you intentionally use empty block statements then you can disable this rule.

                  Related Rules

                  The body of a for-in should be wrapped in an if statement to filter unwanted properties from the prototype.
                  Open

                      for (var a in obj) {
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Require Guarding for-in (guard-for-in)

                  Looping over objects with a for in loop will include properties that are inherited through the prototype chain. This behavior can lead to unexpected items in your for loop.

                  for (key in foo) {
                      doSomething(key);
                  }

                  Note that simply checking foo.hasOwnProperty(key) is likely to cause an error in some cases; see [no-prototype-builtins](no-prototype-builtins.md).

                  Rule Details

                  This rule is aimed at preventing unexpected behavior that could arise from using a for in loop without filtering the results in the loop. As such, it will warn when for in loops do not filter their results with an if statement.

                  Examples of incorrect code for this rule:

                  /*eslint guard-for-in: "error"*/
                  
                  for (key in foo) {
                      doSomething(key);
                  }

                  Examples of correct code for this rule:

                  /*eslint guard-for-in: "error"*/
                  
                  for (key in foo) {
                      if (Object.prototype.hasOwnProperty.call(foo, key)) {
                          doSomething(key);
                      }
                      if ({}.hasOwnProperty.call(foo, key)) {
                          doSomething(key);
                      }
                  }

                  Related Rules

                  • [no-prototype-builtins](no-prototype-builtins.md)

                  Further Reading

                  Expected return with your callback function.
                  Open

                              cb(txt);
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Enforce Return After Callback (callback-return)

                  The callback pattern is at the heart of most I/O and event-driven programming in JavaScript.

                  function doSomething(err, callback) {
                      if (err) {
                          return callback(err);
                      }
                      callback();
                  }

                  To prevent calling the callback multiple times it is important to return anytime the callback is triggered outside of the main function body. Neglecting this technique often leads to issues where you do something more than once. For example, in the case of an HTTP request, you may try to send HTTP headers more than once leading Node.js to throw a Can't render headers after they are sent to the client. error.

                  Rule Details

                  This rule is aimed at ensuring that callbacks used outside of the main function block are always part-of or immediately preceding a return statement. This rule decides what is a callback based on the name of the function being called.

                  Options

                  The rule takes a single option - an array of possible callback names - which may include object methods. The default callback names are callback, cb, next.

                  Default callback names

                  Examples of incorrect code for this rule with the default ["callback", "cb", "next"] option:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          callback(err);
                      }
                      callback();
                  }

                  Examples of correct code for this rule with the default ["callback", "cb", "next"] option:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          return callback(err);
                      }
                      callback();
                  }

                  Supplied callback names

                  Examples of incorrect code for this rule with the option ["done", "send.error", "send.success"]:

                  /*eslint callback-return: ["error", ["done", "send.error", "send.success"]]*/
                  
                  function foo(err, done) {
                      if (err) {
                          done(err);
                      }
                      done();
                  }
                  
                  function bar(err, send) {
                      if (err) {
                          send.error(err);
                      }
                      send.success();
                  }

                  Examples of correct code for this rule with the option ["done", "send.error", "send.success"]:

                  /*eslint callback-return: ["error", ["done", "send.error", "send.success"]]*/
                  
                  function foo(err, done) {
                      if (err) {
                          return done(err);
                      }
                      done();
                  }
                  
                  function bar(err, send) {
                      if (err) {
                          return send.error(err);
                      }
                      send.success();
                  }

                  Known Limitations

                  Because it is difficult to understand the meaning of a program through static analysis, this rule has limitations:

                  • false negatives when this rule reports correct code, but the program calls the callback more than one time (which is incorrect behavior)
                  • false positives when this rule reports incorrect code, but the program calls the callback only one time (which is correct behavior)

                  Passing the callback by reference

                  The static analysis of this rule does not detect that the program calls the callback if it is an argument of a function (for example, setTimeout).

                  Example of a false negative when this rule reports correct code:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          setTimeout(callback, 0); // this is bad, but WILL NOT warn
                      }
                      callback();
                  }

                  Triggering the callback within a nested function

                  The static analysis of this rule does not detect that the program calls the callback from within a nested function or an immediately-invoked function expression (IIFE).

                  Example of a false negative when this rule reports correct code:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          process.nextTick(function() {
                              return callback(); // this is bad, but WILL NOT warn
                          });
                      }
                      callback();
                  }

                  If/else statements

                  The static analysis of this rule does not detect that the program calls the callback only one time in each branch of an if statement.

                  Example of a false positive when this rule reports incorrect code:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          callback(err); // this is fine, but WILL warn
                      } else {
                          callback();    // this is fine, but WILL warn
                      }
                  }

                  When Not To Use It

                  There are some cases where you might want to call a callback function more than once. In those cases this rule may lead to incorrect behavior. In those cases you may want to reserve a special name for those callbacks and not include that in the list of callbacks that trigger warnings.

                  Further Reading

                  Related Rules

                  Expected '===' and instead saw '=='.
                  Open

                      if (typeof (XMLHttpRequest) == 'undefined') {
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Require === and !== (eqeqeq)

                  It is considered good practice to use the type-safe equality operators === and !== instead of their regular counterparts == and !=.

                  The reason for this is that == and != do type coercion which follows the rather obscure Abstract Equality Comparison Algorithm. For instance, the following statements are all considered true:

                  • [] == false
                  • [] == ![]
                  • 3 == "03"

                  If one of those occurs in an innocent-looking statement such as a == b the actual problem is very difficult to spot.

                  Rule Details

                  This rule is aimed at eliminating the type-unsafe equality operators.

                  Examples of incorrect code for this rule:

                  /*eslint eqeqeq: "error"*/
                  
                  if (x == 42) { }
                  
                  if ("" == text) { }
                  
                  if (obj.getStuff() != undefined) { }

                  The --fix option on the command line automatically fixes some problems reported by this rule. A problem is only fixed if one of the operands is a typeof expression, or if both operands are literals with the same type.

                  Options

                  always

                  The "always" option (default) enforces the use of === and !== in every situation (except when you opt-in to more specific handling of null [see below]).

                  Examples of incorrect code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a == b
                  foo == true
                  bananas != 1
                  value == undefined
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  Examples of correct code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a === b
                  foo === true
                  bananas !== 1
                  value === undefined
                  typeof foo === 'undefined'
                  'hello' !== 'world'
                  0 === 0
                  true === true
                  foo === null

                  This rule optionally takes a second argument, which should be an object with the following supported properties:

                  • "null": Customize how this rule treats null literals. Possible values:
                    • always (default) - Always use === or !==.
                    • never - Never use === or !== with null.
                    • ignore - Do not apply this rule to null.

                  smart

                  The "smart" option enforces the use of === and !== except for these cases:

                  • Comparing two literal values
                  • Evaluating the value of typeof
                  • Comparing against null

                  Examples of incorrect code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  // comparing two variables requires ===
                  a == b
                  
                  // only one side is a literal
                  foo == true
                  bananas != 1
                  
                  // comparing to undefined requires ===
                  value == undefined

                  Examples of correct code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  allow-null

                  Deprecated: Instead of using this option use "always" and pass a "null" option property with value "ignore". This will tell eslint to always enforce strict equality except when comparing with the null literal.

                  ["error", "always", {"null": "ignore"}]

                  When Not To Use It

                  If you don't want to enforce a style for using equality operators, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

                  Expected '!==' and instead saw '!='.
                  Open

                      if (typeof ('alert') != 'undefined') {
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Require === and !== (eqeqeq)

                  It is considered good practice to use the type-safe equality operators === and !== instead of their regular counterparts == and !=.

                  The reason for this is that == and != do type coercion which follows the rather obscure Abstract Equality Comparison Algorithm. For instance, the following statements are all considered true:

                  • [] == false
                  • [] == ![]
                  • 3 == "03"

                  If one of those occurs in an innocent-looking statement such as a == b the actual problem is very difficult to spot.

                  Rule Details

                  This rule is aimed at eliminating the type-unsafe equality operators.

                  Examples of incorrect code for this rule:

                  /*eslint eqeqeq: "error"*/
                  
                  if (x == 42) { }
                  
                  if ("" == text) { }
                  
                  if (obj.getStuff() != undefined) { }

                  The --fix option on the command line automatically fixes some problems reported by this rule. A problem is only fixed if one of the operands is a typeof expression, or if both operands are literals with the same type.

                  Options

                  always

                  The "always" option (default) enforces the use of === and !== in every situation (except when you opt-in to more specific handling of null [see below]).

                  Examples of incorrect code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a == b
                  foo == true
                  bananas != 1
                  value == undefined
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  Examples of correct code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a === b
                  foo === true
                  bananas !== 1
                  value === undefined
                  typeof foo === 'undefined'
                  'hello' !== 'world'
                  0 === 0
                  true === true
                  foo === null

                  This rule optionally takes a second argument, which should be an object with the following supported properties:

                  • "null": Customize how this rule treats null literals. Possible values:
                    • always (default) - Always use === or !==.
                    • never - Never use === or !== with null.
                    • ignore - Do not apply this rule to null.

                  smart

                  The "smart" option enforces the use of === and !== except for these cases:

                  • Comparing two literal values
                  • Evaluating the value of typeof
                  • Comparing against null

                  Examples of incorrect code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  // comparing two variables requires ===
                  a == b
                  
                  // only one side is a literal
                  foo == true
                  bananas != 1
                  
                  // comparing to undefined requires ===
                  value == undefined

                  Examples of correct code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  allow-null

                  Deprecated: Instead of using this option use "always" and pass a "null" option property with value "ignore". This will tell eslint to always enforce strict equality except when comparing with the null literal.

                  ["error", "always", {"null": "ignore"}]

                  When Not To Use It

                  If you don't want to enforce a style for using equality operators, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

                  Expected return with your callback function.
                  Open

                              cb(JSON.parse(txt)[0]);
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Enforce Return After Callback (callback-return)

                  The callback pattern is at the heart of most I/O and event-driven programming in JavaScript.

                  function doSomething(err, callback) {
                      if (err) {
                          return callback(err);
                      }
                      callback();
                  }

                  To prevent calling the callback multiple times it is important to return anytime the callback is triggered outside of the main function body. Neglecting this technique often leads to issues where you do something more than once. For example, in the case of an HTTP request, you may try to send HTTP headers more than once leading Node.js to throw a Can't render headers after they are sent to the client. error.

                  Rule Details

                  This rule is aimed at ensuring that callbacks used outside of the main function block are always part-of or immediately preceding a return statement. This rule decides what is a callback based on the name of the function being called.

                  Options

                  The rule takes a single option - an array of possible callback names - which may include object methods. The default callback names are callback, cb, next.

                  Default callback names

                  Examples of incorrect code for this rule with the default ["callback", "cb", "next"] option:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          callback(err);
                      }
                      callback();
                  }

                  Examples of correct code for this rule with the default ["callback", "cb", "next"] option:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          return callback(err);
                      }
                      callback();
                  }

                  Supplied callback names

                  Examples of incorrect code for this rule with the option ["done", "send.error", "send.success"]:

                  /*eslint callback-return: ["error", ["done", "send.error", "send.success"]]*/
                  
                  function foo(err, done) {
                      if (err) {
                          done(err);
                      }
                      done();
                  }
                  
                  function bar(err, send) {
                      if (err) {
                          send.error(err);
                      }
                      send.success();
                  }

                  Examples of correct code for this rule with the option ["done", "send.error", "send.success"]:

                  /*eslint callback-return: ["error", ["done", "send.error", "send.success"]]*/
                  
                  function foo(err, done) {
                      if (err) {
                          return done(err);
                      }
                      done();
                  }
                  
                  function bar(err, send) {
                      if (err) {
                          return send.error(err);
                      }
                      send.success();
                  }

                  Known Limitations

                  Because it is difficult to understand the meaning of a program through static analysis, this rule has limitations:

                  • false negatives when this rule reports correct code, but the program calls the callback more than one time (which is incorrect behavior)
                  • false positives when this rule reports incorrect code, but the program calls the callback only one time (which is correct behavior)

                  Passing the callback by reference

                  The static analysis of this rule does not detect that the program calls the callback if it is an argument of a function (for example, setTimeout).

                  Example of a false negative when this rule reports correct code:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          setTimeout(callback, 0); // this is bad, but WILL NOT warn
                      }
                      callback();
                  }

                  Triggering the callback within a nested function

                  The static analysis of this rule does not detect that the program calls the callback from within a nested function or an immediately-invoked function expression (IIFE).

                  Example of a false negative when this rule reports correct code:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          process.nextTick(function() {
                              return callback(); // this is bad, but WILL NOT warn
                          });
                      }
                      callback();
                  }

                  If/else statements

                  The static analysis of this rule does not detect that the program calls the callback only one time in each branch of an if statement.

                  Example of a false positive when this rule reports incorrect code:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          callback(err); // this is fine, but WILL warn
                      } else {
                          callback();    // this is fine, but WILL warn
                      }
                  }

                  When Not To Use It

                  There are some cases where you might want to call a callback function more than once. In those cases this rule may lead to incorrect behavior. In those cases you may want to reserve a special name for those callbacks and not include that in the list of callbacks that trigger warnings.

                  Further Reading

                  Related Rules

                  Expected '===' and instead saw '=='.
                  Open

                      if (r2.asyncMode == 'sasync') {
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Require === and !== (eqeqeq)

                  It is considered good practice to use the type-safe equality operators === and !== instead of their regular counterparts == and !=.

                  The reason for this is that == and != do type coercion which follows the rather obscure Abstract Equality Comparison Algorithm. For instance, the following statements are all considered true:

                  • [] == false
                  • [] == ![]
                  • 3 == "03"

                  If one of those occurs in an innocent-looking statement such as a == b the actual problem is very difficult to spot.

                  Rule Details

                  This rule is aimed at eliminating the type-unsafe equality operators.

                  Examples of incorrect code for this rule:

                  /*eslint eqeqeq: "error"*/
                  
                  if (x == 42) { }
                  
                  if ("" == text) { }
                  
                  if (obj.getStuff() != undefined) { }

                  The --fix option on the command line automatically fixes some problems reported by this rule. A problem is only fixed if one of the operands is a typeof expression, or if both operands are literals with the same type.

                  Options

                  always

                  The "always" option (default) enforces the use of === and !== in every situation (except when you opt-in to more specific handling of null [see below]).

                  Examples of incorrect code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a == b
                  foo == true
                  bananas != 1
                  value == undefined
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  Examples of correct code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a === b
                  foo === true
                  bananas !== 1
                  value === undefined
                  typeof foo === 'undefined'
                  'hello' !== 'world'
                  0 === 0
                  true === true
                  foo === null

                  This rule optionally takes a second argument, which should be an object with the following supported properties:

                  • "null": Customize how this rule treats null literals. Possible values:
                    • always (default) - Always use === or !==.
                    • never - Never use === or !== with null.
                    • ignore - Do not apply this rule to null.

                  smart

                  The "smart" option enforces the use of === and !== except for these cases:

                  • Comparing two literal values
                  • Evaluating the value of typeof
                  • Comparing against null

                  Examples of incorrect code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  // comparing two variables requires ===
                  a == b
                  
                  // only one side is a literal
                  foo == true
                  bananas != 1
                  
                  // comparing to undefined requires ===
                  value == undefined

                  Examples of correct code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  allow-null

                  Deprecated: Instead of using this option use "always" and pass a "null" option property with value "ignore". This will tell eslint to always enforce strict equality except when comparing with the null literal.

                  ["error", "always", {"null": "ignore"}]

                  When Not To Use It

                  If you don't want to enforce a style for using equality operators, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

                  Expected '===' and instead saw '=='.
                  Open

                      } else if (display[0] == 'f') {
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Require === and !== (eqeqeq)

                  It is considered good practice to use the type-safe equality operators === and !== instead of their regular counterparts == and !=.

                  The reason for this is that == and != do type coercion which follows the rather obscure Abstract Equality Comparison Algorithm. For instance, the following statements are all considered true:

                  • [] == false
                  • [] == ![]
                  • 3 == "03"

                  If one of those occurs in an innocent-looking statement such as a == b the actual problem is very difficult to spot.

                  Rule Details

                  This rule is aimed at eliminating the type-unsafe equality operators.

                  Examples of incorrect code for this rule:

                  /*eslint eqeqeq: "error"*/
                  
                  if (x == 42) { }
                  
                  if ("" == text) { }
                  
                  if (obj.getStuff() != undefined) { }

                  The --fix option on the command line automatically fixes some problems reported by this rule. A problem is only fixed if one of the operands is a typeof expression, or if both operands are literals with the same type.

                  Options

                  always

                  The "always" option (default) enforces the use of === and !== in every situation (except when you opt-in to more specific handling of null [see below]).

                  Examples of incorrect code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a == b
                  foo == true
                  bananas != 1
                  value == undefined
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  Examples of correct code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a === b
                  foo === true
                  bananas !== 1
                  value === undefined
                  typeof foo === 'undefined'
                  'hello' !== 'world'
                  0 === 0
                  true === true
                  foo === null

                  This rule optionally takes a second argument, which should be an object with the following supported properties:

                  • "null": Customize how this rule treats null literals. Possible values:
                    • always (default) - Always use === or !==.
                    • never - Never use === or !== with null.
                    • ignore - Do not apply this rule to null.

                  smart

                  The "smart" option enforces the use of === and !== except for these cases:

                  • Comparing two literal values
                  • Evaluating the value of typeof
                  • Comparing against null

                  Examples of incorrect code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  // comparing two variables requires ===
                  a == b
                  
                  // only one side is a literal
                  foo == true
                  bananas != 1
                  
                  // comparing to undefined requires ===
                  value == undefined

                  Examples of correct code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  allow-null

                  Deprecated: Instead of using this option use "always" and pass a "null" option property with value "ignore". This will tell eslint to always enforce strict equality except when comparing with the null literal.

                  ["error", "always", {"null": "ignore"}]

                  When Not To Use It

                  If you don't want to enforce a style for using equality operators, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

                  Unexpected alert.
                  Open

                          alert(x);
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Disallow Use of Alert (no-alert)

                  JavaScript's alert, confirm, and prompt functions are widely considered to be obtrusive as UI elements and should be replaced by a more appropriate custom UI implementation. Furthermore, alert is often used while debugging code, which should be removed before deployment to production.

                  alert("here!");

                  Rule Details

                  This rule is aimed at catching debugging code that should be removed and popup UI elements that should be replaced with less obtrusive, custom UIs. As such, it will warn when it encounters alert, prompt, and confirm function calls which are not shadowed.

                  Examples of incorrect code for this rule:

                  /*eslint no-alert: "error"*/
                  
                  alert("here!");
                  
                  confirm("Are you sure?");
                  
                  prompt("What's your name?", "John Doe");

                  Examples of correct code for this rule:

                  /*eslint no-alert: "error"*/
                  
                  customAlert("Something happened!");
                  
                  customConfirm("Are you sure?");
                  
                  customPrompt("Who are you?");
                  
                  function foo() {
                      var alert = myCustomLib.customAlert;
                      alert();
                  }

                  Related Rules

                  Expected '!==' and instead saw '!='.
                  Open

                      if (typeof (obj) != 'object') {
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Require === and !== (eqeqeq)

                  It is considered good practice to use the type-safe equality operators === and !== instead of their regular counterparts == and !=.

                  The reason for this is that == and != do type coercion which follows the rather obscure Abstract Equality Comparison Algorithm. For instance, the following statements are all considered true:

                  • [] == false
                  • [] == ![]
                  • 3 == "03"

                  If one of those occurs in an innocent-looking statement such as a == b the actual problem is very difficult to spot.

                  Rule Details

                  This rule is aimed at eliminating the type-unsafe equality operators.

                  Examples of incorrect code for this rule:

                  /*eslint eqeqeq: "error"*/
                  
                  if (x == 42) { }
                  
                  if ("" == text) { }
                  
                  if (obj.getStuff() != undefined) { }

                  The --fix option on the command line automatically fixes some problems reported by this rule. A problem is only fixed if one of the operands is a typeof expression, or if both operands are literals with the same type.

                  Options

                  always

                  The "always" option (default) enforces the use of === and !== in every situation (except when you opt-in to more specific handling of null [see below]).

                  Examples of incorrect code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a == b
                  foo == true
                  bananas != 1
                  value == undefined
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  Examples of correct code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a === b
                  foo === true
                  bananas !== 1
                  value === undefined
                  typeof foo === 'undefined'
                  'hello' !== 'world'
                  0 === 0
                  true === true
                  foo === null

                  This rule optionally takes a second argument, which should be an object with the following supported properties:

                  • "null": Customize how this rule treats null literals. Possible values:
                    • always (default) - Always use === or !==.
                    • never - Never use === or !== with null.
                    • ignore - Do not apply this rule to null.

                  smart

                  The "smart" option enforces the use of === and !== except for these cases:

                  • Comparing two literal values
                  • Evaluating the value of typeof
                  • Comparing against null

                  Examples of incorrect code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  // comparing two variables requires ===
                  a == b
                  
                  // only one side is a literal
                  foo == true
                  bananas != 1
                  
                  // comparing to undefined requires ===
                  value == undefined

                  Examples of correct code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  allow-null

                  Deprecated: Instead of using this option use "always" and pass a "null" option property with value "ignore". This will tell eslint to always enforce strict equality except when comparing with the null literal.

                  ["error", "always", {"null": "ignore"}]

                  When Not To Use It

                  If you don't want to enforce a style for using equality operators, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

                  'z' is already defined.
                  Open

                              var z = '';
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  disallow variable redeclaration (no-redeclare)

                  In JavaScript, it's possible to redeclare the same variable name using var. This can lead to confusion as to where the variable is actually declared and initialized.

                  Rule Details

                  This rule is aimed at eliminating variables that have multiple declarations in the same scope.

                  Examples of incorrect code for this rule:

                  /*eslint no-redeclare: "error"*/
                  
                  var a = 3;
                  var a = 10;

                  Examples of correct code for this rule:

                  /*eslint no-redeclare: "error"*/
                  
                  var a = 3;
                  // ...
                  a = 10;

                  Options

                  This rule takes one optional argument, an object with a boolean property "builtinGlobals". It defaults to false. If set to true, this rule also checks redeclaration of built-in globals, such as Object, Array, Number...

                  builtinGlobals

                  Examples of incorrect code for the { "builtinGlobals": true } option:

                  /*eslint no-redeclare: ["error", { "builtinGlobals": true }]*/
                  
                  var Object = 0;

                  Examples of incorrect code for the { "builtinGlobals": true } option and the browser environment:

                  /*eslint no-redeclare: ["error", { "builtinGlobals": true }]*/
                  /*eslint-env browser*/
                  
                  var top = 0;

                  The browser environment has many built-in global variables (for example, top). Some of built-in global variables cannot be redeclared. Source: http://eslint.org/docs/rules/

                  'i' is already defined.
                  Open

                              for (var i = 0; i < lines.length; i++) {
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  disallow variable redeclaration (no-redeclare)

                  In JavaScript, it's possible to redeclare the same variable name using var. This can lead to confusion as to where the variable is actually declared and initialized.

                  Rule Details

                  This rule is aimed at eliminating variables that have multiple declarations in the same scope.

                  Examples of incorrect code for this rule:

                  /*eslint no-redeclare: "error"*/
                  
                  var a = 3;
                  var a = 10;

                  Examples of correct code for this rule:

                  /*eslint no-redeclare: "error"*/
                  
                  var a = 3;
                  // ...
                  a = 10;

                  Options

                  This rule takes one optional argument, an object with a boolean property "builtinGlobals". It defaults to false. If set to true, this rule also checks redeclaration of built-in globals, such as Object, Array, Number...

                  builtinGlobals

                  Examples of incorrect code for the { "builtinGlobals": true } option:

                  /*eslint no-redeclare: ["error", { "builtinGlobals": true }]*/
                  
                  var Object = 0;

                  Examples of incorrect code for the { "builtinGlobals": true } option and the browser environment:

                  /*eslint no-redeclare: ["error", { "builtinGlobals": true }]*/
                  /*eslint-env browser*/
                  
                  var top = 0;

                  The browser environment has many built-in global variables (for example, top). Some of built-in global variables cannot be redeclared. Source: http://eslint.org/docs/rules/

                  'i' is already defined.
                  Open

                              for (var i = 0; i < lines.length; i++) {
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  disallow variable redeclaration (no-redeclare)

                  In JavaScript, it's possible to redeclare the same variable name using var. This can lead to confusion as to where the variable is actually declared and initialized.

                  Rule Details

                  This rule is aimed at eliminating variables that have multiple declarations in the same scope.

                  Examples of incorrect code for this rule:

                  /*eslint no-redeclare: "error"*/
                  
                  var a = 3;
                  var a = 10;

                  Examples of correct code for this rule:

                  /*eslint no-redeclare: "error"*/
                  
                  var a = 3;
                  // ...
                  a = 10;

                  Options

                  This rule takes one optional argument, an object with a boolean property "builtinGlobals". It defaults to false. If set to true, this rule also checks redeclaration of built-in globals, such as Object, Array, Number...

                  builtinGlobals

                  Examples of incorrect code for the { "builtinGlobals": true } option:

                  /*eslint no-redeclare: ["error", { "builtinGlobals": true }]*/
                  
                  var Object = 0;

                  Examples of incorrect code for the { "builtinGlobals": true } option and the browser environment:

                  /*eslint no-redeclare: ["error", { "builtinGlobals": true }]*/
                  /*eslint-env browser*/
                  
                  var top = 0;

                  The browser environment has many built-in global variables (for example, top). Some of built-in global variables cannot be redeclared. Source: http://eslint.org/docs/rules/

                  Expected '===' and instead saw '=='.
                  Open

                                      if (kv[0] == 'string') {
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Require === and !== (eqeqeq)

                  It is considered good practice to use the type-safe equality operators === and !== instead of their regular counterparts == and !=.

                  The reason for this is that == and != do type coercion which follows the rather obscure Abstract Equality Comparison Algorithm. For instance, the following statements are all considered true:

                  • [] == false
                  • [] == ![]
                  • 3 == "03"

                  If one of those occurs in an innocent-looking statement such as a == b the actual problem is very difficult to spot.

                  Rule Details

                  This rule is aimed at eliminating the type-unsafe equality operators.

                  Examples of incorrect code for this rule:

                  /*eslint eqeqeq: "error"*/
                  
                  if (x == 42) { }
                  
                  if ("" == text) { }
                  
                  if (obj.getStuff() != undefined) { }

                  The --fix option on the command line automatically fixes some problems reported by this rule. A problem is only fixed if one of the operands is a typeof expression, or if both operands are literals with the same type.

                  Options

                  always

                  The "always" option (default) enforces the use of === and !== in every situation (except when you opt-in to more specific handling of null [see below]).

                  Examples of incorrect code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a == b
                  foo == true
                  bananas != 1
                  value == undefined
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  Examples of correct code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a === b
                  foo === true
                  bananas !== 1
                  value === undefined
                  typeof foo === 'undefined'
                  'hello' !== 'world'
                  0 === 0
                  true === true
                  foo === null

                  This rule optionally takes a second argument, which should be an object with the following supported properties:

                  • "null": Customize how this rule treats null literals. Possible values:
                    • always (default) - Always use === or !==.
                    • never - Never use === or !== with null.
                    • ignore - Do not apply this rule to null.

                  smart

                  The "smart" option enforces the use of === and !== except for these cases:

                  • Comparing two literal values
                  • Evaluating the value of typeof
                  • Comparing against null

                  Examples of incorrect code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  // comparing two variables requires ===
                  a == b
                  
                  // only one side is a literal
                  foo == true
                  bananas != 1
                  
                  // comparing to undefined requires ===
                  value == undefined

                  Examples of correct code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  allow-null

                  Deprecated: Instead of using this option use "always" and pass a "null" option property with value "ignore". This will tell eslint to always enforce strict equality except when comparing with the null literal.

                  ["error", "always", {"null": "ignore"}]

                  When Not To Use It

                  If you don't want to enforce a style for using equality operators, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

                  Expected '===' and instead saw '=='.
                  Open

                      if (cmds.length == 0) return;
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Require === and !== (eqeqeq)

                  It is considered good practice to use the type-safe equality operators === and !== instead of their regular counterparts == and !=.

                  The reason for this is that == and != do type coercion which follows the rather obscure Abstract Equality Comparison Algorithm. For instance, the following statements are all considered true:

                  • [] == false
                  • [] == ![]
                  • 3 == "03"

                  If one of those occurs in an innocent-looking statement such as a == b the actual problem is very difficult to spot.

                  Rule Details

                  This rule is aimed at eliminating the type-unsafe equality operators.

                  Examples of incorrect code for this rule:

                  /*eslint eqeqeq: "error"*/
                  
                  if (x == 42) { }
                  
                  if ("" == text) { }
                  
                  if (obj.getStuff() != undefined) { }

                  The --fix option on the command line automatically fixes some problems reported by this rule. A problem is only fixed if one of the operands is a typeof expression, or if both operands are literals with the same type.

                  Options

                  always

                  The "always" option (default) enforces the use of === and !== in every situation (except when you opt-in to more specific handling of null [see below]).

                  Examples of incorrect code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a == b
                  foo == true
                  bananas != 1
                  value == undefined
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  Examples of correct code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a === b
                  foo === true
                  bananas !== 1
                  value === undefined
                  typeof foo === 'undefined'
                  'hello' !== 'world'
                  0 === 0
                  true === true
                  foo === null

                  This rule optionally takes a second argument, which should be an object with the following supported properties:

                  • "null": Customize how this rule treats null literals. Possible values:
                    • always (default) - Always use === or !==.
                    • never - Never use === or !== with null.
                    • ignore - Do not apply this rule to null.

                  smart

                  The "smart" option enforces the use of === and !== except for these cases:

                  • Comparing two literal values
                  • Evaluating the value of typeof
                  • Comparing against null

                  Examples of incorrect code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  // comparing two variables requires ===
                  a == b
                  
                  // only one side is a literal
                  foo == true
                  bananas != 1
                  
                  // comparing to undefined requires ===
                  value == undefined

                  Examples of correct code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  allow-null

                  Deprecated: Instead of using this option use "always" and pass a "null" option property with value "ignore". This will tell eslint to always enforce strict equality except when comparing with the null literal.

                  ["error", "always", {"null": "ignore"}]

                  When Not To Use It

                  If you don't want to enforce a style for using equality operators, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

                  The body of a for-in should be wrapped in an if statement to filter unwanted properties from the prototype.
                  Open

                          for (var prop in conf) {
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Require Guarding for-in (guard-for-in)

                  Looping over objects with a for in loop will include properties that are inherited through the prototype chain. This behavior can lead to unexpected items in your for loop.

                  for (key in foo) {
                      doSomething(key);
                  }

                  Note that simply checking foo.hasOwnProperty(key) is likely to cause an error in some cases; see [no-prototype-builtins](no-prototype-builtins.md).

                  Rule Details

                  This rule is aimed at preventing unexpected behavior that could arise from using a for in loop without filtering the results in the loop. As such, it will warn when for in loops do not filter their results with an if statement.

                  Examples of incorrect code for this rule:

                  /*eslint guard-for-in: "error"*/
                  
                  for (key in foo) {
                      doSomething(key);
                  }

                  Examples of correct code for this rule:

                  /*eslint guard-for-in: "error"*/
                  
                  for (key in foo) {
                      if (Object.prototype.hasOwnProperty.call(foo, key)) {
                          doSomething(key);
                      }
                      if ({}.hasOwnProperty.call(foo, key)) {
                          doSomething(key);
                      }
                  }

                  Related Rules

                  • [no-prototype-builtins](no-prototype-builtins.md)

                  Further Reading

                  Expected '===' and instead saw '=='.
                  Open

                                  if (fields[0].trim().indexOf('asm.') == 0) config[fields[0].trim()] = fields[2].trim();
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Require === and !== (eqeqeq)

                  It is considered good practice to use the type-safe equality operators === and !== instead of their regular counterparts == and !=.

                  The reason for this is that == and != do type coercion which follows the rather obscure Abstract Equality Comparison Algorithm. For instance, the following statements are all considered true:

                  • [] == false
                  • [] == ![]
                  • 3 == "03"

                  If one of those occurs in an innocent-looking statement such as a == b the actual problem is very difficult to spot.

                  Rule Details

                  This rule is aimed at eliminating the type-unsafe equality operators.

                  Examples of incorrect code for this rule:

                  /*eslint eqeqeq: "error"*/
                  
                  if (x == 42) { }
                  
                  if ("" == text) { }
                  
                  if (obj.getStuff() != undefined) { }

                  The --fix option on the command line automatically fixes some problems reported by this rule. A problem is only fixed if one of the operands is a typeof expression, or if both operands are literals with the same type.

                  Options

                  always

                  The "always" option (default) enforces the use of === and !== in every situation (except when you opt-in to more specific handling of null [see below]).

                  Examples of incorrect code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a == b
                  foo == true
                  bananas != 1
                  value == undefined
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  Examples of correct code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a === b
                  foo === true
                  bananas !== 1
                  value === undefined
                  typeof foo === 'undefined'
                  'hello' !== 'world'
                  0 === 0
                  true === true
                  foo === null

                  This rule optionally takes a second argument, which should be an object with the following supported properties:

                  • "null": Customize how this rule treats null literals. Possible values:
                    • always (default) - Always use === or !==.
                    • never - Never use === or !== with null.
                    • ignore - Do not apply this rule to null.

                  smart

                  The "smart" option enforces the use of === and !== except for these cases:

                  • Comparing two literal values
                  • Evaluating the value of typeof
                  • Comparing against null

                  Examples of incorrect code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  // comparing two variables requires ===
                  a == b
                  
                  // only one side is a literal
                  foo == true
                  bananas != 1
                  
                  // comparing to undefined requires ===
                  value == undefined

                  Examples of correct code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  allow-null

                  Deprecated: Instead of using this option use "always" and pass a "null" option property with value "ignore". This will tell eslint to always enforce strict equality except when comparing with the null literal.

                  ["error", "always", {"null": "ignore"}]

                  When Not To Use It

                  If you don't want to enforce a style for using equality operators, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

                  Expected '===' and instead saw '=='.
                  Open

                          if (e.name == 'NetworkError') {
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Require === and !== (eqeqeq)

                  It is considered good practice to use the type-safe equality operators === and !== instead of their regular counterparts == and !=.

                  The reason for this is that == and != do type coercion which follows the rather obscure Abstract Equality Comparison Algorithm. For instance, the following statements are all considered true:

                  • [] == false
                  • [] == ![]
                  • 3 == "03"

                  If one of those occurs in an innocent-looking statement such as a == b the actual problem is very difficult to spot.

                  Rule Details

                  This rule is aimed at eliminating the type-unsafe equality operators.

                  Examples of incorrect code for this rule:

                  /*eslint eqeqeq: "error"*/
                  
                  if (x == 42) { }
                  
                  if ("" == text) { }
                  
                  if (obj.getStuff() != undefined) { }

                  The --fix option on the command line automatically fixes some problems reported by this rule. A problem is only fixed if one of the operands is a typeof expression, or if both operands are literals with the same type.

                  Options

                  always

                  The "always" option (default) enforces the use of === and !== in every situation (except when you opt-in to more specific handling of null [see below]).

                  Examples of incorrect code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a == b
                  foo == true
                  bananas != 1
                  value == undefined
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  Examples of correct code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a === b
                  foo === true
                  bananas !== 1
                  value === undefined
                  typeof foo === 'undefined'
                  'hello' !== 'world'
                  0 === 0
                  true === true
                  foo === null

                  This rule optionally takes a second argument, which should be an object with the following supported properties:

                  • "null": Customize how this rule treats null literals. Possible values:
                    • always (default) - Always use === or !==.
                    • never - Never use === or !== with null.
                    • ignore - Do not apply this rule to null.

                  smart

                  The "smart" option enforces the use of === and !== except for these cases:

                  • Comparing two literal values
                  • Evaluating the value of typeof
                  • Comparing against null

                  Examples of incorrect code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  // comparing two variables requires ===
                  a == b
                  
                  // only one side is a literal
                  foo == true
                  bananas != 1
                  
                  // comparing to undefined requires ===
                  value == undefined

                  Examples of correct code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  allow-null

                  Deprecated: Instead of using this option use "always" and pass a "null" option property with value "ignore". This will tell eslint to always enforce strict equality except when comparing with the null literal.

                  ["error", "always", {"null": "ignore"}]

                  When Not To Use It

                  If you don't want to enforce a style for using equality operators, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

                  Expected '===' and instead saw '=='.
                  Open

                          if (cmd == undefined || cmds.length == 0) {
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Require === and !== (eqeqeq)

                  It is considered good practice to use the type-safe equality operators === and !== instead of their regular counterparts == and !=.

                  The reason for this is that == and != do type coercion which follows the rather obscure Abstract Equality Comparison Algorithm. For instance, the following statements are all considered true:

                  • [] == false
                  • [] == ![]
                  • 3 == "03"

                  If one of those occurs in an innocent-looking statement such as a == b the actual problem is very difficult to spot.

                  Rule Details

                  This rule is aimed at eliminating the type-unsafe equality operators.

                  Examples of incorrect code for this rule:

                  /*eslint eqeqeq: "error"*/
                  
                  if (x == 42) { }
                  
                  if ("" == text) { }
                  
                  if (obj.getStuff() != undefined) { }

                  The --fix option on the command line automatically fixes some problems reported by this rule. A problem is only fixed if one of the operands is a typeof expression, or if both operands are literals with the same type.

                  Options

                  always

                  The "always" option (default) enforces the use of === and !== in every situation (except when you opt-in to more specific handling of null [see below]).

                  Examples of incorrect code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a == b
                  foo == true
                  bananas != 1
                  value == undefined
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  Examples of correct code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a === b
                  foo === true
                  bananas !== 1
                  value === undefined
                  typeof foo === 'undefined'
                  'hello' !== 'world'
                  0 === 0
                  true === true
                  foo === null

                  This rule optionally takes a second argument, which should be an object with the following supported properties:

                  • "null": Customize how this rule treats null literals. Possible values:
                    • always (default) - Always use === or !==.
                    • never - Never use === or !== with null.
                    • ignore - Do not apply this rule to null.

                  smart

                  The "smart" option enforces the use of === and !== except for these cases:

                  • Comparing two literal values
                  • Evaluating the value of typeof
                  • Comparing against null

                  Examples of incorrect code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  // comparing two variables requires ===
                  a == b
                  
                  // only one side is a literal
                  foo == true
                  bananas != 1
                  
                  // comparing to undefined requires ===
                  value == undefined

                  Examples of correct code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  allow-null

                  Deprecated: Instead of using this option use "always" and pass a "null" option property with value "ignore". This will tell eslint to always enforce strict equality except when comparing with the null literal.

                  ["error", "always", {"null": "ignore"}]

                  When Not To Use It

                  If you don't want to enforce a style for using equality operators, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

                  Expected return with your callback function.
                  Open

                              cb();
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Enforce Return After Callback (callback-return)

                  The callback pattern is at the heart of most I/O and event-driven programming in JavaScript.

                  function doSomething(err, callback) {
                      if (err) {
                          return callback(err);
                      }
                      callback();
                  }

                  To prevent calling the callback multiple times it is important to return anytime the callback is triggered outside of the main function body. Neglecting this technique often leads to issues where you do something more than once. For example, in the case of an HTTP request, you may try to send HTTP headers more than once leading Node.js to throw a Can't render headers after they are sent to the client. error.

                  Rule Details

                  This rule is aimed at ensuring that callbacks used outside of the main function block are always part-of or immediately preceding a return statement. This rule decides what is a callback based on the name of the function being called.

                  Options

                  The rule takes a single option - an array of possible callback names - which may include object methods. The default callback names are callback, cb, next.

                  Default callback names

                  Examples of incorrect code for this rule with the default ["callback", "cb", "next"] option:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          callback(err);
                      }
                      callback();
                  }

                  Examples of correct code for this rule with the default ["callback", "cb", "next"] option:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          return callback(err);
                      }
                      callback();
                  }

                  Supplied callback names

                  Examples of incorrect code for this rule with the option ["done", "send.error", "send.success"]:

                  /*eslint callback-return: ["error", ["done", "send.error", "send.success"]]*/
                  
                  function foo(err, done) {
                      if (err) {
                          done(err);
                      }
                      done();
                  }
                  
                  function bar(err, send) {
                      if (err) {
                          send.error(err);
                      }
                      send.success();
                  }

                  Examples of correct code for this rule with the option ["done", "send.error", "send.success"]:

                  /*eslint callback-return: ["error", ["done", "send.error", "send.success"]]*/
                  
                  function foo(err, done) {
                      if (err) {
                          return done(err);
                      }
                      done();
                  }
                  
                  function bar(err, send) {
                      if (err) {
                          return send.error(err);
                      }
                      send.success();
                  }

                  Known Limitations

                  Because it is difficult to understand the meaning of a program through static analysis, this rule has limitations:

                  • false negatives when this rule reports correct code, but the program calls the callback more than one time (which is incorrect behavior)
                  • false positives when this rule reports incorrect code, but the program calls the callback only one time (which is correct behavior)

                  Passing the callback by reference

                  The static analysis of this rule does not detect that the program calls the callback if it is an argument of a function (for example, setTimeout).

                  Example of a false negative when this rule reports correct code:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          setTimeout(callback, 0); // this is bad, but WILL NOT warn
                      }
                      callback();
                  }

                  Triggering the callback within a nested function

                  The static analysis of this rule does not detect that the program calls the callback from within a nested function or an immediately-invoked function expression (IIFE).

                  Example of a false negative when this rule reports correct code:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          process.nextTick(function() {
                              return callback(); // this is bad, but WILL NOT warn
                          });
                      }
                      callback();
                  }

                  If/else statements

                  The static analysis of this rule does not detect that the program calls the callback only one time in each branch of an if statement.

                  Example of a false positive when this rule reports incorrect code:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          callback(err); // this is fine, but WILL warn
                      } else {
                          callback();    // this is fine, but WILL warn
                      }
                  }

                  When Not To Use It

                  There are some cases where you might want to call a callback function more than once. In those cases this rule may lead to incorrect behavior. In those cases you may want to reserve a special name for those callbacks and not include that in the list of callbacks that trigger warnings.

                  Further Reading

                  Related Rules

                  Expected '===' and instead saw '=='.
                  Open

                                  var mark = row[1] == '*' ? '*' : ' ';
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Require === and !== (eqeqeq)

                  It is considered good practice to use the type-safe equality operators === and !== instead of their regular counterparts == and !=.

                  The reason for this is that == and != do type coercion which follows the rather obscure Abstract Equality Comparison Algorithm. For instance, the following statements are all considered true:

                  • [] == false
                  • [] == ![]
                  • 3 == "03"

                  If one of those occurs in an innocent-looking statement such as a == b the actual problem is very difficult to spot.

                  Rule Details

                  This rule is aimed at eliminating the type-unsafe equality operators.

                  Examples of incorrect code for this rule:

                  /*eslint eqeqeq: "error"*/
                  
                  if (x == 42) { }
                  
                  if ("" == text) { }
                  
                  if (obj.getStuff() != undefined) { }

                  The --fix option on the command line automatically fixes some problems reported by this rule. A problem is only fixed if one of the operands is a typeof expression, or if both operands are literals with the same type.

                  Options

                  always

                  The "always" option (default) enforces the use of === and !== in every situation (except when you opt-in to more specific handling of null [see below]).

                  Examples of incorrect code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a == b
                  foo == true
                  bananas != 1
                  value == undefined
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  Examples of correct code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a === b
                  foo === true
                  bananas !== 1
                  value === undefined
                  typeof foo === 'undefined'
                  'hello' !== 'world'
                  0 === 0
                  true === true
                  foo === null

                  This rule optionally takes a second argument, which should be an object with the following supported properties:

                  • "null": Customize how this rule treats null literals. Possible values:
                    • always (default) - Always use === or !==.
                    • never - Never use === or !== with null.
                    • ignore - Do not apply this rule to null.

                  smart

                  The "smart" option enforces the use of === and !== except for these cases:

                  • Comparing two literal values
                  • Evaluating the value of typeof
                  • Comparing against null

                  Examples of incorrect code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  // comparing two variables requires ===
                  a == b
                  
                  // only one side is a literal
                  foo == true
                  bananas != 1
                  
                  // comparing to undefined requires ===
                  value == undefined

                  Examples of correct code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  allow-null

                  Deprecated: Instead of using this option use "always" and pass a "null" option property with value "ignore". This will tell eslint to always enforce strict equality except when comparing with the null literal.

                  ["error", "always", {"null": "ignore"}]

                  When Not To Use It

                  If you don't want to enforce a style for using equality operators, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

                  Expected '!==' and instead saw '!='.
                  Open

                          if (x.indexOf(';pd') != -1) return true;
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Require === and !== (eqeqeq)

                  It is considered good practice to use the type-safe equality operators === and !== instead of their regular counterparts == and !=.

                  The reason for this is that == and != do type coercion which follows the rather obscure Abstract Equality Comparison Algorithm. For instance, the following statements are all considered true:

                  • [] == false
                  • [] == ![]
                  • 3 == "03"

                  If one of those occurs in an innocent-looking statement such as a == b the actual problem is very difficult to spot.

                  Rule Details

                  This rule is aimed at eliminating the type-unsafe equality operators.

                  Examples of incorrect code for this rule:

                  /*eslint eqeqeq: "error"*/
                  
                  if (x == 42) { }
                  
                  if ("" == text) { }
                  
                  if (obj.getStuff() != undefined) { }

                  The --fix option on the command line automatically fixes some problems reported by this rule. A problem is only fixed if one of the operands is a typeof expression, or if both operands are literals with the same type.

                  Options

                  always

                  The "always" option (default) enforces the use of === and !== in every situation (except when you opt-in to more specific handling of null [see below]).

                  Examples of incorrect code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a == b
                  foo == true
                  bananas != 1
                  value == undefined
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  Examples of correct code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a === b
                  foo === true
                  bananas !== 1
                  value === undefined
                  typeof foo === 'undefined'
                  'hello' !== 'world'
                  0 === 0
                  true === true
                  foo === null

                  This rule optionally takes a second argument, which should be an object with the following supported properties:

                  • "null": Customize how this rule treats null literals. Possible values:
                    • always (default) - Always use === or !==.
                    • never - Never use === or !== with null.
                    • ignore - Do not apply this rule to null.

                  smart

                  The "smart" option enforces the use of === and !== except for these cases:

                  • Comparing two literal values
                  • Evaluating the value of typeof
                  • Comparing against null

                  Examples of incorrect code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  // comparing two variables requires ===
                  a == b
                  
                  // only one side is a literal
                  foo == true
                  bananas != 1
                  
                  // comparing to undefined requires ===
                  value == undefined

                  Examples of correct code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  allow-null

                  Deprecated: Instead of using this option use "always" and pass a "null" option property with value "ignore". This will tell eslint to always enforce strict equality except when comparing with the null literal.

                  ["error", "always", {"null": "ignore"}]

                  When Not To Use It

                  If you don't want to enforce a style for using equality operators, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

                  Expected return with your callback function.
                  Open

                              cb(JSON.parse(x));
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Enforce Return After Callback (callback-return)

                  The callback pattern is at the heart of most I/O and event-driven programming in JavaScript.

                  function doSomething(err, callback) {
                      if (err) {
                          return callback(err);
                      }
                      callback();
                  }

                  To prevent calling the callback multiple times it is important to return anytime the callback is triggered outside of the main function body. Neglecting this technique often leads to issues where you do something more than once. For example, in the case of an HTTP request, you may try to send HTTP headers more than once leading Node.js to throw a Can't render headers after they are sent to the client. error.

                  Rule Details

                  This rule is aimed at ensuring that callbacks used outside of the main function block are always part-of or immediately preceding a return statement. This rule decides what is a callback based on the name of the function being called.

                  Options

                  The rule takes a single option - an array of possible callback names - which may include object methods. The default callback names are callback, cb, next.

                  Default callback names

                  Examples of incorrect code for this rule with the default ["callback", "cb", "next"] option:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          callback(err);
                      }
                      callback();
                  }

                  Examples of correct code for this rule with the default ["callback", "cb", "next"] option:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          return callback(err);
                      }
                      callback();
                  }

                  Supplied callback names

                  Examples of incorrect code for this rule with the option ["done", "send.error", "send.success"]:

                  /*eslint callback-return: ["error", ["done", "send.error", "send.success"]]*/
                  
                  function foo(err, done) {
                      if (err) {
                          done(err);
                      }
                      done();
                  }
                  
                  function bar(err, send) {
                      if (err) {
                          send.error(err);
                      }
                      send.success();
                  }

                  Examples of correct code for this rule with the option ["done", "send.error", "send.success"]:

                  /*eslint callback-return: ["error", ["done", "send.error", "send.success"]]*/
                  
                  function foo(err, done) {
                      if (err) {
                          return done(err);
                      }
                      done();
                  }
                  
                  function bar(err, send) {
                      if (err) {
                          return send.error(err);
                      }
                      send.success();
                  }

                  Known Limitations

                  Because it is difficult to understand the meaning of a program through static analysis, this rule has limitations:

                  • false negatives when this rule reports correct code, but the program calls the callback more than one time (which is incorrect behavior)
                  • false positives when this rule reports incorrect code, but the program calls the callback only one time (which is correct behavior)

                  Passing the callback by reference

                  The static analysis of this rule does not detect that the program calls the callback if it is an argument of a function (for example, setTimeout).

                  Example of a false negative when this rule reports correct code:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          setTimeout(callback, 0); // this is bad, but WILL NOT warn
                      }
                      callback();
                  }

                  Triggering the callback within a nested function

                  The static analysis of this rule does not detect that the program calls the callback from within a nested function or an immediately-invoked function expression (IIFE).

                  Example of a false negative when this rule reports correct code:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          process.nextTick(function() {
                              return callback(); // this is bad, but WILL NOT warn
                          });
                      }
                      callback();
                  }

                  If/else statements

                  The static analysis of this rule does not detect that the program calls the callback only one time in each branch of an if statement.

                  Example of a false positive when this rule reports incorrect code:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          callback(err); // this is fine, but WILL warn
                      } else {
                          callback();    // this is fine, but WILL warn
                      }
                  }

                  When Not To Use It

                  There are some cases where you might want to call a callback function more than once. In those cases this rule may lead to incorrect behavior. In those cases you may want to reserve a special name for those callbacks and not include that in the list of callbacks that trigger warnings.

                  Further Reading

                  Related Rules

                  Expected '===' and instead saw '=='.
                  Open

                                      if (kv[0] == 'name') {
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Require === and !== (eqeqeq)

                  It is considered good practice to use the type-safe equality operators === and !== instead of their regular counterparts == and !=.

                  The reason for this is that == and != do type coercion which follows the rather obscure Abstract Equality Comparison Algorithm. For instance, the following statements are all considered true:

                  • [] == false
                  • [] == ![]
                  • 3 == "03"

                  If one of those occurs in an innocent-looking statement such as a == b the actual problem is very difficult to spot.

                  Rule Details

                  This rule is aimed at eliminating the type-unsafe equality operators.

                  Examples of incorrect code for this rule:

                  /*eslint eqeqeq: "error"*/
                  
                  if (x == 42) { }
                  
                  if ("" == text) { }
                  
                  if (obj.getStuff() != undefined) { }

                  The --fix option on the command line automatically fixes some problems reported by this rule. A problem is only fixed if one of the operands is a typeof expression, or if both operands are literals with the same type.

                  Options

                  always

                  The "always" option (default) enforces the use of === and !== in every situation (except when you opt-in to more specific handling of null [see below]).

                  Examples of incorrect code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a == b
                  foo == true
                  bananas != 1
                  value == undefined
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  Examples of correct code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a === b
                  foo === true
                  bananas !== 1
                  value === undefined
                  typeof foo === 'undefined'
                  'hello' !== 'world'
                  0 === 0
                  true === true
                  foo === null

                  This rule optionally takes a second argument, which should be an object with the following supported properties:

                  • "null": Customize how this rule treats null literals. Possible values:
                    • always (default) - Always use === or !==.
                    • never - Never use === or !== with null.
                    • ignore - Do not apply this rule to null.

                  smart

                  The "smart" option enforces the use of === and !== except for these cases:

                  • Comparing two literal values
                  • Evaluating the value of typeof
                  • Comparing against null

                  Examples of incorrect code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  // comparing two variables requires ===
                  a == b
                  
                  // only one side is a literal
                  foo == true
                  bananas != 1
                  
                  // comparing to undefined requires ===
                  value == undefined

                  Examples of correct code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  allow-null

                  Deprecated: Instead of using this option use "always" and pass a "null" option property with value "ignore". This will tell eslint to always enforce strict equality except when comparing with the null literal.

                  ["error", "always", {"null": "ignore"}]

                  When Not To Use It

                  If you don't want to enforce a style for using equality operators, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

                  Expected '===' and instead saw '=='.
                  Open

                          if (x[0] == 'p' && x[1] == 'd') return true;
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Require === and !== (eqeqeq)

                  It is considered good practice to use the type-safe equality operators === and !== instead of their regular counterparts == and !=.

                  The reason for this is that == and != do type coercion which follows the rather obscure Abstract Equality Comparison Algorithm. For instance, the following statements are all considered true:

                  • [] == false
                  • [] == ![]
                  • 3 == "03"

                  If one of those occurs in an innocent-looking statement such as a == b the actual problem is very difficult to spot.

                  Rule Details

                  This rule is aimed at eliminating the type-unsafe equality operators.

                  Examples of incorrect code for this rule:

                  /*eslint eqeqeq: "error"*/
                  
                  if (x == 42) { }
                  
                  if ("" == text) { }
                  
                  if (obj.getStuff() != undefined) { }

                  The --fix option on the command line automatically fixes some problems reported by this rule. A problem is only fixed if one of the operands is a typeof expression, or if both operands are literals with the same type.

                  Options

                  always

                  The "always" option (default) enforces the use of === and !== in every situation (except when you opt-in to more specific handling of null [see below]).

                  Examples of incorrect code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a == b
                  foo == true
                  bananas != 1
                  value == undefined
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  Examples of correct code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a === b
                  foo === true
                  bananas !== 1
                  value === undefined
                  typeof foo === 'undefined'
                  'hello' !== 'world'
                  0 === 0
                  true === true
                  foo === null

                  This rule optionally takes a second argument, which should be an object with the following supported properties:

                  • "null": Customize how this rule treats null literals. Possible values:
                    • always (default) - Always use === or !==.
                    • never - Never use === or !== with null.
                    • ignore - Do not apply this rule to null.

                  smart

                  The "smart" option enforces the use of === and !== except for these cases:

                  • Comparing two literal values
                  • Evaluating the value of typeof
                  • Comparing against null

                  Examples of incorrect code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  // comparing two variables requires ===
                  a == b
                  
                  // only one side is a literal
                  foo == true
                  bananas != 1
                  
                  // comparing to undefined requires ===
                  value == undefined

                  Examples of correct code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  allow-null

                  Deprecated: Instead of using this option use "always" and pass a "null" option property with value "ignore". This will tell eslint to always enforce strict equality except when comparing with the null literal.

                  ["error", "always", {"null": "ignore"}]

                  When Not To Use It

                  If you don't want to enforce a style for using equality operators, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

                  Expected '===' and instead saw '=='.
                  Open

                          if (x.status == 200) {
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Require === and !== (eqeqeq)

                  It is considered good practice to use the type-safe equality operators === and !== instead of their regular counterparts == and !=.

                  The reason for this is that == and != do type coercion which follows the rather obscure Abstract Equality Comparison Algorithm. For instance, the following statements are all considered true:

                  • [] == false
                  • [] == ![]
                  • 3 == "03"

                  If one of those occurs in an innocent-looking statement such as a == b the actual problem is very difficult to spot.

                  Rule Details

                  This rule is aimed at eliminating the type-unsafe equality operators.

                  Examples of incorrect code for this rule:

                  /*eslint eqeqeq: "error"*/
                  
                  if (x == 42) { }
                  
                  if ("" == text) { }
                  
                  if (obj.getStuff() != undefined) { }

                  The --fix option on the command line automatically fixes some problems reported by this rule. A problem is only fixed if one of the operands is a typeof expression, or if both operands are literals with the same type.

                  Options

                  always

                  The "always" option (default) enforces the use of === and !== in every situation (except when you opt-in to more specific handling of null [see below]).

                  Examples of incorrect code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a == b
                  foo == true
                  bananas != 1
                  value == undefined
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  Examples of correct code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a === b
                  foo === true
                  bananas !== 1
                  value === undefined
                  typeof foo === 'undefined'
                  'hello' !== 'world'
                  0 === 0
                  true === true
                  foo === null

                  This rule optionally takes a second argument, which should be an object with the following supported properties:

                  • "null": Customize how this rule treats null literals. Possible values:
                    • always (default) - Always use === or !==.
                    • never - Never use === or !== with null.
                    • ignore - Do not apply this rule to null.

                  smart

                  The "smart" option enforces the use of === and !== except for these cases:

                  • Comparing two literal values
                  • Evaluating the value of typeof
                  • Comparing against null

                  Examples of incorrect code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  // comparing two variables requires ===
                  a == b
                  
                  // only one side is a literal
                  foo == true
                  bananas != 1
                  
                  // comparing to undefined requires ===
                  value == undefined

                  Examples of correct code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  allow-null

                  Deprecated: Instead of using this option use "always" and pass a "null" option property with value "ignore". This will tell eslint to always enforce strict equality except when comparing with the null literal.

                  ["error", "always", {"null": "ignore"}]

                  When Not To Use It

                  If you don't want to enforce a style for using equality operators, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

                  Expected '===' and instead saw '=='.
                  Open

                          if (cmd == undefined || cmds.length == 0) {
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Require === and !== (eqeqeq)

                  It is considered good practice to use the type-safe equality operators === and !== instead of their regular counterparts == and !=.

                  The reason for this is that == and != do type coercion which follows the rather obscure Abstract Equality Comparison Algorithm. For instance, the following statements are all considered true:

                  • [] == false
                  • [] == ![]
                  • 3 == "03"

                  If one of those occurs in an innocent-looking statement such as a == b the actual problem is very difficult to spot.

                  Rule Details

                  This rule is aimed at eliminating the type-unsafe equality operators.

                  Examples of incorrect code for this rule:

                  /*eslint eqeqeq: "error"*/
                  
                  if (x == 42) { }
                  
                  if ("" == text) { }
                  
                  if (obj.getStuff() != undefined) { }

                  The --fix option on the command line automatically fixes some problems reported by this rule. A problem is only fixed if one of the operands is a typeof expression, or if both operands are literals with the same type.

                  Options

                  always

                  The "always" option (default) enforces the use of === and !== in every situation (except when you opt-in to more specific handling of null [see below]).

                  Examples of incorrect code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a == b
                  foo == true
                  bananas != 1
                  value == undefined
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  Examples of correct code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a === b
                  foo === true
                  bananas !== 1
                  value === undefined
                  typeof foo === 'undefined'
                  'hello' !== 'world'
                  0 === 0
                  true === true
                  foo === null

                  This rule optionally takes a second argument, which should be an object with the following supported properties:

                  • "null": Customize how this rule treats null literals. Possible values:
                    • always (default) - Always use === or !==.
                    • never - Never use === or !== with null.
                    • ignore - Do not apply this rule to null.

                  smart

                  The "smart" option enforces the use of === and !== except for these cases:

                  • Comparing two literal values
                  • Evaluating the value of typeof
                  • Comparing against null

                  Examples of incorrect code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  // comparing two variables requires ===
                  a == b
                  
                  // only one side is a literal
                  foo == true
                  bananas != 1
                  
                  // comparing to undefined requires ===
                  value == undefined

                  Examples of correct code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  allow-null

                  Deprecated: Instead of using this option use "always" and pass a "null" option property with value "ignore". This will tell eslint to always enforce strict equality except when comparing with the null literal.

                  ["error", "always", {"null": "ignore"}]

                  When Not To Use It

                  If you don't want to enforce a style for using equality operators, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

                  It's not necessary to initialize 'x' to undefined.
                  Open

                      var x = undefined;
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Disallow Initializing to undefined (no-undef-init)

                  In JavaScript, a variable that is declared and not initialized to any value automatically gets the value of undefined. For example:

                  var foo;
                  
                  console.log(foo === undefined);     // true

                  It's therefore unnecessary to initialize a variable to undefined, such as:

                  var foo = undefined;

                  It's considered a best practice to avoid initializing variables to undefined.

                  Rule Details

                  This rule aims to eliminate variable declarations that initialize to undefined.

                  Examples of incorrect code for this rule:

                  /*eslint no-undef-init: "error"*/
                  /*eslint-env es6*/
                  
                  var foo = undefined;
                  let bar = undefined;

                  Examples of correct code for this rule:

                  /*eslint no-undef-init: "error"*/
                  /*eslint-env es6*/
                  
                  var foo;
                  let bar;
                  const baz = undefined;

                  When Not To Use It

                  There is one situation where initializing to undefined behaves differently than omitting the initialization, and that's when a var declaration occurs inside of a loop. For example:

                  Example of incorrect code for this rule:

                  for (i = 0; i < 10; i++) {
                      var x = undefined;
                      console.log(x);
                      x = i;
                  }

                  In this case, the var x is hoisted out of the loop, effectively creating:

                  var x;
                  
                  for (i = 0; i < 10; i++) {
                      x = undefined;
                      console.log(x);
                      x = i;
                  }

                  If you were to remove the initialization, then the behavior of the loop changes:

                  for (i = 0; i < 10; i++) {
                      var x;
                      console.log(x);
                      x = i;
                  }

                  This code is equivalent to:

                  var x;
                  
                  for (i = 0; i < 10; i++) {
                      console.log(x);
                      x = i;
                  }

                  This produces a different outcome than defining var x = undefined in the loop, as x is no longer reset to undefined each time through the loop.

                  If you're using such an initialization inside of a loop, then you should disable this rule.

                  Example of correct code for this rule, because it is disabled on a specific line:

                  /*eslint no-undef-init: "error"*/
                  
                  for (i = 0; i < 10; i++) {
                      var x = undefined; // eslint-disable-line no-undef-init
                      console.log(x);
                      x = i;
                  }

                  Related Rules

                  Expected '===' and instead saw '=='.
                  Open

                              if (name == r2.flags[f][v].name) return f;
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Require === and !== (eqeqeq)

                  It is considered good practice to use the type-safe equality operators === and !== instead of their regular counterparts == and !=.

                  The reason for this is that == and != do type coercion which follows the rather obscure Abstract Equality Comparison Algorithm. For instance, the following statements are all considered true:

                  • [] == false
                  • [] == ![]
                  • 3 == "03"

                  If one of those occurs in an innocent-looking statement such as a == b the actual problem is very difficult to spot.

                  Rule Details

                  This rule is aimed at eliminating the type-unsafe equality operators.

                  Examples of incorrect code for this rule:

                  /*eslint eqeqeq: "error"*/
                  
                  if (x == 42) { }
                  
                  if ("" == text) { }
                  
                  if (obj.getStuff() != undefined) { }

                  The --fix option on the command line automatically fixes some problems reported by this rule. A problem is only fixed if one of the operands is a typeof expression, or if both operands are literals with the same type.

                  Options

                  always

                  The "always" option (default) enforces the use of === and !== in every situation (except when you opt-in to more specific handling of null [see below]).

                  Examples of incorrect code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a == b
                  foo == true
                  bananas != 1
                  value == undefined
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  Examples of correct code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a === b
                  foo === true
                  bananas !== 1
                  value === undefined
                  typeof foo === 'undefined'
                  'hello' !== 'world'
                  0 === 0
                  true === true
                  foo === null

                  This rule optionally takes a second argument, which should be an object with the following supported properties:

                  • "null": Customize how this rule treats null literals. Possible values:
                    • always (default) - Always use === or !==.
                    • never - Never use === or !== with null.
                    • ignore - Do not apply this rule to null.

                  smart

                  The "smart" option enforces the use of === and !== except for these cases:

                  • Comparing two literal values
                  • Evaluating the value of typeof
                  • Comparing against null

                  Examples of incorrect code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  // comparing two variables requires ===
                  a == b
                  
                  // only one side is a literal
                  foo == true
                  bananas != 1
                  
                  // comparing to undefined requires ===
                  value == undefined

                  Examples of correct code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  allow-null

                  Deprecated: Instead of using this option use "always" and pass a "null" option property with value "ignore". This will tell eslint to always enforce strict equality except when comparing with the null literal.

                  ["error", "always", {"null": "ignore"}]

                  When Not To Use It

                  If you don't want to enforce a style for using equality operators, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

                  Expected return with your callback function.
                  Open

                                      cb(x);
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Enforce Return After Callback (callback-return)

                  The callback pattern is at the heart of most I/O and event-driven programming in JavaScript.

                  function doSomething(err, callback) {
                      if (err) {
                          return callback(err);
                      }
                      callback();
                  }

                  To prevent calling the callback multiple times it is important to return anytime the callback is triggered outside of the main function body. Neglecting this technique often leads to issues where you do something more than once. For example, in the case of an HTTP request, you may try to send HTTP headers more than once leading Node.js to throw a Can't render headers after they are sent to the client. error.

                  Rule Details

                  This rule is aimed at ensuring that callbacks used outside of the main function block are always part-of or immediately preceding a return statement. This rule decides what is a callback based on the name of the function being called.

                  Options

                  The rule takes a single option - an array of possible callback names - which may include object methods. The default callback names are callback, cb, next.

                  Default callback names

                  Examples of incorrect code for this rule with the default ["callback", "cb", "next"] option:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          callback(err);
                      }
                      callback();
                  }

                  Examples of correct code for this rule with the default ["callback", "cb", "next"] option:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          return callback(err);
                      }
                      callback();
                  }

                  Supplied callback names

                  Examples of incorrect code for this rule with the option ["done", "send.error", "send.success"]:

                  /*eslint callback-return: ["error", ["done", "send.error", "send.success"]]*/
                  
                  function foo(err, done) {
                      if (err) {
                          done(err);
                      }
                      done();
                  }
                  
                  function bar(err, send) {
                      if (err) {
                          send.error(err);
                      }
                      send.success();
                  }

                  Examples of correct code for this rule with the option ["done", "send.error", "send.success"]:

                  /*eslint callback-return: ["error", ["done", "send.error", "send.success"]]*/
                  
                  function foo(err, done) {
                      if (err) {
                          return done(err);
                      }
                      done();
                  }
                  
                  function bar(err, send) {
                      if (err) {
                          return send.error(err);
                      }
                      send.success();
                  }

                  Known Limitations

                  Because it is difficult to understand the meaning of a program through static analysis, this rule has limitations:

                  • false negatives when this rule reports correct code, but the program calls the callback more than one time (which is incorrect behavior)
                  • false positives when this rule reports incorrect code, but the program calls the callback only one time (which is correct behavior)

                  Passing the callback by reference

                  The static analysis of this rule does not detect that the program calls the callback if it is an argument of a function (for example, setTimeout).

                  Example of a false negative when this rule reports correct code:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          setTimeout(callback, 0); // this is bad, but WILL NOT warn
                      }
                      callback();
                  }

                  Triggering the callback within a nested function

                  The static analysis of this rule does not detect that the program calls the callback from within a nested function or an immediately-invoked function expression (IIFE).

                  Example of a false negative when this rule reports correct code:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          process.nextTick(function() {
                              return callback(); // this is bad, but WILL NOT warn
                          });
                      }
                      callback();
                  }

                  If/else statements

                  The static analysis of this rule does not detect that the program calls the callback only one time in each branch of an if statement.

                  Example of a false positive when this rule reports incorrect code:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          callback(err); // this is fine, but WILL warn
                      } else {
                          callback();    // this is fine, but WILL warn
                      }
                  }

                  When Not To Use It

                  There are some cases where you might want to call a callback function more than once. In those cases this rule may lead to incorrect behavior. In those cases you may want to reserve a special name for those callbacks and not include that in the list of callbacks that trigger warnings.

                  Further Reading

                  Related Rules

                  Unnecessary semicolon.
                  Open

                      ;
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  disallow unnecessary semicolons (no-extra-semi)

                  Typing mistakes and misunderstandings about where semicolons are required can lead to semicolons that are unnecessary. While not technically an error, extra semicolons can cause confusion when reading code.

                  Rule Details

                  This rule disallows unnecessary semicolons.

                  Examples of incorrect code for this rule:

                  /*eslint no-extra-semi: "error"*/
                  
                  var x = 5;;
                  
                  function foo() {
                      // code
                  };

                  Examples of correct code for this rule:

                  /*eslint no-extra-semi: "error"*/
                  
                  var x = 5;
                  
                  var foo = function() {
                      // code
                  };

                  When Not To Use It

                  If you intentionally use extra semicolons then you can disable this rule.

                  Related Rules

                  Empty block statement.
                  Open

                          } else {
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  disallow empty block statements (no-empty)

                  Empty block statements, while not technically errors, usually occur due to refactoring that wasn't completed. They can cause confusion when reading code.

                  Rule Details

                  This rule disallows empty block statements. This rule ignores block statements which contain a comment (for example, in an empty catch or finally block of a try statement to indicate that execution should continue regardless of errors).

                  Examples of incorrect code for this rule:

                  /*eslint no-empty: "error"*/
                  
                  if (foo) {
                  }
                  
                  while (foo) {
                  }
                  
                  switch(foo) {
                  }
                  
                  try {
                      doSomething();
                  } catch(ex) {
                  
                  } finally {
                  
                  }

                  Examples of correct code for this rule:

                  /*eslint no-empty: "error"*/
                  
                  if (foo) {
                      // empty
                  }
                  
                  while (foo) {
                      /* empty */
                  }
                  
                  try {
                      doSomething();
                  } catch (ex) {
                      // continue regardless of error
                  }
                  
                  try {
                      doSomething();
                  } finally {
                      /* continue regardless of error */
                  }

                  Options

                  This rule has an object option for exceptions:

                  • "allowEmptyCatch": true allows empty catch clauses (that is, which do not contain a comment)

                  allowEmptyCatch

                  Examples of additional correct code for this rule with the { "allowEmptyCatch": true } option:

                  /* eslint no-empty: ["error", { "allowEmptyCatch": true }] */
                  try {
                      doSomething();
                  } catch (ex) {}
                  
                  try {
                      doSomething();
                  }
                  catch (ex) {}
                  finally {
                      /* continue regardless of error */
                  }

                  When Not To Use It

                  If you intentionally use empty block statements then you can disable this rule.

                  Related Rules

                  Expected '===' and instead saw '=='.
                  Open

                      } else if (display[0] == 'i') {
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Require === and !== (eqeqeq)

                  It is considered good practice to use the type-safe equality operators === and !== instead of their regular counterparts == and !=.

                  The reason for this is that == and != do type coercion which follows the rather obscure Abstract Equality Comparison Algorithm. For instance, the following statements are all considered true:

                  • [] == false
                  • [] == ![]
                  • 3 == "03"

                  If one of those occurs in an innocent-looking statement such as a == b the actual problem is very difficult to spot.

                  Rule Details

                  This rule is aimed at eliminating the type-unsafe equality operators.

                  Examples of incorrect code for this rule:

                  /*eslint eqeqeq: "error"*/
                  
                  if (x == 42) { }
                  
                  if ("" == text) { }
                  
                  if (obj.getStuff() != undefined) { }

                  The --fix option on the command line automatically fixes some problems reported by this rule. A problem is only fixed if one of the operands is a typeof expression, or if both operands are literals with the same type.

                  Options

                  always

                  The "always" option (default) enforces the use of === and !== in every situation (except when you opt-in to more specific handling of null [see below]).

                  Examples of incorrect code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a == b
                  foo == true
                  bananas != 1
                  value == undefined
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  Examples of correct code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a === b
                  foo === true
                  bananas !== 1
                  value === undefined
                  typeof foo === 'undefined'
                  'hello' !== 'world'
                  0 === 0
                  true === true
                  foo === null

                  This rule optionally takes a second argument, which should be an object with the following supported properties:

                  • "null": Customize how this rule treats null literals. Possible values:
                    • always (default) - Always use === or !==.
                    • never - Never use === or !== with null.
                    • ignore - Do not apply this rule to null.

                  smart

                  The "smart" option enforces the use of === and !== except for these cases:

                  • Comparing two literal values
                  • Evaluating the value of typeof
                  • Comparing against null

                  Examples of incorrect code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  // comparing two variables requires ===
                  a == b
                  
                  // only one side is a literal
                  foo == true
                  bananas != 1
                  
                  // comparing to undefined requires ===
                  value == undefined

                  Examples of correct code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  allow-null

                  Deprecated: Instead of using this option use "always" and pass a "null" option property with value "ignore". This will tell eslint to always enforce strict equality except when comparing with the null literal.

                  ["error", "always", {"null": "ignore"}]

                  When Not To Use It

                  If you don't want to enforce a style for using equality operators, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

                  The body of a for-in should be wrapped in an if statement to filter unwanted properties from the prototype.
                  Open

                      for (var f in r2.flags) {
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Require Guarding for-in (guard-for-in)

                  Looping over objects with a for in loop will include properties that are inherited through the prototype chain. This behavior can lead to unexpected items in your for loop.

                  for (key in foo) {
                      doSomething(key);
                  }

                  Note that simply checking foo.hasOwnProperty(key) is likely to cause an error in some cases; see [no-prototype-builtins](no-prototype-builtins.md).

                  Rule Details

                  This rule is aimed at preventing unexpected behavior that could arise from using a for in loop without filtering the results in the loop. As such, it will warn when for in loops do not filter their results with an if statement.

                  Examples of incorrect code for this rule:

                  /*eslint guard-for-in: "error"*/
                  
                  for (key in foo) {
                      doSomething(key);
                  }

                  Examples of correct code for this rule:

                  /*eslint guard-for-in: "error"*/
                  
                  for (key in foo) {
                      if (Object.prototype.hasOwnProperty.call(foo, key)) {
                          doSomething(key);
                      }
                      if ({}.hasOwnProperty.call(foo, key)) {
                          doSomething(key);
                      }
                  }

                  Related Rules

                  • [no-prototype-builtins](no-prototype-builtins.md)

                  Further Reading

                  Expected '===' and instead saw '=='.
                  Open

                          if (display[1] == 's') {
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Require === and !== (eqeqeq)

                  It is considered good practice to use the type-safe equality operators === and !== instead of their regular counterparts == and !=.

                  The reason for this is that == and != do type coercion which follows the rather obscure Abstract Equality Comparison Algorithm. For instance, the following statements are all considered true:

                  • [] == false
                  • [] == ![]
                  • 3 == "03"

                  If one of those occurs in an innocent-looking statement such as a == b the actual problem is very difficult to spot.

                  Rule Details

                  This rule is aimed at eliminating the type-unsafe equality operators.

                  Examples of incorrect code for this rule:

                  /*eslint eqeqeq: "error"*/
                  
                  if (x == 42) { }
                  
                  if ("" == text) { }
                  
                  if (obj.getStuff() != undefined) { }

                  The --fix option on the command line automatically fixes some problems reported by this rule. A problem is only fixed if one of the operands is a typeof expression, or if both operands are literals with the same type.

                  Options

                  always

                  The "always" option (default) enforces the use of === and !== in every situation (except when you opt-in to more specific handling of null [see below]).

                  Examples of incorrect code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a == b
                  foo == true
                  bananas != 1
                  value == undefined
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  Examples of correct code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a === b
                  foo === true
                  bananas !== 1
                  value === undefined
                  typeof foo === 'undefined'
                  'hello' !== 'world'
                  0 === 0
                  true === true
                  foo === null

                  This rule optionally takes a second argument, which should be an object with the following supported properties:

                  • "null": Customize how this rule treats null literals. Possible values:
                    • always (default) - Always use === or !==.
                    • never - Never use === or !== with null.
                    • ignore - Do not apply this rule to null.

                  smart

                  The "smart" option enforces the use of === and !== except for these cases:

                  • Comparing two literal values
                  • Evaluating the value of typeof
                  • Comparing against null

                  Examples of incorrect code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  // comparing two variables requires ===
                  a == b
                  
                  // only one side is a literal
                  foo == true
                  bananas != 1
                  
                  // comparing to undefined requires ===
                  value == undefined

                  Examples of correct code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  allow-null

                  Deprecated: Instead of using this option use "always" and pass a "null" option property with value "ignore". This will tell eslint to always enforce strict equality except when comparing with the null literal.

                  ["error", "always", {"null": "ignore"}]

                  When Not To Use It

                  If you don't want to enforce a style for using equality operators, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

                  'row' is already defined.
                  Open

                                  var row = lines[i].replace(/\ +/g, ' ').split(/ /g);
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  disallow variable redeclaration (no-redeclare)

                  In JavaScript, it's possible to redeclare the same variable name using var. This can lead to confusion as to where the variable is actually declared and initialized.

                  Rule Details

                  This rule is aimed at eliminating variables that have multiple declarations in the same scope.

                  Examples of incorrect code for this rule:

                  /*eslint no-redeclare: "error"*/
                  
                  var a = 3;
                  var a = 10;

                  Examples of correct code for this rule:

                  /*eslint no-redeclare: "error"*/
                  
                  var a = 3;
                  // ...
                  a = 10;

                  Options

                  This rule takes one optional argument, an object with a boolean property "builtinGlobals". It defaults to false. If set to true, this rule also checks redeclaration of built-in globals, such as Object, Array, Number...

                  builtinGlobals

                  Examples of incorrect code for the { "builtinGlobals": true } option:

                  /*eslint no-redeclare: ["error", { "builtinGlobals": true }]*/
                  
                  var Object = 0;

                  Examples of incorrect code for the { "builtinGlobals": true } option and the browser environment:

                  /*eslint no-redeclare: ["error", { "builtinGlobals": true }]*/
                  /*eslint-env browser*/
                  
                  var top = 0;

                  The browser environment has many built-in global variables (for example, top). Some of built-in global variables cannot be redeclared. Source: http://eslint.org/docs/rules/

                  Expected return with your callback function.
                  Open

                              cb(null);
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Enforce Return After Callback (callback-return)

                  The callback pattern is at the heart of most I/O and event-driven programming in JavaScript.

                  function doSomething(err, callback) {
                      if (err) {
                          return callback(err);
                      }
                      callback();
                  }

                  To prevent calling the callback multiple times it is important to return anytime the callback is triggered outside of the main function body. Neglecting this technique often leads to issues where you do something more than once. For example, in the case of an HTTP request, you may try to send HTTP headers more than once leading Node.js to throw a Can't render headers after they are sent to the client. error.

                  Rule Details

                  This rule is aimed at ensuring that callbacks used outside of the main function block are always part-of or immediately preceding a return statement. This rule decides what is a callback based on the name of the function being called.

                  Options

                  The rule takes a single option - an array of possible callback names - which may include object methods. The default callback names are callback, cb, next.

                  Default callback names

                  Examples of incorrect code for this rule with the default ["callback", "cb", "next"] option:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          callback(err);
                      }
                      callback();
                  }

                  Examples of correct code for this rule with the default ["callback", "cb", "next"] option:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          return callback(err);
                      }
                      callback();
                  }

                  Supplied callback names

                  Examples of incorrect code for this rule with the option ["done", "send.error", "send.success"]:

                  /*eslint callback-return: ["error", ["done", "send.error", "send.success"]]*/
                  
                  function foo(err, done) {
                      if (err) {
                          done(err);
                      }
                      done();
                  }
                  
                  function bar(err, send) {
                      if (err) {
                          send.error(err);
                      }
                      send.success();
                  }

                  Examples of correct code for this rule with the option ["done", "send.error", "send.success"]:

                  /*eslint callback-return: ["error", ["done", "send.error", "send.success"]]*/
                  
                  function foo(err, done) {
                      if (err) {
                          return done(err);
                      }
                      done();
                  }
                  
                  function bar(err, send) {
                      if (err) {
                          return send.error(err);
                      }
                      send.success();
                  }

                  Known Limitations

                  Because it is difficult to understand the meaning of a program through static analysis, this rule has limitations:

                  • false negatives when this rule reports correct code, but the program calls the callback more than one time (which is incorrect behavior)
                  • false positives when this rule reports incorrect code, but the program calls the callback only one time (which is correct behavior)

                  Passing the callback by reference

                  The static analysis of this rule does not detect that the program calls the callback if it is an argument of a function (for example, setTimeout).

                  Example of a false negative when this rule reports correct code:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          setTimeout(callback, 0); // this is bad, but WILL NOT warn
                      }
                      callback();
                  }

                  Triggering the callback within a nested function

                  The static analysis of this rule does not detect that the program calls the callback from within a nested function or an immediately-invoked function expression (IIFE).

                  Example of a false negative when this rule reports correct code:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          process.nextTick(function() {
                              return callback(); // this is bad, but WILL NOT warn
                          });
                      }
                      callback();
                  }

                  If/else statements

                  The static analysis of this rule does not detect that the program calls the callback only one time in each branch of an if statement.

                  Example of a false positive when this rule reports incorrect code:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          callback(err); // this is fine, but WILL warn
                      } else {
                          callback();    // this is fine, but WILL warn
                      }
                  }

                  When Not To Use It

                  There are some cases where you might want to call a callback function more than once. In those cases this rule may lead to incorrect behavior. In those cases you may want to reserve a special name for those callbacks and not include that in the list of callbacks that trigger warnings.

                  Further Reading

                  Related Rules

                  Expected return with your callback function.
                  Open

                              cb(o);
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Enforce Return After Callback (callback-return)

                  The callback pattern is at the heart of most I/O and event-driven programming in JavaScript.

                  function doSomething(err, callback) {
                      if (err) {
                          return callback(err);
                      }
                      callback();
                  }

                  To prevent calling the callback multiple times it is important to return anytime the callback is triggered outside of the main function body. Neglecting this technique often leads to issues where you do something more than once. For example, in the case of an HTTP request, you may try to send HTTP headers more than once leading Node.js to throw a Can't render headers after they are sent to the client. error.

                  Rule Details

                  This rule is aimed at ensuring that callbacks used outside of the main function block are always part-of or immediately preceding a return statement. This rule decides what is a callback based on the name of the function being called.

                  Options

                  The rule takes a single option - an array of possible callback names - which may include object methods. The default callback names are callback, cb, next.

                  Default callback names

                  Examples of incorrect code for this rule with the default ["callback", "cb", "next"] option:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          callback(err);
                      }
                      callback();
                  }

                  Examples of correct code for this rule with the default ["callback", "cb", "next"] option:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          return callback(err);
                      }
                      callback();
                  }

                  Supplied callback names

                  Examples of incorrect code for this rule with the option ["done", "send.error", "send.success"]:

                  /*eslint callback-return: ["error", ["done", "send.error", "send.success"]]*/
                  
                  function foo(err, done) {
                      if (err) {
                          done(err);
                      }
                      done();
                  }
                  
                  function bar(err, send) {
                      if (err) {
                          send.error(err);
                      }
                      send.success();
                  }

                  Examples of correct code for this rule with the option ["done", "send.error", "send.success"]:

                  /*eslint callback-return: ["error", ["done", "send.error", "send.success"]]*/
                  
                  function foo(err, done) {
                      if (err) {
                          return done(err);
                      }
                      done();
                  }
                  
                  function bar(err, send) {
                      if (err) {
                          return send.error(err);
                      }
                      send.success();
                  }

                  Known Limitations

                  Because it is difficult to understand the meaning of a program through static analysis, this rule has limitations:

                  • false negatives when this rule reports correct code, but the program calls the callback more than one time (which is incorrect behavior)
                  • false positives when this rule reports incorrect code, but the program calls the callback only one time (which is correct behavior)

                  Passing the callback by reference

                  The static analysis of this rule does not detect that the program calls the callback if it is an argument of a function (for example, setTimeout).

                  Example of a false negative when this rule reports correct code:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          setTimeout(callback, 0); // this is bad, but WILL NOT warn
                      }
                      callback();
                  }

                  Triggering the callback within a nested function

                  The static analysis of this rule does not detect that the program calls the callback from within a nested function or an immediately-invoked function expression (IIFE).

                  Example of a false negative when this rule reports correct code:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          process.nextTick(function() {
                              return callback(); // this is bad, but WILL NOT warn
                          });
                      }
                      callback();
                  }

                  If/else statements

                  The static analysis of this rule does not detect that the program calls the callback only one time in each branch of an if statement.

                  Example of a false positive when this rule reports incorrect code:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          callback(err); // this is fine, but WILL warn
                      } else {
                          callback();    // this is fine, but WILL warn
                      }
                  }

                  When Not To Use It

                  There are some cases where you might want to call a callback function more than once. In those cases this rule may lead to incorrect behavior. In those cases you may want to reserve a special name for those callbacks and not include that in the list of callbacks that trigger warnings.

                  Further Reading

                  Related Rules

                  'x' is already defined.
                  Open

                          var x = new XMLHttpRequest();
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  disallow variable redeclaration (no-redeclare)

                  In JavaScript, it's possible to redeclare the same variable name using var. This can lead to confusion as to where the variable is actually declared and initialized.

                  Rule Details

                  This rule is aimed at eliminating variables that have multiple declarations in the same scope.

                  Examples of incorrect code for this rule:

                  /*eslint no-redeclare: "error"*/
                  
                  var a = 3;
                  var a = 10;

                  Examples of correct code for this rule:

                  /*eslint no-redeclare: "error"*/
                  
                  var a = 3;
                  // ...
                  a = 10;

                  Options

                  This rule takes one optional argument, an object with a boolean property "builtinGlobals". It defaults to false. If set to true, this rule also checks redeclaration of built-in globals, such as Object, Array, Number...

                  builtinGlobals

                  Examples of incorrect code for the { "builtinGlobals": true } option:

                  /*eslint no-redeclare: ["error", { "builtinGlobals": true }]*/
                  
                  var Object = 0;

                  Examples of incorrect code for the { "builtinGlobals": true } option and the browser environment:

                  /*eslint no-redeclare: ["error", { "builtinGlobals": true }]*/
                  /*eslint-env browser*/
                  
                  var top = 0;

                  The browser environment has many built-in global variables (for example, top). Some of built-in global variables cannot be redeclared. Source: http://eslint.org/docs/rules/

                  The body of a for-in should be wrapped in an if statement to filter unwanted properties from the prototype.
                  Open

                              for (var f in fs) {
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Require Guarding for-in (guard-for-in)

                  Looping over objects with a for in loop will include properties that are inherited through the prototype chain. This behavior can lead to unexpected items in your for loop.

                  for (key in foo) {
                      doSomething(key);
                  }

                  Note that simply checking foo.hasOwnProperty(key) is likely to cause an error in some cases; see [no-prototype-builtins](no-prototype-builtins.md).

                  Rule Details

                  This rule is aimed at preventing unexpected behavior that could arise from using a for in loop without filtering the results in the loop. As such, it will warn when for in loops do not filter their results with an if statement.

                  Examples of incorrect code for this rule:

                  /*eslint guard-for-in: "error"*/
                  
                  for (key in foo) {
                      doSomething(key);
                  }

                  Examples of correct code for this rule:

                  /*eslint guard-for-in: "error"*/
                  
                  for (key in foo) {
                      if (Object.prototype.hasOwnProperty.call(foo, key)) {
                          doSomething(key);
                      }
                      if ({}.hasOwnProperty.call(foo, key)) {
                          doSomething(key);
                      }
                  }

                  Related Rules

                  • [no-prototype-builtins](no-prototype-builtins.md)

                  Further Reading

                  'z' is already defined.
                  Open

                              var z = '';
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  disallow variable redeclaration (no-redeclare)

                  In JavaScript, it's possible to redeclare the same variable name using var. This can lead to confusion as to where the variable is actually declared and initialized.

                  Rule Details

                  This rule is aimed at eliminating variables that have multiple declarations in the same scope.

                  Examples of incorrect code for this rule:

                  /*eslint no-redeclare: "error"*/
                  
                  var a = 3;
                  var a = 10;

                  Examples of correct code for this rule:

                  /*eslint no-redeclare: "error"*/
                  
                  var a = 3;
                  // ...
                  a = 10;

                  Options

                  This rule takes one optional argument, an object with a boolean property "builtinGlobals". It defaults to false. If set to true, this rule also checks redeclaration of built-in globals, such as Object, Array, Number...

                  builtinGlobals

                  Examples of incorrect code for the { "builtinGlobals": true } option:

                  /*eslint no-redeclare: ["error", { "builtinGlobals": true }]*/
                  
                  var Object = 0;

                  Examples of incorrect code for the { "builtinGlobals": true } option and the browser environment:

                  /*eslint no-redeclare: ["error", { "builtinGlobals": true }]*/
                  /*eslint-env browser*/
                  
                  var top = 0;

                  The browser environment has many built-in global variables (for example, top). Some of built-in global variables cannot be redeclared. Source: http://eslint.org/docs/rules/

                  Expected '===' and instead saw '=='.
                  Open

                                      if (kv[0] == 'addr') {
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Require === and !== (eqeqeq)

                  It is considered good practice to use the type-safe equality operators === and !== instead of their regular counterparts == and !=.

                  The reason for this is that == and != do type coercion which follows the rather obscure Abstract Equality Comparison Algorithm. For instance, the following statements are all considered true:

                  • [] == false
                  • [] == ![]
                  • 3 == "03"

                  If one of those occurs in an innocent-looking statement such as a == b the actual problem is very difficult to spot.

                  Rule Details

                  This rule is aimed at eliminating the type-unsafe equality operators.

                  Examples of incorrect code for this rule:

                  /*eslint eqeqeq: "error"*/
                  
                  if (x == 42) { }
                  
                  if ("" == text) { }
                  
                  if (obj.getStuff() != undefined) { }

                  The --fix option on the command line automatically fixes some problems reported by this rule. A problem is only fixed if one of the operands is a typeof expression, or if both operands are literals with the same type.

                  Options

                  always

                  The "always" option (default) enforces the use of === and !== in every situation (except when you opt-in to more specific handling of null [see below]).

                  Examples of incorrect code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a == b
                  foo == true
                  bananas != 1
                  value == undefined
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  Examples of correct code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a === b
                  foo === true
                  bananas !== 1
                  value === undefined
                  typeof foo === 'undefined'
                  'hello' !== 'world'
                  0 === 0
                  true === true
                  foo === null

                  This rule optionally takes a second argument, which should be an object with the following supported properties:

                  • "null": Customize how this rule treats null literals. Possible values:
                    • always (default) - Always use === or !==.
                    • never - Never use === or !== with null.
                    • ignore - Do not apply this rule to null.

                  smart

                  The "smart" option enforces the use of === and !== except for these cases:

                  • Comparing two literal values
                  • Evaluating the value of typeof
                  • Comparing against null

                  Examples of incorrect code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  // comparing two variables requires ===
                  a == b
                  
                  // only one side is a literal
                  foo == true
                  bananas != 1
                  
                  // comparing to undefined requires ===
                  value == undefined

                  Examples of correct code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  allow-null

                  Deprecated: Instead of using this option use "always" and pass a "null" option property with value "ignore". This will tell eslint to always enforce strict equality except when comparing with the null literal.

                  ["error", "always", {"null": "ignore"}]

                  When Not To Use It

                  If you don't want to enforce a style for using equality operators, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

                  Expected '!==' and instead saw '!='.
                  Open

                          if (typeof (r2plugin) != 'undefined') {
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Require === and !== (eqeqeq)

                  It is considered good practice to use the type-safe equality operators === and !== instead of their regular counterparts == and !=.

                  The reason for this is that == and != do type coercion which follows the rather obscure Abstract Equality Comparison Algorithm. For instance, the following statements are all considered true:

                  • [] == false
                  • [] == ![]
                  • 3 == "03"

                  If one of those occurs in an innocent-looking statement such as a == b the actual problem is very difficult to spot.

                  Rule Details

                  This rule is aimed at eliminating the type-unsafe equality operators.

                  Examples of incorrect code for this rule:

                  /*eslint eqeqeq: "error"*/
                  
                  if (x == 42) { }
                  
                  if ("" == text) { }
                  
                  if (obj.getStuff() != undefined) { }

                  The --fix option on the command line automatically fixes some problems reported by this rule. A problem is only fixed if one of the operands is a typeof expression, or if both operands are literals with the same type.

                  Options

                  always

                  The "always" option (default) enforces the use of === and !== in every situation (except when you opt-in to more specific handling of null [see below]).

                  Examples of incorrect code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a == b
                  foo == true
                  bananas != 1
                  value == undefined
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  Examples of correct code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a === b
                  foo === true
                  bananas !== 1
                  value === undefined
                  typeof foo === 'undefined'
                  'hello' !== 'world'
                  0 === 0
                  true === true
                  foo === null

                  This rule optionally takes a second argument, which should be an object with the following supported properties:

                  • "null": Customize how this rule treats null literals. Possible values:
                    • always (default) - Always use === or !==.
                    • never - Never use === or !== with null.
                    • ignore - Do not apply this rule to null.

                  smart

                  The "smart" option enforces the use of === and !== except for these cases:

                  • Comparing two literal values
                  • Evaluating the value of typeof
                  • Comparing against null

                  Examples of incorrect code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  // comparing two variables requires ===
                  a == b
                  
                  // only one side is a literal
                  foo == true
                  bananas != 1
                  
                  // comparing to undefined requires ===
                  value == undefined

                  Examples of correct code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  allow-null

                  Deprecated: Instead of using this option use "always" and pass a "null" option property with value "ignore". This will tell eslint to always enforce strict equality except when comparing with the null literal.

                  ["error", "always", {"null": "ignore"}]

                  When Not To Use It

                  If you don't want to enforce a style for using equality operators, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

                  Expected return with your callback function.
                  Open

                                  cb();
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Enforce Return After Callback (callback-return)

                  The callback pattern is at the heart of most I/O and event-driven programming in JavaScript.

                  function doSomething(err, callback) {
                      if (err) {
                          return callback(err);
                      }
                      callback();
                  }

                  To prevent calling the callback multiple times it is important to return anytime the callback is triggered outside of the main function body. Neglecting this technique often leads to issues where you do something more than once. For example, in the case of an HTTP request, you may try to send HTTP headers more than once leading Node.js to throw a Can't render headers after they are sent to the client. error.

                  Rule Details

                  This rule is aimed at ensuring that callbacks used outside of the main function block are always part-of or immediately preceding a return statement. This rule decides what is a callback based on the name of the function being called.

                  Options

                  The rule takes a single option - an array of possible callback names - which may include object methods. The default callback names are callback, cb, next.

                  Default callback names

                  Examples of incorrect code for this rule with the default ["callback", "cb", "next"] option:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          callback(err);
                      }
                      callback();
                  }

                  Examples of correct code for this rule with the default ["callback", "cb", "next"] option:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          return callback(err);
                      }
                      callback();
                  }

                  Supplied callback names

                  Examples of incorrect code for this rule with the option ["done", "send.error", "send.success"]:

                  /*eslint callback-return: ["error", ["done", "send.error", "send.success"]]*/
                  
                  function foo(err, done) {
                      if (err) {
                          done(err);
                      }
                      done();
                  }
                  
                  function bar(err, send) {
                      if (err) {
                          send.error(err);
                      }
                      send.success();
                  }

                  Examples of correct code for this rule with the option ["done", "send.error", "send.success"]:

                  /*eslint callback-return: ["error", ["done", "send.error", "send.success"]]*/
                  
                  function foo(err, done) {
                      if (err) {
                          return done(err);
                      }
                      done();
                  }
                  
                  function bar(err, send) {
                      if (err) {
                          return send.error(err);
                      }
                      send.success();
                  }

                  Known Limitations

                  Because it is difficult to understand the meaning of a program through static analysis, this rule has limitations:

                  • false negatives when this rule reports correct code, but the program calls the callback more than one time (which is incorrect behavior)
                  • false positives when this rule reports incorrect code, but the program calls the callback only one time (which is correct behavior)

                  Passing the callback by reference

                  The static analysis of this rule does not detect that the program calls the callback if it is an argument of a function (for example, setTimeout).

                  Example of a false negative when this rule reports correct code:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          setTimeout(callback, 0); // this is bad, but WILL NOT warn
                      }
                      callback();
                  }

                  Triggering the callback within a nested function

                  The static analysis of this rule does not detect that the program calls the callback from within a nested function or an immediately-invoked function expression (IIFE).

                  Example of a false negative when this rule reports correct code:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          process.nextTick(function() {
                              return callback(); // this is bad, but WILL NOT warn
                          });
                      }
                      callback();
                  }

                  If/else statements

                  The static analysis of this rule does not detect that the program calls the callback only one time in each branch of an if statement.

                  Example of a false positive when this rule reports incorrect code:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          callback(err); // this is fine, but WILL warn
                      } else {
                          callback();    // this is fine, but WILL warn
                      }
                  }

                  When Not To Use It

                  There are some cases where you might want to call a callback function more than once. In those cases this rule may lead to incorrect behavior. In those cases you may want to reserve a special name for those callbacks and not include that in the list of callbacks that trigger warnings.

                  Further Reading

                  Related Rules

                  Unnecessary semicolon.
                  Open

                      ;
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  disallow unnecessary semicolons (no-extra-semi)

                  Typing mistakes and misunderstandings about where semicolons are required can lead to semicolons that are unnecessary. While not technically an error, extra semicolons can cause confusion when reading code.

                  Rule Details

                  This rule disallows unnecessary semicolons.

                  Examples of incorrect code for this rule:

                  /*eslint no-extra-semi: "error"*/
                  
                  var x = 5;;
                  
                  function foo() {
                      // code
                  };

                  Examples of correct code for this rule:

                  /*eslint no-extra-semi: "error"*/
                  
                  var x = 5;
                  
                  var foo = function() {
                      // code
                  };

                  When Not To Use It

                  If you intentionally use extra semicolons then you can disable this rule.

                  Related Rules

                  Expected '===' and instead saw '=='.
                  Open

                      if (display == 'afl') {
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Require === and !== (eqeqeq)

                  It is considered good practice to use the type-safe equality operators === and !== instead of their regular counterparts == and !=.

                  The reason for this is that == and != do type coercion which follows the rather obscure Abstract Equality Comparison Algorithm. For instance, the following statements are all considered true:

                  • [] == false
                  • [] == ![]
                  • 3 == "03"

                  If one of those occurs in an innocent-looking statement such as a == b the actual problem is very difficult to spot.

                  Rule Details

                  This rule is aimed at eliminating the type-unsafe equality operators.

                  Examples of incorrect code for this rule:

                  /*eslint eqeqeq: "error"*/
                  
                  if (x == 42) { }
                  
                  if ("" == text) { }
                  
                  if (obj.getStuff() != undefined) { }

                  The --fix option on the command line automatically fixes some problems reported by this rule. A problem is only fixed if one of the operands is a typeof expression, or if both operands are literals with the same type.

                  Options

                  always

                  The "always" option (default) enforces the use of === and !== in every situation (except when you opt-in to more specific handling of null [see below]).

                  Examples of incorrect code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a == b
                  foo == true
                  bananas != 1
                  value == undefined
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  Examples of correct code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a === b
                  foo === true
                  bananas !== 1
                  value === undefined
                  typeof foo === 'undefined'
                  'hello' !== 'world'
                  0 === 0
                  true === true
                  foo === null

                  This rule optionally takes a second argument, which should be an object with the following supported properties:

                  • "null": Customize how this rule treats null literals. Possible values:
                    • always (default) - Always use === or !==.
                    • never - Never use === or !== with null.
                    • ignore - Do not apply this rule to null.

                  smart

                  The "smart" option enforces the use of === and !== except for these cases:

                  • Comparing two literal values
                  • Evaluating the value of typeof
                  • Comparing against null

                  Examples of incorrect code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  // comparing two variables requires ===
                  a == b
                  
                  // only one side is a literal
                  foo == true
                  bananas != 1
                  
                  // comparing to undefined requires ===
                  value == undefined

                  Examples of correct code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  allow-null

                  Deprecated: Instead of using this option use "always" and pass a "null" option property with value "ignore". This will tell eslint to always enforce strict equality except when comparing with the null literal.

                  ["error", "always", {"null": "ignore"}]

                  When Not To Use It

                  If you don't want to enforce a style for using equality operators, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

                  A regular expression literal can be confused with '/='.
                  Open

                                      var kv = elems[j].split(/=/);
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Disallow Regexs That Look Like Division (no-div-regex)

                  Require regex literals to escape division operators.

                  function bar() { return /=foo/; }

                  Rule Details

                  This is used to disambiguate the division operator to not confuse users.

                  Examples of incorrect code for this rule:

                  /*eslint no-div-regex: "error"*/
                  
                  function bar() { return /=foo/; }

                  Examples of correct code for this rule:

                  /*eslint no-div-regex: "error"*/
                  
                  function bar() { return /\=foo/; }

                  Related Rules

                  'x' is already defined.
                  Open

                          var x = new XMLHttpRequest({mozSystem: true});
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  disallow variable redeclaration (no-redeclare)

                  In JavaScript, it's possible to redeclare the same variable name using var. This can lead to confusion as to where the variable is actually declared and initialized.

                  Rule Details

                  This rule is aimed at eliminating variables that have multiple declarations in the same scope.

                  Examples of incorrect code for this rule:

                  /*eslint no-redeclare: "error"*/
                  
                  var a = 3;
                  var a = 10;

                  Examples of correct code for this rule:

                  /*eslint no-redeclare: "error"*/
                  
                  var a = 3;
                  // ...
                  a = 10;

                  Options

                  This rule takes one optional argument, an object with a boolean property "builtinGlobals". It defaults to false. If set to true, this rule also checks redeclaration of built-in globals, such as Object, Array, Number...

                  builtinGlobals

                  Examples of incorrect code for the { "builtinGlobals": true } option:

                  /*eslint no-redeclare: ["error", { "builtinGlobals": true }]*/
                  
                  var Object = 0;

                  Examples of incorrect code for the { "builtinGlobals": true } option and the browser environment:

                  /*eslint no-redeclare: ["error", { "builtinGlobals": true }]*/
                  /*eslint-env browser*/
                  
                  var top = 0;

                  The browser environment has many built-in global variables (for example, top). Some of built-in global variables cannot be redeclared. Source: http://eslint.org/docs/rules/

                  Expected '===' and instead saw '=='.
                  Open

                      if (r2.asyncMode == 'sync') {
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Require === and !== (eqeqeq)

                  It is considered good practice to use the type-safe equality operators === and !== instead of their regular counterparts == and !=.

                  The reason for this is that == and != do type coercion which follows the rather obscure Abstract Equality Comparison Algorithm. For instance, the following statements are all considered true:

                  • [] == false
                  • [] == ![]
                  • 3 == "03"

                  If one of those occurs in an innocent-looking statement such as a == b the actual problem is very difficult to spot.

                  Rule Details

                  This rule is aimed at eliminating the type-unsafe equality operators.

                  Examples of incorrect code for this rule:

                  /*eslint eqeqeq: "error"*/
                  
                  if (x == 42) { }
                  
                  if ("" == text) { }
                  
                  if (obj.getStuff() != undefined) { }

                  The --fix option on the command line automatically fixes some problems reported by this rule. A problem is only fixed if one of the operands is a typeof expression, or if both operands are literals with the same type.

                  Options

                  always

                  The "always" option (default) enforces the use of === and !== in every situation (except when you opt-in to more specific handling of null [see below]).

                  Examples of incorrect code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a == b
                  foo == true
                  bananas != 1
                  value == undefined
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  Examples of correct code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a === b
                  foo === true
                  bananas !== 1
                  value === undefined
                  typeof foo === 'undefined'
                  'hello' !== 'world'
                  0 === 0
                  true === true
                  foo === null

                  This rule optionally takes a second argument, which should be an object with the following supported properties:

                  • "null": Customize how this rule treats null literals. Possible values:
                    • always (default) - Always use === or !==.
                    • never - Never use === or !== with null.
                    • ignore - Do not apply this rule to null.

                  smart

                  The "smart" option enforces the use of === and !== except for these cases:

                  • Comparing two literal values
                  • Evaluating the value of typeof
                  • Comparing against null

                  Examples of incorrect code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  // comparing two variables requires ===
                  a == b
                  
                  // only one side is a literal
                  foo == true
                  bananas != 1
                  
                  // comparing to undefined requires ===
                  value == undefined

                  Examples of correct code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  allow-null

                  Deprecated: Instead of using this option use "always" and pass a "null" option property with value "ignore". This will tell eslint to always enforce strict equality except when comparing with the null literal.

                  ["error", "always", {"null": "ignore"}]

                  When Not To Use It

                  If you don't want to enforce a style for using equality operators, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

                  Expected '===' and instead saw '=='.
                  Open

                      if (typeof v == 'function' || !v) { // get
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Require === and !== (eqeqeq)

                  It is considered good practice to use the type-safe equality operators === and !== instead of their regular counterparts == and !=.

                  The reason for this is that == and != do type coercion which follows the rather obscure Abstract Equality Comparison Algorithm. For instance, the following statements are all considered true:

                  • [] == false
                  • [] == ![]
                  • 3 == "03"

                  If one of those occurs in an innocent-looking statement such as a == b the actual problem is very difficult to spot.

                  Rule Details

                  This rule is aimed at eliminating the type-unsafe equality operators.

                  Examples of incorrect code for this rule:

                  /*eslint eqeqeq: "error"*/
                  
                  if (x == 42) { }
                  
                  if ("" == text) { }
                  
                  if (obj.getStuff() != undefined) { }

                  The --fix option on the command line automatically fixes some problems reported by this rule. A problem is only fixed if one of the operands is a typeof expression, or if both operands are literals with the same type.

                  Options

                  always

                  The "always" option (default) enforces the use of === and !== in every situation (except when you opt-in to more specific handling of null [see below]).

                  Examples of incorrect code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a == b
                  foo == true
                  bananas != 1
                  value == undefined
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  Examples of correct code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a === b
                  foo === true
                  bananas !== 1
                  value === undefined
                  typeof foo === 'undefined'
                  'hello' !== 'world'
                  0 === 0
                  true === true
                  foo === null

                  This rule optionally takes a second argument, which should be an object with the following supported properties:

                  • "null": Customize how this rule treats null literals. Possible values:
                    • always (default) - Always use === or !==.
                    • never - Never use === or !== with null.
                    • ignore - Do not apply this rule to null.

                  smart

                  The "smart" option enforces the use of === and !== except for these cases:

                  • Comparing two literal values
                  • Evaluating the value of typeof
                  • Comparing against null

                  Examples of incorrect code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  // comparing two variables requires ===
                  a == b
                  
                  // only one side is a literal
                  foo == true
                  bananas != 1
                  
                  // comparing to undefined requires ===
                  value == undefined

                  Examples of correct code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  allow-null

                  Deprecated: Instead of using this option use "always" and pass a "null" option property with value "ignore". This will tell eslint to always enforce strict equality except when comparing with the null literal.

                  ["error", "always", {"null": "ignore"}]

                  When Not To Use It

                  If you don't want to enforce a style for using equality operators, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

                  Expected '===' and instead saw '=='.
                  Open

                              if (fields.length == 3) {
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Require === and !== (eqeqeq)

                  It is considered good practice to use the type-safe equality operators === and !== instead of their regular counterparts == and !=.

                  The reason for this is that == and != do type coercion which follows the rather obscure Abstract Equality Comparison Algorithm. For instance, the following statements are all considered true:

                  • [] == false
                  • [] == ![]
                  • 3 == "03"

                  If one of those occurs in an innocent-looking statement such as a == b the actual problem is very difficult to spot.

                  Rule Details

                  This rule is aimed at eliminating the type-unsafe equality operators.

                  Examples of incorrect code for this rule:

                  /*eslint eqeqeq: "error"*/
                  
                  if (x == 42) { }
                  
                  if ("" == text) { }
                  
                  if (obj.getStuff() != undefined) { }

                  The --fix option on the command line automatically fixes some problems reported by this rule. A problem is only fixed if one of the operands is a typeof expression, or if both operands are literals with the same type.

                  Options

                  always

                  The "always" option (default) enforces the use of === and !== in every situation (except when you opt-in to more specific handling of null [see below]).

                  Examples of incorrect code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a == b
                  foo == true
                  bananas != 1
                  value == undefined
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  Examples of correct code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a === b
                  foo === true
                  bananas !== 1
                  value === undefined
                  typeof foo === 'undefined'
                  'hello' !== 'world'
                  0 === 0
                  true === true
                  foo === null

                  This rule optionally takes a second argument, which should be an object with the following supported properties:

                  • "null": Customize how this rule treats null literals. Possible values:
                    • always (default) - Always use === or !==.
                    • never - Never use === or !== with null.
                    • ignore - Do not apply this rule to null.

                  smart

                  The "smart" option enforces the use of === and !== except for these cases:

                  • Comparing two literal values
                  • Evaluating the value of typeof
                  • Comparing against null

                  Examples of incorrect code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  // comparing two variables requires ===
                  a == b
                  
                  // only one side is a literal
                  foo == true
                  bananas != 1
                  
                  // comparing to undefined requires ===
                  value == undefined

                  Examples of correct code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  allow-null

                  Deprecated: Instead of using this option use "always" and pass a "null" option property with value "ignore". This will tell eslint to always enforce strict equality except when comparing with the null literal.

                  ["error", "always", {"null": "ignore"}]

                  When Not To Use It

                  If you don't want to enforce a style for using equality operators, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

                  The body of a for-in should be wrapped in an if statement to filter unwanted properties from the prototype.
                  Open

                      for (var prop in r2.asm_config) {
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Require Guarding for-in (guard-for-in)

                  Looping over objects with a for in loop will include properties that are inherited through the prototype chain. This behavior can lead to unexpected items in your for loop.

                  for (key in foo) {
                      doSomething(key);
                  }

                  Note that simply checking foo.hasOwnProperty(key) is likely to cause an error in some cases; see [no-prototype-builtins](no-prototype-builtins.md).

                  Rule Details

                  This rule is aimed at preventing unexpected behavior that could arise from using a for in loop without filtering the results in the loop. As such, it will warn when for in loops do not filter their results with an if statement.

                  Examples of incorrect code for this rule:

                  /*eslint guard-for-in: "error"*/
                  
                  for (key in foo) {
                      doSomething(key);
                  }

                  Examples of correct code for this rule:

                  /*eslint guard-for-in: "error"*/
                  
                  for (key in foo) {
                      if (Object.prototype.hasOwnProperty.call(foo, key)) {
                          doSomething(key);
                      }
                      if ({}.hasOwnProperty.call(foo, key)) {
                          doSomething(key);
                      }
                  }

                  Related Rules

                  • [no-prototype-builtins](no-prototype-builtins.md)

                  Further Reading

                  Expected '!==' and instead saw '!='.
                  Open

                      if (typeof (r2cmd) != 'undefined') {
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Require === and !== (eqeqeq)

                  It is considered good practice to use the type-safe equality operators === and !== instead of their regular counterparts == and !=.

                  The reason for this is that == and != do type coercion which follows the rather obscure Abstract Equality Comparison Algorithm. For instance, the following statements are all considered true:

                  • [] == false
                  • [] == ![]
                  • 3 == "03"

                  If one of those occurs in an innocent-looking statement such as a == b the actual problem is very difficult to spot.

                  Rule Details

                  This rule is aimed at eliminating the type-unsafe equality operators.

                  Examples of incorrect code for this rule:

                  /*eslint eqeqeq: "error"*/
                  
                  if (x == 42) { }
                  
                  if ("" == text) { }
                  
                  if (obj.getStuff() != undefined) { }

                  The --fix option on the command line automatically fixes some problems reported by this rule. A problem is only fixed if one of the operands is a typeof expression, or if both operands are literals with the same type.

                  Options

                  always

                  The "always" option (default) enforces the use of === and !== in every situation (except when you opt-in to more specific handling of null [see below]).

                  Examples of incorrect code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a == b
                  foo == true
                  bananas != 1
                  value == undefined
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  Examples of correct code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a === b
                  foo === true
                  bananas !== 1
                  value === undefined
                  typeof foo === 'undefined'
                  'hello' !== 'world'
                  0 === 0
                  true === true
                  foo === null

                  This rule optionally takes a second argument, which should be an object with the following supported properties:

                  • "null": Customize how this rule treats null literals. Possible values:
                    • always (default) - Always use === or !==.
                    • never - Never use === or !== with null.
                    • ignore - Do not apply this rule to null.

                  smart

                  The "smart" option enforces the use of === and !== except for these cases:

                  • Comparing two literal values
                  • Evaluating the value of typeof
                  • Comparing against null

                  Examples of incorrect code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  // comparing two variables requires ===
                  a == b
                  
                  // only one side is a literal
                  foo == true
                  bananas != 1
                  
                  // comparing to undefined requires ===
                  value == undefined

                  Examples of correct code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  allow-null

                  Deprecated: Instead of using this option use "always" and pass a "null" option property with value "ignore". This will tell eslint to always enforce strict equality except when comparing with the null literal.

                  ["error", "always", {"null": "ignore"}]

                  When Not To Use It

                  If you don't want to enforce a style for using equality operators, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

                  Expected '===' and instead saw '=='.
                  Open

                          if (x[0] == 'p' && x[1] == 'd') return true;
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Require === and !== (eqeqeq)

                  It is considered good practice to use the type-safe equality operators === and !== instead of their regular counterparts == and !=.

                  The reason for this is that == and != do type coercion which follows the rather obscure Abstract Equality Comparison Algorithm. For instance, the following statements are all considered true:

                  • [] == false
                  • [] == ![]
                  • 3 == "03"

                  If one of those occurs in an innocent-looking statement such as a == b the actual problem is very difficult to spot.

                  Rule Details

                  This rule is aimed at eliminating the type-unsafe equality operators.

                  Examples of incorrect code for this rule:

                  /*eslint eqeqeq: "error"*/
                  
                  if (x == 42) { }
                  
                  if ("" == text) { }
                  
                  if (obj.getStuff() != undefined) { }

                  The --fix option on the command line automatically fixes some problems reported by this rule. A problem is only fixed if one of the operands is a typeof expression, or if both operands are literals with the same type.

                  Options

                  always

                  The "always" option (default) enforces the use of === and !== in every situation (except when you opt-in to more specific handling of null [see below]).

                  Examples of incorrect code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a == b
                  foo == true
                  bananas != 1
                  value == undefined
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  Examples of correct code for the "always" option:

                  /*eslint eqeqeq: ["error", "always"]*/
                  
                  a === b
                  foo === true
                  bananas !== 1
                  value === undefined
                  typeof foo === 'undefined'
                  'hello' !== 'world'
                  0 === 0
                  true === true
                  foo === null

                  This rule optionally takes a second argument, which should be an object with the following supported properties:

                  • "null": Customize how this rule treats null literals. Possible values:
                    • always (default) - Always use === or !==.
                    • never - Never use === or !== with null.
                    • ignore - Do not apply this rule to null.

                  smart

                  The "smart" option enforces the use of === and !== except for these cases:

                  • Comparing two literal values
                  • Evaluating the value of typeof
                  • Comparing against null

                  Examples of incorrect code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  // comparing two variables requires ===
                  a == b
                  
                  // only one side is a literal
                  foo == true
                  bananas != 1
                  
                  // comparing to undefined requires ===
                  value == undefined

                  Examples of correct code for the "smart" option:

                  /*eslint eqeqeq: ["error", "smart"]*/
                  
                  typeof foo == 'undefined'
                  'hello' != 'world'
                  0 == 0
                  true == true
                  foo == null

                  allow-null

                  Deprecated: Instead of using this option use "always" and pass a "null" option property with value "ignore". This will tell eslint to always enforce strict equality except when comparing with the null literal.

                  ["error", "always", {"null": "ignore"}]

                  When Not To Use It

                  If you don't want to enforce a style for using equality operators, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

                  The body of a for-in should be wrapped in an if statement to filter unwanted properties from the prototype.
                  Open

                      for (var i in r2.flags[offset]) {
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Require Guarding for-in (guard-for-in)

                  Looping over objects with a for in loop will include properties that are inherited through the prototype chain. This behavior can lead to unexpected items in your for loop.

                  for (key in foo) {
                      doSomething(key);
                  }

                  Note that simply checking foo.hasOwnProperty(key) is likely to cause an error in some cases; see [no-prototype-builtins](no-prototype-builtins.md).

                  Rule Details

                  This rule is aimed at preventing unexpected behavior that could arise from using a for in loop without filtering the results in the loop. As such, it will warn when for in loops do not filter their results with an if statement.

                  Examples of incorrect code for this rule:

                  /*eslint guard-for-in: "error"*/
                  
                  for (key in foo) {
                      doSomething(key);
                  }

                  Examples of correct code for this rule:

                  /*eslint guard-for-in: "error"*/
                  
                  for (key in foo) {
                      if (Object.prototype.hasOwnProperty.call(foo, key)) {
                          doSomething(key);
                      }
                      if ({}.hasOwnProperty.call(foo, key)) {
                          doSomething(key);
                      }
                  }

                  Related Rules

                  • [no-prototype-builtins](no-prototype-builtins.md)

                  Further Reading

                  Expected return with your callback function.
                  Open

                                  cb(JSON.parse(ret));
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  Enforce Return After Callback (callback-return)

                  The callback pattern is at the heart of most I/O and event-driven programming in JavaScript.

                  function doSomething(err, callback) {
                      if (err) {
                          return callback(err);
                      }
                      callback();
                  }

                  To prevent calling the callback multiple times it is important to return anytime the callback is triggered outside of the main function body. Neglecting this technique often leads to issues where you do something more than once. For example, in the case of an HTTP request, you may try to send HTTP headers more than once leading Node.js to throw a Can't render headers after they are sent to the client. error.

                  Rule Details

                  This rule is aimed at ensuring that callbacks used outside of the main function block are always part-of or immediately preceding a return statement. This rule decides what is a callback based on the name of the function being called.

                  Options

                  The rule takes a single option - an array of possible callback names - which may include object methods. The default callback names are callback, cb, next.

                  Default callback names

                  Examples of incorrect code for this rule with the default ["callback", "cb", "next"] option:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          callback(err);
                      }
                      callback();
                  }

                  Examples of correct code for this rule with the default ["callback", "cb", "next"] option:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          return callback(err);
                      }
                      callback();
                  }

                  Supplied callback names

                  Examples of incorrect code for this rule with the option ["done", "send.error", "send.success"]:

                  /*eslint callback-return: ["error", ["done", "send.error", "send.success"]]*/
                  
                  function foo(err, done) {
                      if (err) {
                          done(err);
                      }
                      done();
                  }
                  
                  function bar(err, send) {
                      if (err) {
                          send.error(err);
                      }
                      send.success();
                  }

                  Examples of correct code for this rule with the option ["done", "send.error", "send.success"]:

                  /*eslint callback-return: ["error", ["done", "send.error", "send.success"]]*/
                  
                  function foo(err, done) {
                      if (err) {
                          return done(err);
                      }
                      done();
                  }
                  
                  function bar(err, send) {
                      if (err) {
                          return send.error(err);
                      }
                      send.success();
                  }

                  Known Limitations

                  Because it is difficult to understand the meaning of a program through static analysis, this rule has limitations:

                  • false negatives when this rule reports correct code, but the program calls the callback more than one time (which is incorrect behavior)
                  • false positives when this rule reports incorrect code, but the program calls the callback only one time (which is correct behavior)

                  Passing the callback by reference

                  The static analysis of this rule does not detect that the program calls the callback if it is an argument of a function (for example, setTimeout).

                  Example of a false negative when this rule reports correct code:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          setTimeout(callback, 0); // this is bad, but WILL NOT warn
                      }
                      callback();
                  }

                  Triggering the callback within a nested function

                  The static analysis of this rule does not detect that the program calls the callback from within a nested function or an immediately-invoked function expression (IIFE).

                  Example of a false negative when this rule reports correct code:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          process.nextTick(function() {
                              return callback(); // this is bad, but WILL NOT warn
                          });
                      }
                      callback();
                  }

                  If/else statements

                  The static analysis of this rule does not detect that the program calls the callback only one time in each branch of an if statement.

                  Example of a false positive when this rule reports incorrect code:

                  /*eslint callback-return: "error"*/
                  
                  function foo(err, callback) {
                      if (err) {
                          callback(err); // this is fine, but WILL warn
                      } else {
                          callback();    // this is fine, but WILL warn
                      }
                  }

                  When Not To Use It

                  There are some cases where you might want to call a callback function more than once. In those cases this rule may lead to incorrect behavior. In those cases you may want to reserve a special name for those callbacks and not include that in the list of callbacks that trigger warnings.

                  Further Reading

                  Related Rules

                  'i' is already defined.
                  Open

                          for (var i = 0; i < lines.length; i++) {
                  Severity: Minor
                  Found in www/lib/r2.js by eslint

                  disallow variable redeclaration (no-redeclare)

                  In JavaScript, it's possible to redeclare the same variable name using var. This can lead to confusion as to where the variable is actually declared and initialized.

                  Rule Details

                  This rule is aimed at eliminating variables that have multiple declarations in the same scope.

                  Examples of incorrect code for this rule:

                  /*eslint no-redeclare: "error"*/
                  
                  var a = 3;
                  var a = 10;

                  Examples of correct code for this rule:

                  /*eslint no-redeclare: "error"*/
                  
                  var a = 3;
                  // ...
                  a = 10;

                  Options

                  This rule takes one optional argument, an object with a boolean property "builtinGlobals". It defaults to false. If set to true, this rule also checks redeclaration of built-in globals, such as Object, Array, Number...

                  builtinGlobals

                  Examples of incorrect code for the { "builtinGlobals": true } option:

                  /*eslint no-redeclare: ["error", { "builtinGlobals": true }]*/
                  
                  var Object = 0;

                  Examples of incorrect code for the { "builtinGlobals": true } option and the browser environment:

                  /*eslint no-redeclare: ["error", { "builtinGlobals": true }]*/
                  /*eslint-env browser*/
                  
                  var top = 0;

                  The browser environment has many built-in global variables (for example, top). Some of built-in global variables cannot be redeclared. Source: http://eslint.org/docs/rules/

                  TODO found
                  Open

                      // TODO: honor offset and length
                  Severity: Minor
                  Found in www/lib/r2.js by fixme

                  TODO found
                  Open

                          // TODO: use setTimeout for async?
                  Severity: Minor
                  Found in www/lib/r2.js by fixme

                  TODO found
                  Open

                                  // TODO: Dont know why byt e~asm. is not working so filtering here
                  Severity: Minor
                  Found in www/lib/r2.js by fixme

                  XXX found
                  Open

                          // XXX: fix l-N
                  Severity: Minor
                  Found in www/lib/r2.js by fixme

                  TODO found
                  Open

                  // TODO: avoid globals
                  Severity: Minor
                  Found in www/lib/r2.js by fixme

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                  r2.get_disasm_before = function(offset, start, cb) {
                      var before = [];
                      r2.cmd('pdj -' + start + '@' + offset + '|', function(x) {
                          before = JSON.parse(x);
                      });
                  Severity: Major
                  Found in www/lib/r2.js and 1 other location - About 2 hrs to fix
                  www/lib/r2.js on lines 229..235

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 83.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                  r2.get_disasm_after = function(offset, end, cb) {
                      var after = [];
                      r2.cmd('pdj ' + end + '@' + offset + '|', function(x) {
                          after = JSON.parse(x);
                      });
                  Severity: Major
                  Found in www/lib/r2.js and 1 other location - About 2 hrs to fix
                  www/lib/r2.js on lines 221..227

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 83.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                  r2.get_opcodes = function(off, n, cb) {
                      r2.cmd('pdj @' + off + '!' + n + '|', function(json) {
                          cb(JSON.parse(json));
                      });
                  };
                  Severity: Major
                  Found in www/lib/r2.js and 1 other location - About 1 hr to fix
                  www/lib/r2.js on lines 355..359

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 68.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                  r2.get_bytes = function(off, n, cb) {
                      r2.cmd('pcj @' + off + '!' + n +'|', function(json) {
                          cb(JSON.parse(json));
                      });
                  };
                  Severity: Major
                  Found in www/lib/r2.js and 1 other location - About 1 hr to fix
                  www/lib/r2.js on lines 349..353

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 68.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 5 locations. Consider refactoring.
                  Open

                  r2.get_info = function(cb) {
                      r2.cmd('ij|', function(json) {
                          cb(JSON.parse(json));
                      });
                  };
                  Severity: Major
                  Found in www/lib/r2.js and 4 other locations - About 45 mins to fix
                  www/lib/r2.js on lines 391..395
                  www/lib/r2.js on lines 396..400
                  www/lib/r2.js on lines 402..406
                  www/lib/r2.js on lines 408..412

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 50.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 5 locations. Consider refactoring.
                  Open

                  r2.bin_imports = function(cb) {
                      r2.cmd('iij|', function(json) {
                          cb(JSON.parse(json));
                      });
                  };
                  Severity: Major
                  Found in www/lib/r2.js and 4 other locations - About 45 mins to fix
                  www/lib/r2.js on lines 386..390
                  www/lib/r2.js on lines 391..395
                  www/lib/r2.js on lines 402..406
                  www/lib/r2.js on lines 408..412

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 50.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 5 locations. Consider refactoring.
                  Open

                  r2.bin_symbols = function(cb) {
                      r2.cmd('isj|', function(json) {
                          cb(JSON.parse(json));
                      });
                  };
                  Severity: Major
                  Found in www/lib/r2.js and 4 other locations - About 45 mins to fix
                  www/lib/r2.js on lines 386..390
                  www/lib/r2.js on lines 391..395
                  www/lib/r2.js on lines 396..400
                  www/lib/r2.js on lines 408..412

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 50.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 5 locations. Consider refactoring.
                  Open

                  r2.bin_sections = function(cb) {
                      r2.cmd('iSj|', function(json) {
                          cb(JSON.parse(json));
                      });
                  };
                  Severity: Major
                  Found in www/lib/r2.js and 4 other locations - About 45 mins to fix
                  www/lib/r2.js on lines 386..390
                  www/lib/r2.js on lines 391..395
                  www/lib/r2.js on lines 396..400
                  www/lib/r2.js on lines 402..406

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 50.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 5 locations. Consider refactoring.
                  Open

                  r2.bin_relocs = function(cb) {
                      r2.cmd('irj|', function(json) {
                          cb(JSON.parse(json));
                      });
                  };
                  Severity: Major
                  Found in www/lib/r2.js and 4 other locations - About 45 mins to fix
                  www/lib/r2.js on lines 386..390
                  www/lib/r2.js on lines 396..400
                  www/lib/r2.js on lines 402..406
                  www/lib/r2.js on lines 408..412

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 50.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  There are no issues that match your filters.

                  Category
                  Status