bagrounds/data-visualizer

View on GitHub

Showing 4 of 4 total issues

Function chart has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function chart (options, callback) {
    var error = invalidOptions(options)

    if (error) {
      callback(error)
Severity: Minor
Found in js/chart.js - About 1 hr to fix

    This function has too many statements (12). Maximum allowed is 10.
    Open

      function chart (options, callback) {
    Severity: Minor
    Found in js/chart.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/

    Infix operators must be spaced.
    Open

      var LineChart= require('react-d3-basic').LineChart
    Severity: Minor
    Found in js/chart.js by eslint

    Require Spaces Around Infix Operators (space-infix-ops)

    (fixable) The --fix option on the [command line](../user-guide/command-line-interface#fix) automatically fixes problems reported by this rule.

    While formatting preferences are very personal, a number of style guides require spaces around operators, such as:

    var sum = 1 + 2;

    The proponents of these extra spaces believe it make the code easier to read and can more easily highlight potential errors, such as:

    var sum = i+++2;

    While this is valid JavaScript syntax, it is hard to determine what the author intended.

    Rule Details

    This rule is aimed at ensuring there are spaces around infix operators.

    Options

    This rule accepts a single options argument with the following defaults:

    "space-infix-ops": ["error", {"int32Hint": false}]

    int32Hint

    Set the int32Hint option to true (default is false) to allow write a|0 without space.

    var foo = bar|0; // `foo` is forced to be signed 32 bit integer

    The following patterns are considered problems:

    /*eslint space-infix-ops: "error"*/
    /*eslint-env es6*/
    
    a+b
    
    a+ b
    
    a +b
    
    a?b:c
    
    const a={b:1};
    
    var {a=0}=bar;
    
    function foo(a=0) { }

    The following patterns are not considered problems:

    /*eslint space-infix-ops: "error"*/
    /*eslint-env es6*/
    
    a + b
    
    a       + b
    
    a ? b : c
    
    const a = {b:1};
    
    var {a = 0} = bar;
    
    function foo(a = 0) { }

    Source: http://eslint.org/docs/rules/

    TODO found
    Open

       * TODO: actually check stuff
    Severity: Minor
    Found in js/chart.js by fixme
    Severity
    Category
    Status
    Source
    Language