umts/pvta-multiplatform

View on GitHub
src/app/ga.ts

Summary

Maintainability
A
0 mins
Test Coverage

Do not use comma operator here because it can be easily misunderstood or lead to unintended bugs.
Open

  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*currdate;a=s.createElement(o),
Severity: Minor
Found in src/app/ga.ts by tslint

Rule: ban-comma-operator

Disallows the comma operator to be used.

Read more about the comma operator here.

Rationale

Using the comma operator can create a potential for many non-obvious bugs or lead to misunderstanding of code.

Examples

foo((bar, baz)); // evaluates to 'foo(baz)' because of the extra parens - confusing and not obvious
switch (foo) {
    case 1, 2: // equals 'case 2' - probably intended 'case 1: case2:'
        return true;
    case 3:
        return false;
}
let x = (y = 1, z = 2); // x is equal to 2 - this may not be immediately obvious.
Examples
"ban-comma-operator": true

For more information see this page.

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

  var currdate: any = new Date();
Severity: Minor
Found in src/app/ga.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

export var gaElems: any = {};
Severity: Minor
Found in src/app/ga.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.

missing whitespace
Open

  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
Severity: Minor
Found in src/app/ga.ts by tslint

Rule: one-line

Requires the specified tokens to be on the same line as the expression preceding them.

Notes
  • Has Fix

Config

Five arguments may be optionally provided:

  • "check-catch" checks that catch is on the same line as the closing brace for try.
  • "check-finally" checks that finally is on the same line as the closing brace for catch.
  • "check-else" checks that else is on the same line as the closing brace for if.
  • "check-open-brace" checks that an open brace falls on the same line as its preceding expression.
  • "check-whitespace" checks preceding whitespace for the specified tokens.
Examples
"one-line": true,check-catch,check-finally,check-else
Schema
{
  "type": "array",
  "items": {
    "type": "string",
    "enum": [
      "check-catch",
      "check-finally",
      "check-else",
      "check-open-brace",
      "check-whitespace"
    ]
  },
  "minLength": 0,
  "maxLength": 5
}

For more information see this page.

Do not use comma operator here because it can be easily misunderstood or lead to unintended bugs.
Open

  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*currdate;a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
Severity: Minor
Found in src/app/ga.ts by tslint

Rule: ban-comma-operator

Disallows the comma operator to be used.

Read more about the comma operator here.

Rationale

Using the comma operator can create a potential for many non-obvious bugs or lead to misunderstanding of code.

Examples

foo((bar, baz)); // evaluates to 'foo(baz)' because of the extra parens - confusing and not obvious
switch (foo) {
    case 1, 2: // equals 'case 2' - probably intended 'case 1: case2:'
        return true;
    case 3:
        return false;
}
let x = (y = 1, z = 2); // x is equal to 2 - this may not be immediately obvious.
Examples
"ban-comma-operator": true

For more information see this page.

missing whitespace
Open

  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
Severity: Minor
Found in src/app/ga.ts by tslint

Rule: one-line

Requires the specified tokens to be on the same line as the expression preceding them.

Notes
  • Has Fix

Config

Five arguments may be optionally provided:

  • "check-catch" checks that catch is on the same line as the closing brace for try.
  • "check-finally" checks that finally is on the same line as the closing brace for catch.
  • "check-else" checks that else is on the same line as the closing brace for if.
  • "check-open-brace" checks that an open brace falls on the same line as its preceding expression.
  • "check-whitespace" checks preceding whitespace for the specified tokens.
Examples
"one-line": true,check-catch,check-finally,check-else
Schema
{
  "type": "array",
  "items": {
    "type": "string",
    "enum": [
      "check-catch",
      "check-finally",
      "check-else",
      "check-open-brace",
      "check-whitespace"
    ]
  },
  "minLength": 0,
  "maxLength": 5
}

For more information see this page.

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

export var gaNewElem: any = {};
Severity: Minor
Found in src/app/ga.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 currdate: any = new Date();
Severity: Minor
Found in src/app/ga.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.

There are no issues that match your filters.

Category
Status