k3nsei/ng-in-viewport

View on GitHub
jest-global-mocks.ts

Summary

Maintainability
A
0 mins
Test Coverage

== should be ===
Open

        return (c == 'x' ? r : (r & 0x3) | 0x8).toString(16);
Severity: Minor
Found in jest-global-mocks.ts by tslint

Rule: triple-equals

Requires === and !== in place of == and !=.

Config

Two arguments may be optionally provided:

  • "allow-null-check" allows == and != when comparing to null.
  • "allow-undefined-check" allows == and != when comparing to undefined.
Examples
"triple-equals": true
"triple-equals": true,allow-null-check
"triple-equals": true,allow-undefined-check
Schema
{
  "type": "array",
  "items": {
    "type": "string",
    "enum": [
      "allow-null-check",
      "allow-undefined-check"
    ]
  },
  "minLength": 0,
  "maxLength": 2
}

For more information see this page.

Forbidden bitwise operation
Open

        return (c == 'x' ? r : (r & 0x3) | 0x8).toString(16);
Severity: Minor
Found in jest-global-mocks.ts by tslint

Rule: no-bitwise

Disallows bitwise operators.

Specifically, the following bitwise operators are banned: &, &=, |, |=, ^, ^=, <<, <<=, >>, >>=, >>>, >>>=, and ~. This rule does not ban the use of & and | for intersection and union types.

Rationale

Bitwise operators are often typos - for example bool1 & bool2 instead of bool1 && bool2. They also can be an indicator of overly clever code which decreases maintainability.

Config

Not configurable.

Examples
"no-bitwise": true

For more information see this page.

Forbidden bitwise operation
Open

        return (c == 'x' ? r : (r & 0x3) | 0x8).toString(16);
Severity: Minor
Found in jest-global-mocks.ts by tslint

Rule: no-bitwise

Disallows bitwise operators.

Specifically, the following bitwise operators are banned: &, &=, |, |=, ^, ^=, <<, <<=, >>, >>=, >>>, >>>=, and ~. This rule does not ban the use of & and | for intersection and union types.

Rationale

Bitwise operators are often typos - for example bool1 & bool2 instead of bool1 && bool2. They also can be an indicator of overly clever code which decreases maintainability.

Config

Not configurable.

Examples
"no-bitwise": true

For more information see this page.

non-arrow functions are forbidden
Open

      return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
Severity: Minor
Found in jest-global-mocks.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.

Forbidden bitwise operation
Open

        const r = (dt + Math.random() * 16) % 16 | 0;
Severity: Minor
Found in jest-global-mocks.ts by tslint

Rule: no-bitwise

Disallows bitwise operators.

Specifically, the following bitwise operators are banned: &, &=, |, |=, ^, ^=, <<, <<=, >>, >>=, >>>, >>>=, and ~. This rule does not ban the use of & and | for intersection and union types.

Rationale

Bitwise operators are often typos - for example bool1 & bool2 instead of bool1 && bool2. They also can be an indicator of overly clever code which decreases maintainability.

Config

Not configurable.

Examples
"no-bitwise": true

For more information see this page.

There are no issues that match your filters.

Category
Status