TargetProcess/tauCharts

View on GitHub
src/plugins-sdk.ts

Summary

Maintainability
C
1 day
Test Coverage

Function extractFieldsFormatInfo has 85 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    static extractFieldsFormatInfo(spec: GPLSpec) {

        var specScales = spec.scales;

        var isEmptyScale = function (key: string) {
Severity: Major
Found in src/plugins-sdk.ts - About 3 hrs to fix

    Function getFieldFormatters has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        static getFieldFormatters(spec: GPLSpec, formatters: {[field: string]: Formatter}) {
    
            const info = PluginsSDK.extractFieldsFormatInfo(spec);
            Object.keys(info).forEach((k) => {
                if (info[k].parentField) {
    Severity: Minor
    Found in src/plugins-sdk.ts - About 1 hr to fix

      Function extractFieldsFormatInfo has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          static extractFieldsFormatInfo(spec: GPLSpec) {
      
              var specScales = spec.scales;
      
              var isEmptyScale = function (key: string) {
      Severity: Minor
      Found in src/plugins-sdk.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 depthFirstSearch has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          static depthFirstSearch(node, predicate) {
      
              if (predicate(node)) {
                  return node;
              }
      Severity: Minor
      Found in src/plugins-sdk.ts - About 55 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

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

                  if (config.type === 'COORDS.RECT' && config.hasOwnProperty('x') && !isEmptyScale(config.x)) {
                      fillSlot(memo, config, 'x');
                  }
      Severity: Minor
      Found in src/plugins-sdk.ts and 1 other location - About 45 mins to fix
      src/plugins-sdk.ts on lines 134..136

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 50.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

                  if (config.type === 'COORDS.RECT' && config.hasOwnProperty('y') && !isEmptyScale(config.y)) {
                      fillSlot(memo, config, 'y');
                  }
      Severity: Minor
      Found in src/plugins-sdk.ts and 1 other location - About 45 mins to fix
      src/plugins-sdk.ts on lines 130..132

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 50.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

              var specScales = spec.scales;
      Severity: Minor
      Found in src/plugins-sdk.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 nonVal = memo[k].nullAlias;
      Severity: Minor
      Found in src/plugins-sdk.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

              for (var f = 0; f < frames.length; f++) {
      Severity: Minor
      Found in src/plugins-sdk.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 guideLabel = (guide.label || {}) as AxisLabelGuide;
      Severity: Minor
      Found in src/plugins-sdk.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 fnForm = format ?
      Severity: Minor
      Found in src/plugins-sdk.ts by tslint

      Rule: no-var-keyword

      Disallows usage of the var keyword.

      Use let or const instead.

      Rationale

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

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

      Notes
      • Has Fix

      Config

      Not configurable.

      Examples
      "no-var-keyword": true

      For more information see this page.

      non-arrow functions are forbidden
      Open

                  .reduce(function (memo, k) {
      Severity: Minor
      Found in src/plugins-sdk.ts by tslint

      Rule: only-arrow-functions

      Disallows traditional (non-arrow) function expressions.

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

      Rationale

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

      Config

      Two arguments may be optionally provided:

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

      For more information see this page.

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

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

                  var guide: ScaleGuide = GUIDE[key] || {};
      Severity: Minor
      Found in src/plugins-sdk.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

                  info[k] = Object.assign(
                      ({label: k, nullAlias: ('No ' + k)}),
                      (info[k] || {}),
                      (utils.pick(fmt, 'label', 'nullAlias'))) as any;
      Severity: Minor
      Found in src/plugins-sdk.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.

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

                          var kc = k.replace(('.' + memo[k].tickLabel), '');
      Severity: Minor
      Found in src/plugins-sdk.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 scale = specScales[config[key]];
      Severity: Minor
      Found in src/plugins-sdk.ts by tslint

      Rule: no-var-keyword

      Disallows usage of the var keyword.

      Use let or const instead.

      Rationale

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

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

      Notes
      • Has Fix

      Config

      Not configurable.

      Examples
      "no-var-keyword": true

      For more information see this page.

      non-arrow functions are forbidden
      Open

              var fillSlot = function (memoRef: RawDimMap, config: SpecUnit, key: string) {
      Severity: Minor
      Found in src/plugins-sdk.ts by tslint

      Rule: only-arrow-functions

      Disallows traditional (non-arrow) function expressions.

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

      Rationale

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

      Config

      Two arguments may be optionally provided:

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

      For more information see this page.

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

                  var label = guide.label;
      Severity: Minor
      Found in src/plugins-sdk.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 parent = null;
      Severity: Minor
      Found in src/plugins-sdk.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.

      Expected method shorthand in object literal ('{get() {...}}').
      Open

                  get: function (key) {
      Severity: Minor
      Found in src/plugins-sdk.ts by tslint

      Rule: object-literal-shorthand

      Enforces/disallows use of ES6 object literal shorthand.

      Notes
      • Has Fix

      Config

      "always" assumed to be default option, thus with no options provided the rule enforces object literal methods and properties shorthands. With "never" option provided, any shorthand object literal syntax causes an error.

      The rule can be configured in a more granular way. With {"property": "never"} provided (which is equivalent to {"property": "never", "method": "always"}), the rule only flags property shorthand assignments, and respectively with {"method": "never"} (equivalent to {"property": "always", "method": "never"}), the rule fails only on method shorthands.

      Examples
      "object-literal-shorthand": true
      "object-literal-shorthand": true,never
      "object-literal-shorthand": true,[object Object]
      Schema
      {
        "oneOf": [
          {
            "type": "string",
            "enum": [
              "never"
            ]
          },
          {
            "type": "object",
            "properties": {
              "property": {
                "type": "string",
                "enum": [
                  "never"
                ]
              },
              "method": {
                "type": "string",
                "enum": [
                  "never"
                ]
              }
            },
            "minProperties": 1,
            "maxProperties": 2
          }
        ]
      }

      For more information see this page.

      non-arrow functions are forbidden
      Open

              var isEmptyScale = function (key: string) {
      Severity: Minor
      Found in src/plugins-sdk.ts by tslint

      Rule: only-arrow-functions

      Disallows traditional (non-arrow) function expressions.

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

      Rationale

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

      Config

      Two arguments may be optionally provided:

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

      For more information see this page.

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

              var configs: SpecUnit[] = [];
      Severity: Minor
      Found in src/plugins-sdk.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 configs: SpecUnit[] = [];
      Severity: Minor
      Found in src/plugins-sdk.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 'summary' is never reassigned; use 'const' instead of 'var'.
      Open

              var summary = configs.reduce(function (memo, config) {
      Severity: Minor
      Found in src/plugins-sdk.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 'scale' is never reassigned; use 'const' instead of 'var'.
      Open

                  var scale = specScales[config[key]];
      Severity: Minor
      Found in src/plugins-sdk.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 format = guide.tickFormat || guide.tickPeriod;
      Severity: Minor
      Found in src/plugins-sdk.ts by tslint

      Rule: no-var-keyword

      Disallows usage of the var keyword.

      Use let or const instead.

      Rationale

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

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

      Notes
      • Has Fix

      Config

      Not configurable.

      Examples
      "no-var-keyword": true

      For more information see this page.

      non-arrow functions are forbidden
      Open

                              format: function (obj) {
      Severity: Minor
      Found in src/plugins-sdk.ts by tslint

      Rule: only-arrow-functions

      Disallows traditional (non-arrow) function expressions.

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

      Rationale

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

      Config

      Two arguments may be optionally provided:

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

      For more information see this page.

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

                      var found = PluginsSDK.depthFirstSearch(children[i], predicate);
      Severity: Minor
      Found in src/plugins-sdk.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 'isEmptyScale' is never reassigned; use 'const' instead of 'var'.
      Open

              var isEmptyScale = function (key: string) {
      Severity: Minor
      Found in src/plugins-sdk.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

                      memo[k] = {} as DimInfo;
      Severity: Minor
      Found in src/plugins-sdk.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 frames = node.hasOwnProperty('frames') ? node.frames : [{units: node.units}];
      Severity: Minor
      Found in src/plugins-sdk.ts by tslint

      Rule: no-var-keyword

      Disallows usage of the var keyword.

      Use let or const instead.

      Rationale

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

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

      Notes
      • Has Fix

      Config

      Not configurable.

      Examples
      "no-var-keyword": true

      For more information see this page.

      non-arrow functions are forbidden
      Open

              var choiceRule = function (arr: string[], defaultValue: string) {
      Severity: Minor
      Found in src/plugins-sdk.ts by tslint

      Rule: only-arrow-functions

      Disallows traditional (non-arrow) function expressions.

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

      Rationale

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

      Config

      Two arguments may be optionally provided:

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

      For more information see this page.

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

                  var children = frames[f].units || [];
      Severity: Minor
      Found in src/plugins-sdk.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 'GUIDE' is never reassigned; use 'const' instead of 'var'.
      Open

                  var GUIDE = config.guide || {};
      Severity: Minor
      Found in src/plugins-sdk.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 'nonVal' is never reassigned; use 'const' instead of 'var'.
      Open

                      var nonVal = memo[k].nullAlias;
      Severity: Minor
      Found in src/plugins-sdk.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 'fnForm' is never reassigned; use 'const' instead of 'var'.
      Open

                      var fnForm = format ?
      Severity: Minor
      Found in src/plugins-sdk.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 'fillSlot' is never reassigned; use 'const' instead of 'var'.
      Open

              var fillSlot = function (memoRef: RawDimMap, config: SpecUnit, key: string) {
      Severity: Minor
      Found in src/plugins-sdk.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 isEmptyScale = function (key: string) {
      Severity: Minor
      Found in src/plugins-sdk.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 fillSlot = function (memoRef: RawDimMap, config: SpecUnit, key: string) {
      Severity: Minor
      Found in src/plugins-sdk.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 'specScales' is never reassigned; use 'const' instead of 'var'.
      Open

              var specScales = spec.scales;
      Severity: Minor
      Found in src/plugins-sdk.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 customTokens = {};
      Severity: Minor
      Found in src/plugins-sdk.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

                  }, {} as DimMap);
      Severity: Minor
      Found in src/plugins-sdk.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 found = PluginsSDK.depthFirstSearch(children[i], predicate);
      Severity: Minor
      Found in src/plugins-sdk.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 GUIDE = config.guide || {};
      Severity: Minor
      Found in src/plugins-sdk.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 guide: ScaleGuide = GUIDE[key] || {};
      Severity: Minor
      Found in src/plugins-sdk.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 summary = configs.reduce(function (memo, config) {
      Severity: Minor
      Found in src/plugins-sdk.ts by tslint

      Rule: no-var-keyword

      Disallows usage of the var keyword.

      Use let or const instead.

      Rationale

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

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

      Notes
      • Has Fix

      Config

      Not configurable.

      Examples
      "no-var-keyword": true

      For more information see this page.

      non-arrow functions are forbidden
      Open

              var summary = configs.reduce(function (memo, config) {
      Severity: Minor
      Found in src/plugins-sdk.ts by tslint

      Rule: only-arrow-functions

      Disallows traditional (non-arrow) function expressions.

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

      Rationale

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

      Config

      Two arguments may be optionally provided:

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

      For more information see this page.

      non-arrow functions are forbidden
      Open

                  get: function (key) {
      Severity: Minor
      Found in src/plugins-sdk.ts by tslint

      Rule: only-arrow-functions

      Disallows traditional (non-arrow) function expressions.

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

      Rationale

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

      Config

      Two arguments may be optionally provided:

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

      For more information see this page.

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

              }, {} as RawDimMap);
      Severity: Minor
      Found in src/plugins-sdk.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

                  for (var i = 0; i < children.length; i++) {
      Severity: Minor
      Found in src/plugins-sdk.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 kc = k.replace(('.' + memo[k].tickLabel), '');
      Severity: Minor
      Found in src/plugins-sdk.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 'choiceRule' is never reassigned; use 'const' instead of 'var'.
      Open

              var choiceRule = function (arr: string[], defaultValue: string) {
      Severity: Minor
      Found in src/plugins-sdk.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.

      Expected method shorthand in object literal ('{format() {...}}').
      Open

                              format: function (obj) {
      Severity: Minor
      Found in src/plugins-sdk.ts by tslint

      Rule: object-literal-shorthand

      Enforces/disallows use of ES6 object literal shorthand.

      Notes
      • Has Fix

      Config

      "always" assumed to be default option, thus with no options provided the rule enforces object literal methods and properties shorthands. With "never" option provided, any shorthand object literal syntax causes an error.

      The rule can be configured in a more granular way. With {"property": "never"} provided (which is equivalent to {"property": "never", "method": "always"}), the rule only flags property shorthand assignments, and respectively with {"method": "never"} (equivalent to {"property": "always", "method": "never"}), the rule fails only on method shorthands.

      Examples
      "object-literal-shorthand": true
      "object-literal-shorthand": true,never
      "object-literal-shorthand": true,[object Object]
      Schema
      {
        "oneOf": [
          {
            "type": "string",
            "enum": [
              "never"
            ]
          },
          {
            "type": "object",
            "properties": {
              "property": {
                "type": "string",
                "enum": [
                  "never"
                ]
              },
              "method": {
                "type": "string",
                "enum": [
                  "never"
                ]
              }
            },
            "minProperties": 1,
            "maxProperties": 2
          }
        ]
      }

      For more information see this page.

      non-arrow functions are forbidden
      Open

              PluginsSDK.traverseSpec(spec, function (node) {
      Severity: Minor
      Found in src/plugins-sdk.ts by tslint

      Rule: only-arrow-functions

      Disallows traditional (non-arrow) function expressions.

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

      Rationale

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

      Config

      Two arguments may be optionally provided:

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

      For more information see this page.

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

                  var format = guide.tickFormat || guide.tickPeriod;
      Severity: Minor
      Found in src/plugins-sdk.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.

      Expected a 'for-of' loop instead of a 'for' loop with this simple iteration
      Open

              for (var f = 0; f < frames.length; f++) {
      Severity: Minor
      Found in src/plugins-sdk.ts by tslint

      Rule: prefer-for-of

      Recommends a 'for-of' loop over a standard 'for' loop if the index is only used to access the array being iterated.

      Rationale

      A for(... of ...) loop is easier to implement and read when the index is not needed.

      Config

      Not configurable.

      Examples
      "prefer-for-of": true

      For more information see this page.

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

                  var children = frames[f].units || [];
      Severity: Minor
      Found in src/plugins-sdk.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 label = guide.label;
      Severity: Minor
      Found in src/plugins-sdk.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 choiceRule = function (arr: string[], defaultValue: string) {
      Severity: Minor
      Found in src/plugins-sdk.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.

      Expected method shorthand in object literal ('{reg() {...}}').
      Open

                  reg: function (key, val) {
      Severity: Minor
      Found in src/plugins-sdk.ts by tslint

      Rule: object-literal-shorthand

      Enforces/disallows use of ES6 object literal shorthand.

      Notes
      • Has Fix

      Config

      "always" assumed to be default option, thus with no options provided the rule enforces object literal methods and properties shorthands. With "never" option provided, any shorthand object literal syntax causes an error.

      The rule can be configured in a more granular way. With {"property": "never"} provided (which is equivalent to {"property": "never", "method": "always"}), the rule only flags property shorthand assignments, and respectively with {"method": "never"} (equivalent to {"property": "always", "method": "never"}), the rule fails only on method shorthands.

      Examples
      "object-literal-shorthand": true
      "object-literal-shorthand": true,never
      "object-literal-shorthand": true,[object Object]
      Schema
      {
        "oneOf": [
          {
            "type": "string",
            "enum": [
              "never"
            ]
          },
          {
            "type": "object",
            "properties": {
              "property": {
                "type": "string",
                "enum": [
                  "never"
                ]
              },
              "method": {
                "type": "string",
                "enum": [
                  "never"
                ]
              }
            },
            "minProperties": 1,
            "maxProperties": 2
          }
        ]
      }

      For more information see this page.

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

              var frames = node.hasOwnProperty('frames') ? node.frames : [{units: node.units}];
      Severity: Minor
      Found in src/plugins-sdk.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 'guideLabel' is never reassigned; use 'const' instead of 'var'.
      Open

                  var guideLabel = (guide.label || {}) as AxisLabelGuide;
      Severity: Minor
      Found in src/plugins-sdk.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.

      Expected a 'for-of' loop instead of a 'for' loop with this simple iteration
      Open

                  for (var i = 0; i < children.length; i++) {
      Severity: Minor
      Found in src/plugins-sdk.ts by tslint

      Rule: prefer-for-of

      Recommends a 'for-of' loop over a standard 'for' loop if the index is only used to access the array being iterated.

      Rationale

      A for(... of ...) loop is easier to implement and read when the index is not needed.

      Config

      Not configurable.

      Examples
      "prefer-for-of": true

      For more information see this page.

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

                  let res = {} as Pair;
      Severity: Minor
      Found in src/plugins-sdk.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.

      There are no issues that match your filters.

      Category
      Status