TargetProcess/tauCharts

View on GitHub
src/scales/logarithmic.ts

Summary

Maintainability
C
7 hrs
Test Coverage

Function extendLogScale has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

function extendLogScale(scale) {
    var d3ScaleCopy = scale.copy;

    // NOTE: D3 log scale ticks count is not configurable
    // and returns 10 ticks per each exponent.
Severity: Minor
Found in src/scales/logarithmic.ts - 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

Function extendLogScale has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function extendLogScale(scale) {
    var d3ScaleCopy = scale.copy;

    // NOTE: D3 log scale ticks count is not configurable
    // and returns 10 ticks per each exponent.
Severity: Minor
Found in src/scales/logarithmic.ts - About 1 hr to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        isInDomain(x) {
            var domain = this.domain();
            var min = domain[0];
            var max = domain[domain.length - 1];
            return (!Number.isNaN(min) && !Number.isNaN(max) && (x <= max) && (x >= min));
    Severity: Major
    Found in src/scales/logarithmic.ts and 1 other location - About 3 hrs to fix
    src/scales/linear.ts on lines 44..49

    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 96.

    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

            domain = [
                Math.min(...[min, domain[0]].filter(Number.isFinite)),
                Math.max(...[max, domain[1]].filter(Number.isFinite))
            ];
    Severity: Major
    Found in src/scales/logarithmic.ts and 1 other location - About 1 hr to fix
    src/scales/linear.ts on lines 28..31

    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

    Forbidden 'var' keyword, use 'let' or 'const' instead
    Open

        var niceTop = parseFloat(Math.ceil(Number(topExp[0])) + 'e' + topExp[1]);
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: no-var-keyword

    Disallows usage of the var keyword.

    Use let or const instead.

    Rationale

    Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

    Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

    Notes
    • Has Fix

    Config

    Not configurable.

    Examples
    "no-var-keyword": true

    For more information see this page.

    Identifier 'step' is never reassigned; use 'const' instead of 'var'.
    Open

            var step = Math.ceil(
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: prefer-const

    Requires that variable declarations use const instead of let and var if possible.

    If a variable is only assigned to once when it is declared, it should be declared using 'const'

    Notes
    • Has Fix

    Config

    An optional object containing the property "destructuring" with two possible values:

    • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
    • "all" - Only warns if all variables in destructuring can be const.
    Examples
    "prefer-const": true
    "prefer-const": true,[object Object]
    Schema
    {
      "type": "object",
      "properties": {
        "destructuring": {
          "type": "string",
          "enum": [
            "all",
            "any"
          ]
        }
      }
    }

    For more information see this page.

    Shadowed name: 'd3Scale'
    Open

            var d3Scale = extendLogScale(d3.scaleLog())
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: no-shadowed-variable

    Disallows shadowing variable declarations.

    Rationale

    When a variable in a local scope and a variable in the containing scope have the same name, shadowing occurs. Shadowing makes it impossible to access the variable in the containing scope and obscures to what value an identifier actually refers. Compare the following snippets:

    const a = 'no shadow';
    function print() {
        console.log(a);
    }
    print(); // logs 'no shadow'.
    const a = 'no shadow';
    function print() {
        const a = 'shadow'; // TSLint will complain here.
        console.log(a);
    }
    print(); // logs 'shadow'.

    ESLint has an equivalent rule. For more background information, refer to this MDN closure doc.

    Config

    You can optionally pass an object to disable checking for certain kinds of declarations. Possible keys are "class", "enum", "function", "import", "interface", "namespace", "typeAlias" and "typeParameter". You can also pass "underscore" to ignore variable names that begin with _. Just set the value to false for the check you want to disable. All checks default to true, i.e. are enabled by default. Note that you cannot disable variables and parameters.

    The option "temporalDeadZone" defaults to true which shows errors when shadowing block scoped declarations in their temporal dead zone. When set to false parameters, classes, enums and variables declared with let or const are not considered shadowed if the shadowing occurs within their temporal dead zone.

    The following example shows how the "temporalDeadZone" option changes the linting result:

    function fn(value) {
        if (value) {
            const tmp = value; // no error on this line if "temporalDeadZone" is false
            return tmp;
        }
        let tmp = undefined;
        if (!value) {
            const tmp = value; // this line always contains an error
            return tmp;
        }
    }
    Examples
    "no-shadowed-variable": true
    "no-shadowed-variable": true,[object Object]
    Schema
    {
      "type": "object",
      "properties": {
        "class": {
          "type": "boolean"
        },
        "enum": {
          "type": "boolean"
        },
        "function": {
          "type": "boolean"
        },
        "import": {
          "type": "boolean"
        },
        "interface": {
          "type": "boolean"
        },
        "namespace": {
          "type": "boolean"
        },
        "typeAlias": {
          "type": "boolean"
        },
        "typeParameter": {
          "type": "boolean"
        },
        "temporalDeadZone": {
          "type": "boolean"
        },
        "underscore": {
          "type": "boolean"
        }
      }
    }

    For more information see this page.

    Forbidden 'var' keyword, use 'let' or 'const' instead
    Open

            var min = Number.isFinite(props.min) ? props.min : domain[0];
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: no-var-keyword

    Disallows usage of the var keyword.

    Use let or const instead.

    Rationale

    Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

    Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

    Notes
    • Has Fix

    Config

    Not configurable.

    Examples
    "no-var-keyword": true

    For more information see this page.

    Forbidden 'var' keyword, use 'let' or 'const' instead
    Open

            var domain = this.vars;
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: no-var-keyword

    Disallows usage of the var keyword.

    Use let or const instead.

    Rationale

    Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

    Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

    Notes
    • Has Fix

    Config

    Not configurable.

    Examples
    "no-var-keyword": true

    For more information see this page.

    Identifier 'copy' is never reassigned; use 'const' instead of 'var'.
    Open

            var copy = d3ScaleCopy.call(scale);
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: prefer-const

    Requires that variable declarations use const instead of let and var if possible.

    If a variable is only assigned to once when it is declared, it should be declared using 'const'

    Notes
    • Has Fix

    Config

    An optional object containing the property "destructuring" with two possible values:

    • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
    • "all" - Only warns if all variables in destructuring can be const.
    Examples
    "prefer-const": true
    "prefer-const": true,[object Object]
    Schema
    {
      "type": "object",
      "properties": {
        "destructuring": {
          "type": "string",
          "enum": [
            "all",
            "any"
          ]
        }
      }
    }

    For more information see this page.

    Identifier 'top' is never reassigned; use 'const' instead of 'var'.
    Open

        var top = Math.max(...absDomain);
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: prefer-const

    Requires that variable declarations use const instead of let and var if possible.

    If a variable is only assigned to once when it is declared, it should be declared using 'const'

    Notes
    • Has Fix

    Config

    An optional object containing the property "destructuring" with two possible values:

    • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
    • "all" - Only warns if all variables in destructuring can be const.
    Examples
    "prefer-const": true
    "prefer-const": true,[object Object]
    Schema
    {
      "type": "object",
      "properties": {
        "destructuring": {
          "type": "string",
          "enum": [
            "all",
            "any"
          ]
        }
      }
    }

    For more information see this page.

    Identifier 'lowExp' is never reassigned; use 'const' instead of 'var'.
    Open

        var lowExp = low.toExponential().split('e');
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: prefer-const

    Requires that variable declarations use const instead of let and var if possible.

    If a variable is only assigned to once when it is declared, it should be declared using 'const'

    Notes
    • Has Fix

    Config

    An optional object containing the property "destructuring" with two possible values:

    • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
    • "all" - Only warns if all variables in destructuring can be const.
    Examples
    "prefer-const": true
    "prefer-const": true,[object Object]
    Schema
    {
      "type": "object",
      "properties": {
        "destructuring": {
          "type": "string",
          "enum": [
            "all",
            "any"
          ]
        }
      }
    }

    For more information see this page.

    Forbidden 'var' keyword, use 'let' or 'const' instead
    Open

            var lowExp = Math.floor(log10(extent[0]));
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: no-var-keyword

    Disallows usage of the var keyword.

    Use let or const instead.

    Rationale

    Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

    Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

    Notes
    • Has Fix

    Config

    Not configurable.

    Examples
    "no-var-keyword": true

    For more information see this page.

    Forbidden 'var' keyword, use 'let' or 'const' instead
    Open

            var copy = d3ScaleCopy.call(scale);
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: no-var-keyword

    Disallows usage of the var keyword.

    Use let or const instead.

    Rationale

    Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

    Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

    Notes
    • Has Fix

    Config

    Not configurable.

    Examples
    "no-var-keyword": true

    For more information see this page.

    Forbidden 'var' keyword, use 'let' or 'const' instead
    Open

        var top = Math.max(...absDomain);
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: no-var-keyword

    Disallows usage of the var keyword.

    Use let or const instead.

    Rationale

    Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

    Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

    Notes
    • Has Fix

    Config

    Not configurable.

    Examples
    "no-var-keyword": true

    For more information see this page.

    Identifier 'lowExp' is never reassigned; use 'const' instead of 'var'.
    Open

            var lowExp = Math.floor(log10(extent[0]));
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: prefer-const

    Requires that variable declarations use const instead of let and var if possible.

    If a variable is only assigned to once when it is declared, it should be declared using 'const'

    Notes
    • Has Fix

    Config

    An optional object containing the property "destructuring" with two possible values:

    • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
    • "all" - Only warns if all variables in destructuring can be const.
    Examples
    "prefer-const": true
    "prefer-const": true,[object Object]
    Schema
    {
      "type": "object",
      "properties": {
        "destructuring": {
          "type": "string",
          "enum": [
            "all",
            "any"
          ]
        }
      }
    }

    For more information see this page.

    Forbidden 'var' keyword, use 'let' or 'const' instead
    Open

            var max = Number.isFinite(props.max) ? props.max : domain[1];
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: no-var-keyword

    Disallows usage of the var keyword.

    Use let or const instead.

    Rationale

    Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

    Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

    Notes
    • Has Fix

    Config

    Not configurable.

    Examples
    "no-var-keyword": true

    For more information see this page.

    Forbidden 'var' keyword, use 'let' or 'const' instead
    Open

            var max = domain[domain.length - 1];
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: no-var-keyword

    Disallows usage of the var keyword.

    Use let or const instead.

    Rationale

    Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

    Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

    Notes
    • Has Fix

    Config

    Not configurable.

    Examples
    "no-var-keyword": true

    For more information see this page.

    Forbidden 'var' keyword, use 'let' or 'const' instead
    Open

            var topExp = Math.ceil(log10(extent[1]));
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: no-var-keyword

    Disallows usage of the var keyword.

    Use let or const instead.

    Rationale

    Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

    Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

    Notes
    • Has Fix

    Config

    Not configurable.

    Examples
    "no-var-keyword": true

    For more information see this page.

    Identifier 'min' is never reassigned; use 'const' instead of 'var'.
    Open

            var min = domain[0];
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: prefer-const

    Requires that variable declarations use const instead of let and var if possible.

    If a variable is only assigned to once when it is declared, it should be declared using 'const'

    Notes
    • Has Fix

    Config

    An optional object containing the property "destructuring" with two possible values:

    • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
    • "all" - Only warns if all variables in destructuring can be const.
    Examples
    "prefer-const": true
    "prefer-const": true,[object Object]
    Schema
    {
      "type": "object",
      "properties": {
        "destructuring": {
          "type": "string",
          "enum": [
            "all",
            "any"
          ]
        }
      }
    }

    For more information see this page.

    Identifier 'domain' is never reassigned; use 'const' instead of 'var'.
    Open

            var domain = this.vars;
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: prefer-const

    Requires that variable declarations use const instead of let and var if possible.

    If a variable is only assigned to once when it is declared, it should be declared using 'const'

    Notes
    • Has Fix

    Config

    An optional object containing the property "destructuring" with two possible values:

    • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
    • "all" - Only warns if all variables in destructuring can be const.
    Examples
    "prefer-const": true
    "prefer-const": true,[object Object]
    Schema
    {
      "type": "object",
      "properties": {
        "destructuring": {
          "type": "string",
          "enum": [
            "all",
            "any"
          ]
        }
      }
    }

    For more information see this page.

    Identifier 'topExp' is never reassigned; use 'const' instead of 'var'.
    Open

            var topExp = Math.ceil(log10(extent[1]));
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: prefer-const

    Requires that variable declarations use const instead of let and var if possible.

    If a variable is only assigned to once when it is declared, it should be declared using 'const'

    Notes
    • Has Fix

    Config

    An optional object containing the property "destructuring" with two possible values:

    • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
    • "all" - Only warns if all variables in destructuring can be const.
    Examples
    "prefer-const": true
    "prefer-const": true,[object Object]
    Schema
    {
      "type": "object",
      "properties": {
        "destructuring": {
          "type": "string",
          "enum": [
            "all",
            "any"
          ]
        }
      }
    }

    For more information see this page.

    Identifier 'props' is never reassigned; use 'const' instead of 'var'.
    Open

            var props = this.scaleConfig;
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: prefer-const

    Requires that variable declarations use const instead of let and var if possible.

    If a variable is only assigned to once when it is declared, it should be declared using 'const'

    Notes
    • Has Fix

    Config

    An optional object containing the property "destructuring" with two possible values:

    • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
    • "all" - Only warns if all variables in destructuring can be const.
    Examples
    "prefer-const": true
    "prefer-const": true,[object Object]
    Schema
    {
      "type": "object",
      "properties": {
        "destructuring": {
          "type": "string",
          "enum": [
            "all",
            "any"
          ]
        }
      }
    }

    For more information see this page.

    Forbidden 'var' keyword, use 'let' or 'const' instead
    Open

        var low = Math.min(...absDomain);
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: no-var-keyword

    Disallows usage of the var keyword.

    Use let or const instead.

    Rationale

    Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

    Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

    Notes
    • Has Fix

    Config

    Not configurable.

    Examples
    "no-var-keyword": true

    For more information see this page.

    Identifier 'max' is never reassigned; use 'const' instead of 'var'.
    Open

            var max = Number.isFinite(props.max) ? props.max : domain[1];
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: prefer-const

    Requires that variable declarations use const instead of let and var if possible.

    If a variable is only assigned to once when it is declared, it should be declared using 'const'

    Notes
    • Has Fix

    Config

    An optional object containing the property "destructuring" with two possible values:

    • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
    • "all" - Only warns if all variables in destructuring can be const.
    Examples
    "prefer-const": true
    "prefer-const": true,[object Object]
    Schema
    {
      "type": "object",
      "properties": {
        "destructuring": {
          "type": "string",
          "enum": [
            "all",
            "any"
          ]
        }
      }
    }

    For more information see this page.

    Identifier 'ticksPerExp' is never reassigned; use 'const' instead of 'var'.
    Open

            var ticksPerExp = 10;
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: prefer-const

    Requires that variable declarations use const instead of let and var if possible.

    If a variable is only assigned to once when it is declared, it should be declared using 'const'

    Notes
    • Has Fix

    Config

    An optional object containing the property "destructuring" with two possible values:

    • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
    • "all" - Only warns if all variables in destructuring can be const.
    Examples
    "prefer-const": true
    "prefer-const": true,[object Object]
    Schema
    {
      "type": "object",
      "properties": {
        "destructuring": {
          "type": "string",
          "enum": [
            "all",
            "any"
          ]
        }
      }
    }

    For more information see this page.

    Forbidden 'var' keyword, use 'let' or 'const' instead
    Open

            var min = domain[0];
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: no-var-keyword

    Disallows usage of the var keyword.

    Use let or const instead.

    Rationale

    Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

    Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

    Notes
    • Has Fix

    Config

    Not configurable.

    Examples
    "no-var-keyword": true

    For more information see this page.

    Forbidden 'var' keyword, use 'let' or 'const' instead
    Open

            var extent = d3.extent(scale.domain()) as [number, number];
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: no-var-keyword

    Disallows usage of the var keyword.

    Use let or const instead.

    Rationale

    Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

    Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

    Notes
    • Has Fix

    Config

    Not configurable.

    Examples
    "no-var-keyword": true

    For more information see this page.

    Forbidden 'var' keyword, use 'let' or 'const' instead
    Open

        var isPositive = domain[0] > 0;
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: no-var-keyword

    Disallows usage of the var keyword.

    Use let or const instead.

    Rationale

    Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

    Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

    Notes
    • Has Fix

    Config

    Not configurable.

    Examples
    "no-var-keyword": true

    For more information see this page.

    Forbidden 'var' keyword, use 'let' or 'const' instead
    Open

            var d3Scale = extendLogScale(d3.scaleLog())
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: no-var-keyword

    Disallows usage of the var keyword.

    Use let or const instead.

    Rationale

    Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

    Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

    Notes
    • Has Fix

    Config

    Not configurable.

    Examples
    "no-var-keyword": true

    For more information see this page.

    Forbidden 'var' keyword, use 'let' or 'const' instead
    Open

            var step = Math.ceil(
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: no-var-keyword

    Disallows usage of the var keyword.

    Use let or const instead.

    Rationale

    Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

    Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

    Notes
    • Has Fix

    Config

    Not configurable.

    Examples
    "no-var-keyword": true

    For more information see this page.

    Forbidden 'var' keyword, use 'let' or 'const' instead
    Open

        var topExp = top.toExponential().split('e');
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: no-var-keyword

    Disallows usage of the var keyword.

    Use let or const instead.

    Rationale

    Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

    Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

    Notes
    • Has Fix

    Config

    Not configurable.

    Examples
    "no-var-keyword": true

    For more information see this page.

    Identifier 'isPositive' is never reassigned; use 'const' instead of 'var'.
    Open

        var isPositive = domain[0] > 0;
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: prefer-const

    Requires that variable declarations use const instead of let and var if possible.

    If a variable is only assigned to once when it is declared, it should be declared using 'const'

    Notes
    • Has Fix

    Config

    An optional object containing the property "destructuring" with two possible values:

    • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
    • "all" - Only warns if all variables in destructuring can be const.
    Examples
    "prefer-const": true
    "prefer-const": true,[object Object]
    Schema
    {
      "type": "object",
      "properties": {
        "destructuring": {
          "type": "string",
          "enum": [
            "all",
            "any"
          ]
        }
      }
    }

    For more information see this page.

    Identifier 'niceLow' is never reassigned; use 'const' instead of 'var'.
    Open

        var niceLow = parseFloat(Math.floor(Number(lowExp[0])) + 'e' + lowExp[1]);
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: prefer-const

    Requires that variable declarations use const instead of let and var if possible.

    If a variable is only assigned to once when it is declared, it should be declared using 'const'

    Notes
    • Has Fix

    Config

    An optional object containing the property "destructuring" with two possible values:

    • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
    • "all" - Only warns if all variables in destructuring can be const.
    Examples
    "prefer-const": true
    "prefer-const": true,[object Object]
    Schema
    {
      "type": "object",
      "properties": {
        "destructuring": {
          "type": "string",
          "enum": [
            "all",
            "any"
          ]
        }
      }
    }

    For more information see this page.

    Identifier 'domain' is never reassigned; use 'const' instead of 'var'.
    Open

            var domain = this.domain();
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: prefer-const

    Requires that variable declarations use const instead of let and var if possible.

    If a variable is only assigned to once when it is declared, it should be declared using 'const'

    Notes
    • Has Fix

    Config

    An optional object containing the property "destructuring" with two possible values:

    • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
    • "all" - Only warns if all variables in destructuring can be const.
    Examples
    "prefer-const": true
    "prefer-const": true,[object Object]
    Schema
    {
      "type": "object",
      "properties": {
        "destructuring": {
          "type": "string",
          "enum": [
            "all",
            "any"
          ]
        }
      }
    }

    For more information see this page.

    Forbidden 'var' keyword, use 'let' or 'const' instead
    Open

            var domain = d3.extent(this.vars);
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: no-var-keyword

    Disallows usage of the var keyword.

    Use let or const instead.

    Rationale

    Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

    Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

    Notes
    • Has Fix

    Config

    Not configurable.

    Examples
    "no-var-keyword": true

    For more information see this page.

    Forbidden 'var' keyword, use 'let' or 'const' instead
    Open

            var domain = this.domain();
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: no-var-keyword

    Disallows usage of the var keyword.

    Use let or const instead.

    Rationale

    Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

    Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

    Notes
    • Has Fix

    Config

    Not configurable.

    Examples
    "no-var-keyword": true

    For more information see this page.

    Forbidden 'var' keyword, use 'let' or 'const' instead
    Open

            var ticksPerExp = 10;
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: no-var-keyword

    Disallows usage of the var keyword.

    Use let or const instead.

    Rationale

    Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

    Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

    Notes
    • Has Fix

    Config

    Not configurable.

    Examples
    "no-var-keyword": true

    For more information see this page.

    Forbidden 'var' keyword, use 'let' or 'const' instead
    Open

        var lowExp = low.toExponential().split('e');
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: no-var-keyword

    Disallows usage of the var keyword.

    Use let or const instead.

    Rationale

    Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

    Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

    Notes
    • Has Fix

    Config

    Not configurable.

    Examples
    "no-var-keyword": true

    For more information see this page.

    Forbidden 'var' keyword, use 'let' or 'const' instead
    Open

        var niceLow = parseFloat(Math.floor(Number(lowExp[0])) + 'e' + lowExp[1]);
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: no-var-keyword

    Disallows usage of the var keyword.

    Use let or const instead.

    Rationale

    Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

    Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

    Notes
    • Has Fix

    Config

    Not configurable.

    Examples
    "no-var-keyword": true

    For more information see this page.

    Identifier 'absDomain' is never reassigned; use 'const' instead of 'var'.
    Open

        var absDomain = domain.map((d) => Math.abs(d));
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: prefer-const

    Requires that variable declarations use const instead of let and var if possible.

    If a variable is only assigned to once when it is declared, it should be declared using 'const'

    Notes
    • Has Fix

    Config

    An optional object containing the property "destructuring" with two possible values:

    • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
    • "all" - Only warns if all variables in destructuring can be const.
    Examples
    "prefer-const": true
    "prefer-const": true,[object Object]
    Schema
    {
      "type": "object",
      "properties": {
        "destructuring": {
          "type": "string",
          "enum": [
            "all",
            "any"
          ]
        }
      }
    }

    For more information see this page.

    Forbidden 'var' keyword, use 'let' or 'const' instead
    Open

        var absDomain = domain.map((d) => Math.abs(d));
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: no-var-keyword

    Disallows usage of the var keyword.

    Use let or const instead.

    Rationale

    Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

    Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

    Notes
    • Has Fix

    Config

    Not configurable.

    Examples
    "no-var-keyword": true

    For more information see this page.

    non-arrow functions are forbidden
    Open

        scale.ticks = function (n) {
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: only-arrow-functions

    Disallows traditional (non-arrow) function expressions.

    Note that non-arrow functions are allowed if 'this' appears somewhere in its body (as such functions cannot be converted to arrow functions).

    Rationale

    Traditional functions don't bind lexical scope, which can lead to unexpected behavior when accessing 'this'.

    Config

    Two arguments may be optionally provided:

    • "allow-declarations" allows standalone function declarations.
    • "allow-named-functions" allows the expression function foo() {} but not function() {}.
    Examples
    "only-arrow-functions": true
    "only-arrow-functions": true,allow-declarations,allow-named-functions
    Schema
    {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "allow-declarations",
          "allow-named-functions"
        ]
      },
      "minLength": 0,
      "maxLength": 1
    }

    For more information see this page.

    Identifier 'min' is never reassigned; use 'const' instead of 'var'.
    Open

            var min = Number.isFinite(props.min) ? props.min : domain[0];
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: prefer-const

    Requires that variable declarations use const instead of let and var if possible.

    If a variable is only assigned to once when it is declared, it should be declared using 'const'

    Notes
    • Has Fix

    Config

    An optional object containing the property "destructuring" with two possible values:

    • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
    • "all" - Only warns if all variables in destructuring can be const.
    Examples
    "prefer-const": true
    "prefer-const": true,[object Object]
    Schema
    {
      "type": "object",
      "properties": {
        "destructuring": {
          "type": "string",
          "enum": [
            "all",
            "any"
          ]
        }
      }
    }

    For more information see this page.

    Identifier 'extent' is never reassigned; use 'const' instead of 'var'.
    Open

            var extent = d3.extent(scale.domain()) as [number, number];
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: prefer-const

    Requires that variable declarations use const instead of let and var if possible.

    If a variable is only assigned to once when it is declared, it should be declared using 'const'

    Notes
    • Has Fix

    Config

    An optional object containing the property "destructuring" with two possible values:

    • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
    • "all" - Only warns if all variables in destructuring can be const.
    Examples
    "prefer-const": true
    "prefer-const": true,[object Object]
    Schema
    {
      "type": "object",
      "properties": {
        "destructuring": {
          "type": "string",
          "enum": [
            "all",
            "any"
          ]
        }
      }
    }

    For more information see this page.

    Forbidden 'var' keyword, use 'let' or 'const' instead
    Open

            var props = this.scaleConfig;
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: no-var-keyword

    Disallows usage of the var keyword.

    Use let or const instead.

    Rationale

    Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

    Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

    Notes
    • Has Fix

    Config

    Not configurable.

    Examples
    "no-var-keyword": true

    For more information see this page.

    Forbidden 'var' keyword, use 'let' or 'const' instead
    Open

        var d3ScaleCopy = scale.copy;
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: no-var-keyword

    Disallows usage of the var keyword.

    Use let or const instead.

    Rationale

    Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

    Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

    Notes
    • Has Fix

    Config

    Not configurable.

    Examples
    "no-var-keyword": true

    For more information see this page.

    Identifier 'ticks' is never reassigned; use 'const' instead of 'var'.
    Open

            var ticks = [];
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: prefer-const

    Requires that variable declarations use const instead of let and var if possible.

    If a variable is only assigned to once when it is declared, it should be declared using 'const'

    Notes
    • Has Fix

    Config

    An optional object containing the property "destructuring" with two possible values:

    • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
    • "all" - Only warns if all variables in destructuring can be const.
    Examples
    "prefer-const": true
    "prefer-const": true,[object Object]
    Schema
    {
      "type": "object",
      "properties": {
        "destructuring": {
          "type": "string",
          "enum": [
            "all",
            "any"
          ]
        }
      }
    }

    For more information see this page.

    Identifier 'low' is never reassigned; use 'const' instead of 'var'.
    Open

        var low = Math.min(...absDomain);
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: prefer-const

    Requires that variable declarations use const instead of let and var if possible.

    If a variable is only assigned to once when it is declared, it should be declared using 'const'

    Notes
    • Has Fix

    Config

    An optional object containing the property "destructuring" with two possible values:

    • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
    • "all" - Only warns if all variables in destructuring can be const.
    Examples
    "prefer-const": true
    "prefer-const": true,[object Object]
    Schema
    {
      "type": "object",
      "properties": {
        "destructuring": {
          "type": "string",
          "enum": [
            "all",
            "any"
          ]
        }
      }
    }

    For more information see this page.

    non-arrow functions are forbidden
    Open

        scale.copy = function () {
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: only-arrow-functions

    Disallows traditional (non-arrow) function expressions.

    Note that non-arrow functions are allowed if 'this' appears somewhere in its body (as such functions cannot be converted to arrow functions).

    Rationale

    Traditional functions don't bind lexical scope, which can lead to unexpected behavior when accessing 'this'.

    Config

    Two arguments may be optionally provided:

    • "allow-declarations" allows standalone function declarations.
    • "allow-named-functions" allows the expression function foo() {} but not function() {}.
    Examples
    "only-arrow-functions": true
    "only-arrow-functions": true,allow-declarations,allow-named-functions
    Schema
    {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "allow-declarations",
          "allow-named-functions"
        ]
      },
      "minLength": 0,
      "maxLength": 1
    }

    For more information see this page.

    Identifier 'max' is never reassigned; use 'const' instead of 'var'.
    Open

            var max = domain[domain.length - 1];
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: prefer-const

    Requires that variable declarations use const instead of let and var if possible.

    If a variable is only assigned to once when it is declared, it should be declared using 'const'

    Notes
    • Has Fix

    Config

    An optional object containing the property "destructuring" with two possible values:

    • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
    • "all" - Only warns if all variables in destructuring can be const.
    Examples
    "prefer-const": true
    "prefer-const": true,[object Object]
    Schema
    {
      "type": "object",
      "properties": {
        "destructuring": {
          "type": "string",
          "enum": [
            "all",
            "any"
          ]
        }
      }
    }

    For more information see this page.

    Identifier 'topExp' is never reassigned; use 'const' instead of 'var'.
    Open

        var topExp = top.toExponential().split('e');
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: prefer-const

    Requires that variable declarations use const instead of let and var if possible.

    If a variable is only assigned to once when it is declared, it should be declared using 'const'

    Notes
    • Has Fix

    Config

    An optional object containing the property "destructuring" with two possible values:

    • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
    • "all" - Only warns if all variables in destructuring can be const.
    Examples
    "prefer-const": true
    "prefer-const": true,[object Object]
    Schema
    {
      "type": "object",
      "properties": {
        "destructuring": {
          "type": "string",
          "enum": [
            "all",
            "any"
          ]
        }
      }
    }

    For more information see this page.

    Forbidden 'var' keyword, use 'let' or 'const' instead
    Open

            var ticks = [];
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: no-var-keyword

    Disallows usage of the var keyword.

    Use let or const instead.

    Rationale

    Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

    Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

    Notes
    • Has Fix

    Config

    Not configurable.

    Examples
    "no-var-keyword": true

    For more information see this page.

    Identifier 'd3ScaleCopy' is never reassigned; use 'const' instead of 'var'.
    Open

        var d3ScaleCopy = scale.copy;
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: prefer-const

    Requires that variable declarations use const instead of let and var if possible.

    If a variable is only assigned to once when it is declared, it should be declared using 'const'

    Notes
    • Has Fix

    Config

    An optional object containing the property "destructuring" with two possible values:

    • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
    • "all" - Only warns if all variables in destructuring can be const.
    Examples
    "prefer-const": true
    "prefer-const": true,[object Object]
    Schema
    {
      "type": "object",
      "properties": {
        "destructuring": {
          "type": "string",
          "enum": [
            "all",
            "any"
          ]
        }
      }
    }

    For more information see this page.

    Identifier 'd3Scale' is never reassigned; use 'const' instead of 'var'.
    Open

            var d3Scale = extendLogScale(d3.scaleLog())
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: prefer-const

    Requires that variable declarations use const instead of let and var if possible.

    If a variable is only assigned to once when it is declared, it should be declared using 'const'

    Notes
    • Has Fix

    Config

    An optional object containing the property "destructuring" with two possible values:

    • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
    • "all" - Only warns if all variables in destructuring can be const.
    Examples
    "prefer-const": true
    "prefer-const": true,[object Object]
    Schema
    {
      "type": "object",
      "properties": {
        "destructuring": {
          "type": "string",
          "enum": [
            "all",
            "any"
          ]
        }
      }
    }

    For more information see this page.

    Identifier 'niceTop' is never reassigned; use 'const' instead of 'var'.
    Open

        var niceTop = parseFloat(Math.ceil(Number(topExp[0])) + 'e' + topExp[1]);
    Severity: Minor
    Found in src/scales/logarithmic.ts by tslint

    Rule: prefer-const

    Requires that variable declarations use const instead of let and var if possible.

    If a variable is only assigned to once when it is declared, it should be declared using 'const'

    Notes
    • Has Fix

    Config

    An optional object containing the property "destructuring" with two possible values:

    • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
    • "all" - Only warns if all variables in destructuring can be const.
    Examples
    "prefer-const": true
    "prefer-const": true,[object Object]
    Schema
    {
      "type": "object",
      "properties": {
        "destructuring": {
          "type": "string",
          "enum": [
            "all",
            "any"
          ]
        }
      }
    }

    For more information see this page.

    There are no issues that match your filters.

    Category
    Status