TargetProcess/tauCharts

View on GitHub
src/spec-converter.ts

Summary

Maintainability
F
3 days
Test Coverage

Function scalesPool has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
Open

    scalesPool(scaleType: string, dimName: string, guide: ScaleGuide, settings: ChartSettings) {

        var k = `${scaleType}_${dimName}`;

        if (this.dist.scales.hasOwnProperty(k)) {
Severity: Minor
Found in src/spec-converter.ts - 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 scalesPool has 124 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    scalesPool(scaleType: string, dimName: string, guide: ScaleGuide, settings: ChartSettings) {

        var k = `${scaleType}_${dimName}`;

        if (this.dist.scales.hasOwnProperty(k)) {
Severity: Major
Found in src/spec-converter.ts - About 4 hrs to fix

    File spec-converter.ts has 335 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import * as utils from './utils/utils';
    import {UnitDomainPeriodGenerator} from './unit-domain-period-generator';
    import {
        ChartConfig,
        ChartSettings,
    Severity: Minor
    Found in src/spec-converter.ts - About 4 hrs to fix

      Function ruleInferExpression has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          ruleInferExpression(srcUnit: Unit) {
      
              var expr = {
                  operator: 'none',
                  params: []
      Severity: Minor
      Found in src/spec-converter.ts - About 1 hr to fix

        Function ruleInferExpression has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            ruleInferExpression(srcUnit: Unit) {
        
                var expr = {
                    operator: 'none',
                    params: []
        Severity: Minor
        Found in src/spec-converter.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 ruleApplyDefaults has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            ruleApplyDefaults(spec: GPLSpec) {
        
                var settings = spec.settings || {};
        
                var traverse = (node, iterator, parentNode) => {
        Severity: Minor
        Found in src/spec-converter.ts - About 1 hr to fix

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

              ruleApplyDefaults(spec: GPLSpec) {
          
                  var settings = spec.settings || {};
          
                  var traverse = (node, iterator, parentNode) => {
          Severity: Minor
          Found in src/spec-converter.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 constructor has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              constructor(spec: ChartConfig) {
                  this.spec = spec;
          
                  this.dist = {
                      sources: <DataSources>{
          Severity: Minor
          Found in src/spec-converter.ts - About 1 hr to fix

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

                    if (scaleType === 'identity' && dimName !== null) {
                        item = {
                            type: 'identity',
                            source: '/',
                            dim: this.ruleInferDim(dimName, guide)
            Severity: Major
            Found in src/spec-converter.ts and 2 other locations - About 50 mins to fix
            src/spec-converter.ts on lines 274..280
            src/spec-converter.ts on lines 282..288

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

            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 3 locations. Consider refactoring.
            Open

                    if (scaleType === 'split' && dimName !== null) {
                        item = {
                            type: 'value',
                            source: '/',
                            dim: this.ruleInferDim(dimName, guide)
            Severity: Major
            Found in src/spec-converter.ts and 2 other locations - About 50 mins to fix
            src/spec-converter.ts on lines 274..280
            src/spec-converter.ts on lines 290..296

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

            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 3 locations. Consider refactoring.
            Open

                    if (scaleType === 'label' && dimName !== null) {
                        item = {
                            type: 'value',
                            source: '/',
                            dim: this.ruleInferDim(dimName, guide)
            Severity: Major
            Found in src/spec-converter.ts and 2 other locations - About 50 mins to fix
            src/spec-converter.ts on lines 282..288
            src/spec-converter.ts on lines 290..296

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

            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 iterator = (childUnit: Unit, root: Unit) => {
            Severity: Minor
            Found in src/spec-converter.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 parentGuide = utils.clone(root.guide) || {};
            Severity: Minor
            Found in src/spec-converter.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 myDims = this.dist.sources['/'].dims;
            Severity: Minor
            Found in src/spec-converter.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 g = srcUnit.guide || {};
            Severity: Minor
            Found in src/spec-converter.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 'parentGuide' is never reassigned; use 'const' instead of 'var'.
            Open

                            var parentGuide = utils.clone(root.guide) || {};
            Severity: Minor
            Found in src/spec-converter.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 'dims' is never reassigned; use 'const' instead of 'var'.
            Open

                    var dims = gplSpec.sources['/'].dims;
            Severity: Minor
            Found in src/spec-converter.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.

            Use a conditional expression instead of assigning to 'item.niceInterval' in multiple places.
            Open

                        if (guide.hasOwnProperty('niceInterval')) {
            Severity: Minor
            Found in src/spec-converter.ts by tslint

            Rule: prefer-conditional-expression

            Recommends to use a conditional expression instead of assigning to the same thing in each branch of an if statement.

            Rationale

            This reduces duplication and can eliminate an unnecessary variable declaration.

            Config

            If check-else-if is specified, the rule also checks nested if-else-if statements.

            Examples
            "prefer-conditional-expression": true
            "prefer-conditional-expression": true,check-else-if
            Schema
            {
              "type": "string",
              "enum": [
                "check-else-if"
              ]
            }

            For more information see this page.

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

                    var k = `${scaleType}_${dimName}`;
            Severity: Minor
            Found in src/spec-converter.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 'row' is never reassigned; use 'const' instead of 'var'.
            Open

                            var row = (Object.keys(rowN).reduce(reduceIterator, rowN));
            Severity: Minor
            Found in src/spec-converter.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 'root' is never reassigned; use 'const' instead of 'var'.
            Open

                    var root = walkStructure(srcSpec.spec.unit);
            Severity: Minor
            Found in src/spec-converter.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.

            Type assertion on object literals is forbidden, use a type annotation instead.
            Open

                        sources: <DataSources>{
                            '?': {
                                dims: {},
                                data: [{}]
                            },
            Severity: Minor
            Found in src/spec-converter.ts by tslint

            Rule: no-object-literal-type-assertion

            Forbids an object literal to appear in a type assertion expression. Casting to any or to unknown is still allowed.

            Rationale

            Always prefer const x: T = { ... }; to const x = { ... } as T;. The type assertion in the latter case is either unnecessary or hides an error. The compiler will warn for excess properties with this syntax, but not missing required fields. For example: const x: { foo: number } = {} will fail to compile, but const x = {} as { foo: number } will succeed. Additionally, the const assertion const x = { foo: 1 } as const, introduced in TypeScript 3.4, is considered beneficial and is ignored by this rule.

            Notes
            • TypeScript Only

            Config

            One option may be configured:

            • allow-arguments allows type assertions to be used on object literals inside call expressions.
            Examples
            "no-object-literal-type-assertion": true
            "no-object-literal-type-assertion": true,[object Object]
            Schema
            {
              "type": "object",
              "properties": {
                "allow-arguments": {
                  "type": "boolean"
                }
              },
              "additionalProperties": false
            }

            For more information see this page.

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

                    var dims = this.spec.spec.dimensions;
            Severity: Minor
            Found in src/spec-converter.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.

            Type assertion on object literals is forbidden, use a type annotation instead.
            Open

                    var item = {} as ScaleConfig;
            Severity: Minor
            Found in src/spec-converter.ts by tslint

            Rule: no-object-literal-type-assertion

            Forbids an object literal to appear in a type assertion expression. Casting to any or to unknown is still allowed.

            Rationale

            Always prefer const x: T = { ... }; to const x = { ... } as T;. The type assertion in the latter case is either unnecessary or hides an error. The compiler will warn for excess properties with this syntax, but not missing required fields. For example: const x: { foo: number } = {} will fail to compile, but const x = {} as { foo: number } will succeed. Additionally, the const assertion const x = { foo: 1 } as const, introduced in TypeScript 3.4, is considered beneficial and is ignored by this rule.

            Notes
            • TypeScript Only

            Config

            One option may be configured:

            • allow-arguments allows type assertions to be used on object literals inside call expressions.
            Examples
            "no-object-literal-type-assertion": true
            "no-object-literal-type-assertion": true,[object Object]
            Schema
            {
              "type": "object",
              "properties": {
                "allow-arguments": {
                  "type": "boolean"
                }
              },
              "additionalProperties": false
            }

            For more information see this page.

            Type assertion using the '<>' syntax is forbidden. Use the 'as' syntax instead.
            Open

                        sources: <DataSources>{
                            '?': {
                                dims: {},
                                data: [{}]
                            },
            Severity: Minor
            Found in src/spec-converter.ts by tslint

            Rule: no-angle-bracket-type-assertion

            Requires the use of as Type for type assertions instead of <Type>.

            Rationale

            Both formats of type assertions have the same effect, but only as type assertions work in .tsx files. This rule ensures that you have a consistent type assertion style across your codebase.

            Notes
            • TypeScript Only
            • Has Fix

            Config

            Not configurable.

            Examples
            "no-angle-bracket-type-assertion": true

            For more information see this page.

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

                    var reduceIterator = (row, key) => {
            Severity: Minor
            Found in src/spec-converter.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 'srcSpec' is never reassigned; use 'const' instead of 'var'.
            Open

                    var srcSpec = this.spec;
            Severity: Minor
            Found in src/spec-converter.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 'settings' is never reassigned; use 'const' instead of 'var'.
            Open

                    var settings = spec.settings || {};
            Severity: Minor
            Found in src/spec-converter.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 'dims' is never reassigned; use 'const' instead of 'var'.
            Open

                    var dims = this.spec.spec.dimensions;
            Severity: Minor
            Found in src/spec-converter.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 'g' is never reassigned; use 'const' instead of 'var'.
            Open

                    var g = srcUnit.guide || {};
            Severity: Minor
            Found in src/spec-converter.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 walkStructure = (srcUnit: Unit) => {
            Severity: Minor
            Found in src/spec-converter.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 r = dimName;
            Severity: Minor
            Found in src/spec-converter.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 gy = g.y || {};
            Severity: Minor
            Found in src/spec-converter.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 'walkStructure' is never reassigned; use 'const' instead of 'var'.
            Open

                    var walkStructure = (srcUnit: Unit) => {
            Severity: Minor
            Found in src/spec-converter.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 'dims' is never reassigned; use 'const' instead of 'var'.
            Open

                    var dims = this.spec.spec.dimensions;
            Severity: Minor
            Found in src/spec-converter.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 'myDims' is never reassigned; use 'const' instead of 'var'.
            Open

                    var myDims = this.dist.sources['/'].dims;
            Severity: Minor
            Found in src/spec-converter.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 dims = gplSpec.sources['/'].dims;
            Severity: Minor
            Found in src/spec-converter.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 'rowKey' is never reassigned; use 'const' instead of 'let'.
            Open

                        let rowKey = row[key];
            Severity: Minor
            Found in src/spec-converter.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.

            Use a conditional expression instead of assigning to 'item.nice' in multiple places.
            Open

                        if (guide.hasOwnProperty('nice')) {
            Severity: Minor
            Found in src/spec-converter.ts by tslint

            Rule: prefer-conditional-expression

            Recommends to use a conditional expression instead of assigning to the same thing in each branch of an if statement.

            Rationale

            This reduces duplication and can eliminate an unnecessary variable declaration.

            Config

            If check-else-if is specified, the rule also checks nested if-else-if statements.

            Examples
            "prefer-conditional-expression": true
            "prefer-conditional-expression": true,check-else-if
            Schema
            {
              "type": "string",
              "enum": [
                "check-else-if"
              ]
            }

            For more information see this page.

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

                    var guide = srcUnit.guide || {};
            Severity: Minor
            Found in src/spec-converter.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 'k' is never reassigned; use 'const' instead of 'var'.
            Open

                    var k = `${scaleType}_${dimName}`;
            Severity: Minor
            Found in src/spec-converter.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.

            missing whitespace
            Open

                        myDims[r] = {type:myDims[dimName].type};
            Severity: Minor
            Found in src/spec-converter.ts by tslint

            Rule: whitespace

            Enforces whitespace style conventions.

            Rationale

            Helps maintain a readable, consistent style in your codebase.

            Notes
            • Has Fix

            Config

            Several arguments may be optionally provided:

            • "check-branch" checks branching statements (if/else/for/while) are followed by whitespace.
            • "check-decl"checks that variable declarations have whitespace around the equals token.
            • "check-operator" checks for whitespace around operator tokens.
            • "check-module" checks for whitespace in import & export statements.
            • "check-separator" checks for whitespace after separator tokens (,/;).
            • "check-rest-spread" checks that there is no whitespace after rest/spread operator (...).
            • "check-type" checks for whitespace before a variable type specification.
            • "check-typecast" checks for whitespace between a typecast and its target.
            • "check-type-operator" checks for whitespace between type operators | and &.
            • "check-preblock" checks for whitespace before the opening brace of a block.
            • "check-postbrace" checks for whitespace after an opening brace.
            Examples
            "whitespace": true,check-branch,check-operator,check-typecast
            Schema
            {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "check-branch",
                  "check-decl",
                  "check-operator",
                  "check-module",
                  "check-separator",
                  "check-rest-spread",
                  "check-type",
                  "check-typecast",
                  "check-type-operator",
                  "check-preblock",
                  "check-postbrace"
                ]
              },
              "minLength": 0,
              "maxLength": 11
            }

            For more information see this page.

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

                    var root = walkStructure(srcSpec.spec.unit);
            Severity: Minor
            Found in src/spec-converter.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 scaleY = this.getScaleConfig('y', srcUnit.y);
            Severity: Minor
            Found in src/spec-converter.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 gplSpec = this.dist;
            Severity: Minor
            Found in src/spec-converter.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 row = (Object.keys(rowN).reduce(reduceIterator, rowN));
            Severity: Minor
            Found in src/spec-converter.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 'gen' is never reassigned; use 'const' instead of 'let'.
            Open

                            let gen = UnitDomainPeriodGenerator.get(item.period, {utc: settings.utcTime});
            Severity: Minor
            Found in src/spec-converter.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 'gy' is never reassigned; use 'const' instead of 'var'.
            Open

                    var gy = g.y || {};
            Severity: Minor
            Found in src/spec-converter.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.

            Use a conditional expression instead of assigning to 'item.autoScale' in multiple places.
            Open

                        if (guide.hasOwnProperty('autoScale')) {
            Severity: Minor
            Found in src/spec-converter.ts by tslint

            Rule: prefer-conditional-expression

            Recommends to use a conditional expression instead of assigning to the same thing in each branch of an if statement.

            Rationale

            This reduces duplication and can eliminate an unnecessary variable declaration.

            Config

            If check-else-if is specified, the rule also checks nested if-else-if statements.

            Examples
            "prefer-conditional-expression": true
            "prefer-conditional-expression": true,check-else-if
            Schema
            {
              "type": "string",
              "enum": [
                "check-else-if"
              ]
            }

            For more information see this page.

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

                    var traverse = (node, iterator, parentNode) => {
            Severity: Minor
            Found in src/spec-converter.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 gplRoot = utils.clone(utils.omit(srcUnit, 'unit'));
            Severity: Minor
            Found in src/spec-converter.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 'gplSpec' is never reassigned; use 'const' instead of 'var'.
            Open

                    var gplSpec = this.dist;
            Severity: Minor
            Found in src/spec-converter.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 'k' is never reassigned; use 'const' instead of 'var'.
            Open

                    var k = `${scaleType}_${dimName}`;
            Severity: Minor
            Found in src/spec-converter.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 meta = srcSpec.spec.dimensions || {};
            Severity: Minor
            Found in src/spec-converter.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 expr = {
            Severity: Minor
            Found in src/spec-converter.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 'traverse' is never reassigned; use 'const' instead of 'var'.
            Open

                    var traverse = (node, iterator, parentNode) => {
            Severity: Minor
            Found in src/spec-converter.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 'meta' is never reassigned; use 'const' instead of 'var'.
            Open

                    var meta = srcSpec.spec.dimensions || {};
            Severity: Minor
            Found in src/spec-converter.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 'reduceIterator' is never reassigned; use 'const' instead of 'var'.
            Open

                    var reduceIterator = (row, key) => {
            Severity: Minor
            Found in src/spec-converter.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 'scaleX' is never reassigned; use 'const' instead of 'var'.
            Open

                    var scaleX = this.getScaleConfig('x', srcUnit.x);
            Severity: Minor
            Found in src/spec-converter.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 srcSpec = this.spec;
            Severity: Minor
            Found in src/spec-converter.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 dims = srcSpec.spec.dimensions;
            Severity: Minor
            Found in src/spec-converter.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 k = `${scaleType}_${dimName}`;
            Severity: Minor
            Found in src/spec-converter.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.

            Shadowed name: 'iterator'
            Open

                    var traverse = (node, iterator, parentNode) => {
            Severity: Minor
            Found in src/spec-converter.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 guide = srcUnit.guide || {};
            Severity: Minor
            Found in src/spec-converter.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 item = {} as ScaleConfig;
            Severity: Minor
            Found in src/spec-converter.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 gx = g.x || {};
            Severity: Minor
            Found in src/spec-converter.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 scaleX = this.getScaleConfig('x', srcUnit.x);
            Severity: Minor
            Found in src/spec-converter.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 'iterator' is never reassigned; use 'const' instead of 'var'.
            Open

                    var iterator = (childUnit: Unit, root: Unit) => {
            Severity: Minor
            Found in src/spec-converter.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 'scaleY' is never reassigned; use 'const' instead of 'var'.
            Open

                    var scaleY = this.getScaleConfig('y', srcUnit.y);
            Severity: Minor
            Found in src/spec-converter.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.

            Type assertion on object literals is forbidden, use a type annotation instead.
            Open

                        item = {
                            type: 'color',
                            source: '/',
                            dim: this.ruleInferDim(dimName, guide)
                        } as ScaleConfig;
            Severity: Minor
            Found in src/spec-converter.ts by tslint

            Rule: no-object-literal-type-assertion

            Forbids an object literal to appear in a type assertion expression. Casting to any or to unknown is still allowed.

            Rationale

            Always prefer const x: T = { ... }; to const x = { ... } as T;. The type assertion in the latter case is either unnecessary or hides an error. The compiler will warn for excess properties with this syntax, but not missing required fields. For example: const x: { foo: number } = {} will fail to compile, but const x = {} as { foo: number } will succeed. Additionally, the const assertion const x = { foo: 1 } as const, introduced in TypeScript 3.4, is considered beneficial and is ignored by this rule.

            Notes
            • TypeScript Only

            Config

            One option may be configured:

            • allow-arguments allows type assertions to be used on object literals inside call expressions.
            Examples
            "no-object-literal-type-assertion": true
            "no-object-literal-type-assertion": true,[object Object]
            Schema
            {
              "type": "object",
              "properties": {
                "allow-arguments": {
                  "type": "boolean"
                }
              },
              "additionalProperties": false
            }

            For more information see this page.

            Type assertion on object literals is forbidden, use a type annotation instead.
            Open

                    var expr = {
                        operator: 'none',
                        params: []
                    } as Expression;
            Severity: Minor
            Found in src/spec-converter.ts by tslint

            Rule: no-object-literal-type-assertion

            Forbids an object literal to appear in a type assertion expression. Casting to any or to unknown is still allowed.

            Rationale

            Always prefer const x: T = { ... }; to const x = { ... } as T;. The type assertion in the latter case is either unnecessary or hides an error. The compiler will warn for excess properties with this syntax, but not missing required fields. For example: const x: { foo: number } = {} will fail to compile, but const x = {} as { foo: number } will succeed. Additionally, the const assertion const x = { foo: 1 } as const, introduced in TypeScript 3.4, is considered beneficial and is ignored by this rule.

            Notes
            • TypeScript Only

            Config

            One option may be configured:

            • allow-arguments allows type assertions to be used on object literals inside call expressions.
            Examples
            "no-object-literal-type-assertion": true
            "no-object-literal-type-assertion": true,[object Object]
            Schema
            {
              "type": "object",
              "properties": {
                "allow-arguments": {
                  "type": "boolean"
                }
              },
              "additionalProperties": false
            }

            For more information see this page.

            Use the object spread operator instead.
            Open

                    return Object.assign({inherit: true, source: '/'}, expr);
            Severity: Minor
            Found in src/spec-converter.ts by tslint

            Rule: prefer-object-spread

            Enforces the use of the ES2018 object spread operator over Object.assign() where appropriate.

            Rationale

            Object spread allows for better type checking and inference.

            Notes
            • Has Fix

            Config

            Not configurable.

            Examples
            "prefer-object-spread": true

            For more information see this page.

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

                    var settings = spec.settings || {};
            Severity: Minor
            Found in src/spec-converter.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 'gplRoot' is never reassigned; use 'const' instead of 'var'.
            Open

                        var gplRoot = utils.clone(utils.omit(srcUnit, 'unit'));
            Severity: Minor
            Found in src/spec-converter.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 dims = this.spec.spec.dimensions;
            Severity: Minor
            Found in src/spec-converter.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 'dims' is never reassigned; use 'const' instead of 'var'.
            Open

                    var dims = srcSpec.spec.dimensions;
            Severity: Minor
            Found in src/spec-converter.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 'gx' is never reassigned; use 'const' instead of 'var'.
            Open

                    var gx = g.x || {};
            Severity: Minor
            Found in src/spec-converter.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.

            'Object.assign' returns the first argument. Prefer object spread if you want a new object.
            Open

                            childUnit.guide = Object.assign(childUnit.guide || {}, {
                                obsoleteVerticalStackOrder: (root.guide || {}).obsoleteVerticalStackOrder
                            });
            Severity: Minor
            Found in src/spec-converter.ts by tslint

            Rule: prefer-object-spread

            Enforces the use of the ES2018 object spread operator over Object.assign() where appropriate.

            Rationale

            Object spread allows for better type checking and inference.

            Notes
            • Has Fix

            Config

            Not configurable.

            Examples
            "prefer-object-spread": true

            For more information see this page.

            There are no issues that match your filters.

            Category
            Status