kleros/kleros-v2

View on GitHub
contracts/scripts/utils/logger.ts

Summary

Maintainability
A
0 mins
Test Coverage

Expected property shorthand in object literal ('{targets}').
Open

      pino.transport({ targets: targets })
Severity: Minor
Found in contracts/scripts/utils/logger.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.

Multiple imports from 'pino' can be combined into one.
Open

import { TransportTargetOptions } from "pino";
Severity: Minor
Found in contracts/scripts/utils/logger.ts by tslint

Rule: no-duplicate-imports

Disallows multiple import statements from the same module.

Rationale

Using a single import statement per module will make the code clearer because you can see everything being imported from that module on one line.

Config

"allow-namespace-imports" allows you to import namespaces on separate lines.

Examples
"no-duplicate-imports": true,[object Object]
Schema
{
  "type": "object",
  "properties": {
    "allow-namespace-imports": {
      "type": "boolean"
    }
  }
}

For more information see this page.

'namespace' and 'module' are disallowed
Open

namespace logger {
  export type LoggerOptions = {
    level?: string;
    transportTargetOptions?: TransportTargetOptions;
  };
Severity: Minor
Found in contracts/scripts/utils/logger.ts by tslint

Rule: no-namespace

Disallows use of internal modules and namespaces.

This rule still allows the use of declare module ... {}

Rationale

ES6-style external modules are the standard way to modularize code. Using module {} and namespace {} are outdated ways to organize TypeScript code.

Notes
  • TypeScript Only

Config

One argument may be optionally provided:

  • allow-declarations allows declare namespace ... {} to describe external APIs.
Examples
"no-namespace": true
"no-namespace": true,allow-declarations
Schema
{
  "type": "array",
  "items": {
    "type": "string",
    "enum": [
      "allow-declarations"
    ]
  },
  "minLength": 0,
  "maxLength": 1
}

For more information see this page.

There are no issues that match your filters.

Category
Status