toggle-corp/react-rest-request

View on GitHub

Showing 27 of 27 total issues

Missing trailing comma
Open

                `Trying to start aborted request: ${urlValue}`, parameters
Severity: Minor
Found in src/RestRequest.ts by tslint

Rule: trailing-comma

Requires or disallows trailing commas in array and object literals, destructuring assignments, function typings, named imports and exports and function parameters.

Notes
  • Has Fix

Config

One argument which is an object with the keys multiline and singleline. Both can be set to a string ("always" or "never") or an object.

The object can contain any of the following keys: "arrays", "objects", "functions", "imports", "exports", and "typeLiterals"; each key can have one of the following values: "always", "never", and "ignore". Any missing keys will default to "ignore".

  • "multiline" checks multi-line object literals.
  • "singleline" checks single-line object literals.

An array is considered "multiline" if its closing bracket is on a line after the last array element. The same general logic is followed for object literals, function typings, named import statements and function parameters.

To align this rule with the ECMAScript specification that is implemented in modern JavaScript VMs, there is a third option esSpecCompliant. Set this option to true to disallow trailing comma on object and array rest and rest parameters.

Examples
"trailing-comma": true,[object Object]
"trailing-comma": true,[object Object]
Schema
{
  "type": "object",
  "properties": {
    "multiline": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "always",
            "never"
          ]
        },
        {
          "type": "object",
          "properties": {
            "arrays": {
              "type": "string",
              "enum": [
                "always",
                "never",
                "ignore"
              ]
            },
            "exports": {
              "type": "string",
              "enum": [
                "always",
                "never",
                "ignore"
              ]
            },
            "functions": {
              "type": "string",
              "enum": [
                "always",
                "never",
                "ignore"
              ]
            },
            "imports": {
              "type": "string",
              "enum": [
                "always",
                "never",
                "ignore"
              ]
            },
            "objects": {
              "type": "string",
              "enum": [
                "always",
                "never",
                "ignore"
              ]
            },
            "typeLiterals": {
              "type": "string",
              "enum": [
                "always",
                "never",
                "ignore"
              ]
            }
          }
        }
      ]
    },
    "singleline": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "always",
            "never"
          ]
        },
        {
          "type": "object",
          "properties": {
            "arrays": {
              "type": "string",
              "enum": [
                "always",
                "never",
                "ignore"
              ]
            },
            "exports": {
              "type": "string",
              "enum": [
                "always",
                "never",
                "ignore"
              ]
            },
            "functions": {
              "type": "string",
              "enum": [
                "always",
                "never",
                "ignore"
              ]
            },
            "imports": {
              "type": "string",
              "enum": [
                "always",
                "never",
                "ignore"
              ]
            },
            "objects": {
              "type": "string",
              "enum": [
                "always",
                "never",
                "ignore"
              ]
            },
            "typeLiterals": {
              "type": "string",
              "enum": [
                "always",
                "never",
                "ignore"
              ]
            }
          }
        }
      ]
    },
    "esSpecCompliant": {
      "type": "boolean"
    }
  },
  "additionalProperties": false
}

For more information see this page.

Don't assign members of this to local variables.
Open

            const { state } = this;
Severity: Minor
Found in src/RequestCoordinator.tsx by tslint

Rule: no-this-assignment

Disallows unnecessary references to this.

Rationale

Assigning a variable to this instead of properly using arrow lambdas may be a symptom of pre-ES6 practices or not managing scope well.

Instead of storing a reference to this and using it inside a function () {:

const self = this;

setTimeout(function () {
    self.doWork();
});

Use () => arrow lambdas, as they preserve this scope for you:

setTimeout(() => {
    this.doWork();
});

Config

Two options may be provided on an object:

  • allow-destructuring allows using destructuring to access members of this (e.g. { foo, bar } = this;).
  • allowed-names may be specified as a list of regular expressions to match allowed variable names.
Examples
"no-this-assignment": true
"no-this-assignment": true,[object Object]
Schema
{
  "additionalProperties": false,
  "properties": {
    "allow-destructuring": {
      "type": "boolean"
    },
    "allowed-names": {
      "listType": "string",
      "type": "list"
    }
  },
  "type": "object"
}

For more information see this page.

Missing trailing comma
Open

                `Max polls exceeded: ${urlValue}`, parameters
Severity: Minor
Found in src/RestRequest.ts by tslint

Rule: trailing-comma

Requires or disallows trailing commas in array and object literals, destructuring assignments, function typings, named imports and exports and function parameters.

Notes
  • Has Fix

Config

One argument which is an object with the keys multiline and singleline. Both can be set to a string ("always" or "never") or an object.

The object can contain any of the following keys: "arrays", "objects", "functions", "imports", "exports", and "typeLiterals"; each key can have one of the following values: "always", "never", and "ignore". Any missing keys will default to "ignore".

  • "multiline" checks multi-line object literals.
  • "singleline" checks single-line object literals.

An array is considered "multiline" if its closing bracket is on a line after the last array element. The same general logic is followed for object literals, function typings, named import statements and function parameters.

To align this rule with the ECMAScript specification that is implemented in modern JavaScript VMs, there is a third option esSpecCompliant. Set this option to true to disallow trailing comma on object and array rest and rest parameters.

Examples
"trailing-comma": true,[object Object]
"trailing-comma": true,[object Object]
Schema
{
  "type": "object",
  "properties": {
    "multiline": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "always",
            "never"
          ]
        },
        {
          "type": "object",
          "properties": {
            "arrays": {
              "type": "string",
              "enum": [
                "always",
                "never",
                "ignore"
              ]
            },
            "exports": {
              "type": "string",
              "enum": [
                "always",
                "never",
                "ignore"
              ]
            },
            "functions": {
              "type": "string",
              "enum": [
                "always",
                "never",
                "ignore"
              ]
            },
            "imports": {
              "type": "string",
              "enum": [
                "always",
                "never",
                "ignore"
              ]
            },
            "objects": {
              "type": "string",
              "enum": [
                "always",
                "never",
                "ignore"
              ]
            },
            "typeLiterals": {
              "type": "string",
              "enum": [
                "always",
                "never",
                "ignore"
              ]
            }
          }
        }
      ]
    },
    "singleline": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "always",
            "never"
          ]
        },
        {
          "type": "object",
          "properties": {
            "arrays": {
              "type": "string",
              "enum": [
                "always",
                "never",
                "ignore"
              ]
            },
            "exports": {
              "type": "string",
              "enum": [
                "always",
                "never",
                "ignore"
              ]
            },
            "functions": {
              "type": "string",
              "enum": [
                "always",
                "never",
                "ignore"
              ]
            },
            "imports": {
              "type": "string",
              "enum": [
                "always",
                "never",
                "ignore"
              ]
            },
            "objects": {
              "type": "string",
              "enum": [
                "always",
                "never",
                "ignore"
              ]
            },
            "typeLiterals": {
              "type": "string",
              "enum": [
                "always",
                "never",
                "ignore"
              ]
            }
          }
        }
      ]
    },
    "esSpecCompliant": {
      "type": "boolean"
    }
  },
  "additionalProperties": false
}

For more information see this page.

Exceeds maximum line length of 100
Open

                url: transformUrl ? transformUrl(preparedUrl, requestData, this.props) : preparedUrl,
Severity: Minor
Found in src/RequestCoordinator.tsx by tslint

Rule: max-line-length

Requires lines to be under a certain max length.

Rationale

Limiting the length of a line of code improves code readability. It also makes comparing code side-by-side easier and improves compatibility with various editors, IDEs, and diff viewers.

Config

It can take one argument, which can be any of the following: * integer indicating maximum length of lines. * object with keys: * limit - number greater than 0 defining the max line length * ignore-pattern - string defining ignore pattern for this rule, being parsed by new RegExp(). For example: * // pattern will ignore all in-line comments. * ^import pattern will ignore all import statements. * ^export {(.*?)} pattern will ignore all multiple export statements. * class [a-zA-Z]+ implements pattern will ignore all class declarations implementing interfaces. * ^import |^export {(.*?)}|class [a-zA-Z]+ implements |// pattern will ignore all the cases listed above. * check-strings - determines if strings should be checked, false by default. * check-regex - determines if regular expressions should be checked, false by default.

Examples
"max-line-length": true,120
"max-line-length": true,[object Object]
Schema
{
  "type": "array",
  "items": {
    "oneOf": [
      {
        "type": "number"
      },
      {
        "type": "object",
        "properties": {
          "limit": {
            "type": "number"
          },
          "ignore-pattern": {
            "type": "string"
          },
          "check-strings": {
            "type": "boolean"
          },
          "check-regex": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      }
    ]
  },
  "minLength": 1,
  "maxLength": 2
}

For more information see this page.

variable name must be in lowerCamelCase or UPPER_CASE
Open

export const RequestHandler = createRequestClient(requests)(HandlerComponent);
Severity: Minor
Found in src/RequestHandler.tsx by tslint

Rule: variable-name

Checks variable names for various errors.

Config

Several arguments may be optionally provided:

  • "check-format" enbables enforcement of a certain naming format. By default, the rule only allows only lowerCamelCased or UPPER_CASED variable names.
    • These additional options make the check stricter:
    • "require-const-for-all-caps": enforces that all variables with UPPER_CASED names should be const.
    • These additional options make the check more permissive:
    • "allow-leading-underscore" allows underscores at the beginning (only has an effect if "check-format" specified)
    • "allow-pascal-case" allows PascalCase in addition to lowerCamelCase.
    • "allow-snake-case" allows snake_case in addition to lowerCamelCase.
    • "allow-trailing-underscore" allows underscores at the end. (only has an effect if "check-format" specified)
  • "ban-keywords": disallows the use of certain TypeScript keywords as variable or parameter names.
    • These are: any, Number, number, String, string, Boolean, boolean, Undefined, undefined
Examples
"variable-name": [object Object]
Schema
{
  "type": "array",
  "items": {
    "type": "string",
    "enum": [
      "check-format",
      "allow-leading-underscore",
      "allow-pascal-case",
      "allow-snake-case",
      "allow-trailing-underscore",
      "require-const-for-all-caps",
      "ban-keywords"
    ]
  },
  "minLength": 0,
  "maxLength": 6
}

For more information see this page.

Missing trailing comma
Open

                `Trying to start running request: ${urlValue}`, parameters
Severity: Minor
Found in src/RestRequest.ts by tslint

Rule: trailing-comma

Requires or disallows trailing commas in array and object literals, destructuring assignments, function typings, named imports and exports and function parameters.

Notes
  • Has Fix

Config

One argument which is an object with the keys multiline and singleline. Both can be set to a string ("always" or "never") or an object.

The object can contain any of the following keys: "arrays", "objects", "functions", "imports", "exports", and "typeLiterals"; each key can have one of the following values: "always", "never", and "ignore". Any missing keys will default to "ignore".

  • "multiline" checks multi-line object literals.
  • "singleline" checks single-line object literals.

An array is considered "multiline" if its closing bracket is on a line after the last array element. The same general logic is followed for object literals, function typings, named import statements and function parameters.

To align this rule with the ECMAScript specification that is implemented in modern JavaScript VMs, there is a third option esSpecCompliant. Set this option to true to disallow trailing comma on object and array rest and rest parameters.

Examples
"trailing-comma": true,[object Object]
"trailing-comma": true,[object Object]
Schema
{
  "type": "object",
  "properties": {
    "multiline": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "always",
            "never"
          ]
        },
        {
          "type": "object",
          "properties": {
            "arrays": {
              "type": "string",
              "enum": [
                "always",
                "never",
                "ignore"
              ]
            },
            "exports": {
              "type": "string",
              "enum": [
                "always",
                "never",
                "ignore"
              ]
            },
            "functions": {
              "type": "string",
              "enum": [
                "always",
                "never",
                "ignore"
              ]
            },
            "imports": {
              "type": "string",
              "enum": [
                "always",
                "never",
                "ignore"
              ]
            },
            "objects": {
              "type": "string",
              "enum": [
                "always",
                "never",
                "ignore"
              ]
            },
            "typeLiterals": {
              "type": "string",
              "enum": [
                "always",
                "never",
                "ignore"
              ]
            }
          }
        }
      ]
    },
    "singleline": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "always",
            "never"
          ]
        },
        {
          "type": "object",
          "properties": {
            "arrays": {
              "type": "string",
              "enum": [
                "always",
                "never",
                "ignore"
              ]
            },
            "exports": {
              "type": "string",
              "enum": [
                "always",
                "never",
                "ignore"
              ]
            },
            "functions": {
              "type": "string",
              "enum": [
                "always",
                "never",
                "ignore"
              ]
            },
            "imports": {
              "type": "string",
              "enum": [
                "always",
                "never",
                "ignore"
              ]
            },
            "objects": {
              "type": "string",
              "enum": [
                "always",
                "never",
                "ignore"
              ]
            },
            "typeLiterals": {
              "type": "string",
              "enum": [
                "always",
                "never",
                "ignore"
              ]
            }
          }
        }
      ]
    },
    "esSpecCompliant": {
      "type": "boolean"
    }
  },
  "additionalProperties": false
}

For more information see this page.

TODO found
Open

                        // TODO: resolve other methods as well
Severity: Minor
Found in src/RequestClient.tsx by fixme
Severity
Category
Status
Source
Language