tkqubo/conditional-decorator

View on GitHub

Showing 139 of 139 total issues

expected variable-declaration: 'instanceMethodSpy7' to have a typedef
Open

const instanceMethodSpy7 = sinon.spy();

Rule: typedef

Requires type definitions to exist.

Notes
  • TypeScript Only

Config

Several arguments may be optionally provided:

  • "call-signature" checks return type of functions.
  • "arrow-call-signature" checks return type of arrow functions.
  • "parameter" checks type specifier of function parameters for non-arrow functions.
  • "arrow-parameter" checks type specifier of function parameters for arrow functions.
  • "property-declaration" checks return types of interface properties.
  • "variable-declaration" checks non-binding variable declarations.
  • "variable-declaration-ignore-function" ignore variable declarations for non-arrow and arrow functions.
  • "member-variable-declaration" checks member variable declarations.
  • "object-destructuring" checks object destructuring declarations.
  • "array-destructuring" checks array destructuring declarations.
Examples
"typedef": true,call-signature,parameter,member-variable-declaration
Schema
{
  "type": "array",
  "items": {
    "type": "string",
    "enum": [
      "call-signature",
      "arrow-call-signature",
      "parameter",
      "arrow-parameter",
      "property-declaration",
      "variable-declaration",
      "variable-declaration-ignore-function",
      "member-variable-declaration",
      "object-destructuring",
      "array-destructuring"
    ]
  },
  "minLength": 0,
  "maxLength": 10
}

For more information see this page.

The class method 'methodNg' must be marked either 'private', 'public', or 'protected'
Open

  methodNg(@conditional(testParameter, decor5) param1: number,

Rule: member-access

Requires explicit visibility declarations for class members.

Rationale

Explicit visibility declarations can make code more readable and accessible for those new to TS.

Other languages such as C# default to private, unlike TypeScript's default of public. Members lacking a visibility declaration may be an indication of an accidental leak of class internals.

Notes
  • TypeScript Only
  • Has Fix

Config

These arguments may be optionally provided:

  • "no-public" forbids public accessibility to be specified, because this is the default.
  • "check-accessor" enforces explicit visibility on get/set accessors
  • "check-constructor" enforces explicit visibility on constructors
  • "check-parameter-property" enforces explicit visibility on parameter properties
Examples
"member-access": true
"member-access": true,no-public
"member-access": true,check-accessor
Schema
{
  "type": "array",
  "items": {
    "type": "string",
    "enum": [
      "no-public",
      "check-accessor",
      "check-constructor",
      "check-parameter-property"
    ]
  },
  "minLength": 0,
  "maxLength": 4
}

For more information see this page.

The class property 'prop' must be marked either 'private', 'public', or 'protected'
Open

  prop: any;
Severity: Minor
Found in test/utils.spec.ts by tslint

Rule: member-access

Requires explicit visibility declarations for class members.

Rationale

Explicit visibility declarations can make code more readable and accessible for those new to TS.

Other languages such as C# default to private, unlike TypeScript's default of public. Members lacking a visibility declaration may be an indication of an accidental leak of class internals.

Notes
  • TypeScript Only
  • Has Fix

Config

These arguments may be optionally provided:

  • "no-public" forbids public accessibility to be specified, because this is the default.
  • "check-accessor" enforces explicit visibility on get/set accessors
  • "check-constructor" enforces explicit visibility on constructors
  • "check-parameter-property" enforces explicit visibility on parameter properties
Examples
"member-access": true
"member-access": true,no-public
"member-access": true,check-accessor
Schema
{
  "type": "array",
  "items": {
    "type": "string",
    "enum": [
      "no-public",
      "check-accessor",
      "check-constructor",
      "check-parameter-property"
    ]
  },
  "minLength": 0,
  "maxLength": 4
}

For more information see this page.

Missing trailing comma
Open

      expected: [DecoratorType.Parameter]
Severity: Minor
Found in test/utils.spec.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.

expected variable-declaration: 'DecoratorTypes' to have a typedef
Open

const DecoratorTypes = [
Severity: Minor
Found in test/utils.spec.ts by tslint

Rule: typedef

Requires type definitions to exist.

Notes
  • TypeScript Only

Config

Several arguments may be optionally provided:

  • "call-signature" checks return type of functions.
  • "arrow-call-signature" checks return type of arrow functions.
  • "parameter" checks type specifier of function parameters for non-arrow functions.
  • "arrow-parameter" checks type specifier of function parameters for arrow functions.
  • "property-declaration" checks return types of interface properties.
  • "variable-declaration" checks non-binding variable declarations.
  • "variable-declaration-ignore-function" ignore variable declarations for non-arrow and arrow functions.
  • "member-variable-declaration" checks member variable declarations.
  • "object-destructuring" checks object destructuring declarations.
  • "array-destructuring" checks array destructuring declarations.
Examples
"typedef": true,call-signature,parameter,member-variable-declaration
Schema
{
  "type": "array",
  "items": {
    "type": "string",
    "enum": [
      "call-signature",
      "arrow-call-signature",
      "parameter",
      "arrow-parameter",
      "property-declaration",
      "variable-declaration",
      "variable-declaration-ignore-function",
      "member-variable-declaration",
      "object-destructuring",
      "array-destructuring"
    ]
  },
  "minLength": 0,
  "maxLength": 10
}

For more information see this page.

expected call-signature: 'invokeDecorator' to have a typedef
Open

function invokeDecorator(type: DecoratorType) {
Severity: Minor
Found in test/utils.spec.ts by tslint

Rule: typedef

Requires type definitions to exist.

Notes
  • TypeScript Only

Config

Several arguments may be optionally provided:

  • "call-signature" checks return type of functions.
  • "arrow-call-signature" checks return type of arrow functions.
  • "parameter" checks type specifier of function parameters for non-arrow functions.
  • "arrow-parameter" checks type specifier of function parameters for arrow functions.
  • "property-declaration" checks return types of interface properties.
  • "variable-declaration" checks non-binding variable declarations.
  • "variable-declaration-ignore-function" ignore variable declarations for non-arrow and arrow functions.
  • "member-variable-declaration" checks member variable declarations.
  • "object-destructuring" checks object destructuring declarations.
  • "array-destructuring" checks array destructuring declarations.
Examples
"typedef": true,call-signature,parameter,member-variable-declaration
Schema
{
  "type": "array",
  "items": {
    "type": "string",
    "enum": [
      "call-signature",
      "arrow-call-signature",
      "parameter",
      "arrow-parameter",
      "property-declaration",
      "variable-declaration",
      "variable-declaration-ignore-function",
      "member-variable-declaration",
      "object-destructuring",
      "array-destructuring"
    ]
  },
  "minLength": 0,
  "maxLength": 10
}

For more information see this page.

interface name must start with a capitalized I
Open

export interface ClassDecorator {
Severity: Minor
Found in src/utils.ts by tslint

Rule: interface-name

Requires interface names to begin with a capital 'I'

Rationale

Makes it easy to differentiate interfaces from regular classes at a glance.

Notes
  • TypeScript Only

Config

One of the following two options must be provided:

  • "always-prefix" requires interface names to start with an "I"
  • "never-prefix" requires interface names to not have an "I" prefix
Examples
"interface-name": true,always-prefix
"interface-name": true,never-prefix
Schema
{
  "type": "string",
  "enum": [
    "always-prefix",
    "never-prefix"
  ]
}

For more information see this page.

Use 'undefined' instead of 'null'
Open

      return null;

Rule: no-null-keyword

Disallows use of the null keyword literal.

Rationale

Instead of having the dual concepts of null andundefined in a codebase, this rule ensures that only undefined is used.

JavaScript originally intended undefined to refer to a value that doesn't yet exist, while null was meant to refer to a value that does exist but points to nothing. That's confusing. undefined is the default value when object members don't exist, and is the return value for newer native collection APIs such as Map.get when collection values don't exist.

const myObject = {};
myObject.doesNotExist; // undefined
const myMap = new Map<string number>();
myMap.get("doesNotExist"); // undefined</string>

To remove confusion over the two similar values, it's better to stick with just undefined.

Notes
  • Has Fix

Config

Not configurable.

Examples
"no-null-keyword": true

For more information see this page.

expected variable-declaration: 'instanceMethodSpy1' to have a typedef
Open

const instanceMethodSpy1 = sinon.spy();

Rule: typedef

Requires type definitions to exist.

Notes
  • TypeScript Only

Config

Several arguments may be optionally provided:

  • "call-signature" checks return type of functions.
  • "arrow-call-signature" checks return type of arrow functions.
  • "parameter" checks type specifier of function parameters for non-arrow functions.
  • "arrow-parameter" checks type specifier of function parameters for arrow functions.
  • "property-declaration" checks return types of interface properties.
  • "variable-declaration" checks non-binding variable declarations.
  • "variable-declaration-ignore-function" ignore variable declarations for non-arrow and arrow functions.
  • "member-variable-declaration" checks member variable declarations.
  • "object-destructuring" checks object destructuring declarations.
  • "array-destructuring" checks array destructuring declarations.
Examples
"typedef": true,call-signature,parameter,member-variable-declaration
Schema
{
  "type": "array",
  "items": {
    "type": "string",
    "enum": [
      "call-signature",
      "arrow-call-signature",
      "parameter",
      "arrow-parameter",
      "property-declaration",
      "variable-declaration",
      "variable-declaration-ignore-function",
      "member-variable-declaration",
      "object-destructuring",
      "array-destructuring"
    ]
  },
  "minLength": 0,
  "maxLength": 10
}

For more information see this page.

expected variable-declaration: 'decor1' to have a typedef
Open

const decor1 = createSideEffectMethodDecorator(applicationSpy1, invocationSpy1, PropertyType.Value);

Rule: typedef

Requires type definitions to exist.

Notes
  • TypeScript Only

Config

Several arguments may be optionally provided:

  • "call-signature" checks return type of functions.
  • "arrow-call-signature" checks return type of arrow functions.
  • "parameter" checks type specifier of function parameters for non-arrow functions.
  • "arrow-parameter" checks type specifier of function parameters for arrow functions.
  • "property-declaration" checks return types of interface properties.
  • "variable-declaration" checks non-binding variable declarations.
  • "variable-declaration-ignore-function" ignore variable declarations for non-arrow and arrow functions.
  • "member-variable-declaration" checks member variable declarations.
  • "object-destructuring" checks object destructuring declarations.
  • "array-destructuring" checks array destructuring declarations.
Examples
"typedef": true,call-signature,parameter,member-variable-declaration
Schema
{
  "type": "array",
  "items": {
    "type": "string",
    "enum": [
      "call-signature",
      "arrow-call-signature",
      "parameter",
      "arrow-parameter",
      "property-declaration",
      "variable-declaration",
      "variable-declaration-ignore-function",
      "member-variable-declaration",
      "object-destructuring",
      "array-destructuring"
    ]
  },
  "minLength": 0,
  "maxLength": 10
}

For more information see this page.

expected variable-declaration: 'applicationSpy5' to have a typedef
Open

const applicationSpy5 = sinon.spy();

Rule: typedef

Requires type definitions to exist.

Notes
  • TypeScript Only

Config

Several arguments may be optionally provided:

  • "call-signature" checks return type of functions.
  • "arrow-call-signature" checks return type of arrow functions.
  • "parameter" checks type specifier of function parameters for non-arrow functions.
  • "arrow-parameter" checks type specifier of function parameters for arrow functions.
  • "property-declaration" checks return types of interface properties.
  • "variable-declaration" checks non-binding variable declarations.
  • "variable-declaration-ignore-function" ignore variable declarations for non-arrow and arrow functions.
  • "member-variable-declaration" checks member variable declarations.
  • "object-destructuring" checks object destructuring declarations.
  • "array-destructuring" checks array destructuring declarations.
Examples
"typedef": true,call-signature,parameter,member-variable-declaration
Schema
{
  "type": "array",
  "items": {
    "type": "string",
    "enum": [
      "call-signature",
      "arrow-call-signature",
      "parameter",
      "arrow-parameter",
      "property-declaration",
      "variable-declaration",
      "variable-declaration-ignore-function",
      "member-variable-declaration",
      "object-destructuring",
      "array-destructuring"
    ]
  },
  "minLength": 0,
  "maxLength": 10
}

For more information see this page.

expected variable-declaration: 'invocationSpy6' to have a typedef
Open

const invocationSpy6 = sinon.spy();

Rule: typedef

Requires type definitions to exist.

Notes
  • TypeScript Only

Config

Several arguments may be optionally provided:

  • "call-signature" checks return type of functions.
  • "arrow-call-signature" checks return type of arrow functions.
  • "parameter" checks type specifier of function parameters for non-arrow functions.
  • "arrow-parameter" checks type specifier of function parameters for arrow functions.
  • "property-declaration" checks return types of interface properties.
  • "variable-declaration" checks non-binding variable declarations.
  • "variable-declaration-ignore-function" ignore variable declarations for non-arrow and arrow functions.
  • "member-variable-declaration" checks member variable declarations.
  • "object-destructuring" checks object destructuring declarations.
  • "array-destructuring" checks array destructuring declarations.
Examples
"typedef": true,call-signature,parameter,member-variable-declaration
Schema
{
  "type": "array",
  "items": {
    "type": "string",
    "enum": [
      "call-signature",
      "arrow-call-signature",
      "parameter",
      "arrow-parameter",
      "property-declaration",
      "variable-declaration",
      "variable-declaration-ignore-function",
      "member-variable-declaration",
      "object-destructuring",
      "array-destructuring"
    ]
  },
  "minLength": 0,
  "maxLength": 10
}

For more information see this page.

expected variable-declaration: 'spy2' to have a typedef
Open

const spy2 = sinon.spy();

Rule: typedef

Requires type definitions to exist.

Notes
  • TypeScript Only

Config

Several arguments may be optionally provided:

  • "call-signature" checks return type of functions.
  • "arrow-call-signature" checks return type of arrow functions.
  • "parameter" checks type specifier of function parameters for non-arrow functions.
  • "arrow-parameter" checks type specifier of function parameters for arrow functions.
  • "property-declaration" checks return types of interface properties.
  • "variable-declaration" checks non-binding variable declarations.
  • "variable-declaration-ignore-function" ignore variable declarations for non-arrow and arrow functions.
  • "member-variable-declaration" checks member variable declarations.
  • "object-destructuring" checks object destructuring declarations.
  • "array-destructuring" checks array destructuring declarations.
Examples
"typedef": true,call-signature,parameter,member-variable-declaration
Schema
{
  "type": "array",
  "items": {
    "type": "string",
    "enum": [
      "call-signature",
      "arrow-call-signature",
      "parameter",
      "arrow-parameter",
      "property-declaration",
      "variable-declaration",
      "variable-declaration-ignore-function",
      "member-variable-declaration",
      "object-destructuring",
      "array-destructuring"
    ]
  },
  "minLength": 0,
  "maxLength": 10
}

For more information see this page.

expected variable-declaration: 'spy5' to have a typedef
Open

const spy5 = sinon.spy();

Rule: typedef

Requires type definitions to exist.

Notes
  • TypeScript Only

Config

Several arguments may be optionally provided:

  • "call-signature" checks return type of functions.
  • "arrow-call-signature" checks return type of arrow functions.
  • "parameter" checks type specifier of function parameters for non-arrow functions.
  • "arrow-parameter" checks type specifier of function parameters for arrow functions.
  • "property-declaration" checks return types of interface properties.
  • "variable-declaration" checks non-binding variable declarations.
  • "variable-declaration-ignore-function" ignore variable declarations for non-arrow and arrow functions.
  • "member-variable-declaration" checks member variable declarations.
  • "object-destructuring" checks object destructuring declarations.
  • "array-destructuring" checks array destructuring declarations.
Examples
"typedef": true,call-signature,parameter,member-variable-declaration
Schema
{
  "type": "array",
  "items": {
    "type": "string",
    "enum": [
      "call-signature",
      "arrow-call-signature",
      "parameter",
      "arrow-parameter",
      "property-declaration",
      "variable-declaration",
      "variable-declaration-ignore-function",
      "member-variable-declaration",
      "object-destructuring",
      "array-destructuring"
    ]
  },
  "minLength": 0,
  "maxLength": 10
}

For more information see this page.

expected variable-declaration: 'spy3' to have a typedef
Open

const spy3 = sinon.spy();

Rule: typedef

Requires type definitions to exist.

Notes
  • TypeScript Only

Config

Several arguments may be optionally provided:

  • "call-signature" checks return type of functions.
  • "arrow-call-signature" checks return type of arrow functions.
  • "parameter" checks type specifier of function parameters for non-arrow functions.
  • "arrow-parameter" checks type specifier of function parameters for arrow functions.
  • "property-declaration" checks return types of interface properties.
  • "variable-declaration" checks non-binding variable declarations.
  • "variable-declaration-ignore-function" ignore variable declarations for non-arrow and arrow functions.
  • "member-variable-declaration" checks member variable declarations.
  • "object-destructuring" checks object destructuring declarations.
  • "array-destructuring" checks array destructuring declarations.
Examples
"typedef": true,call-signature,parameter,member-variable-declaration
Schema
{
  "type": "array",
  "items": {
    "type": "string",
    "enum": [
      "call-signature",
      "arrow-call-signature",
      "parameter",
      "arrow-parameter",
      "property-declaration",
      "variable-declaration",
      "variable-declaration-ignore-function",
      "member-variable-declaration",
      "object-destructuring",
      "array-destructuring"
    ]
  },
  "minLength": 0,
  "maxLength": 10
}

For more information see this page.

expected variable-declaration: 'decor4' to have a typedef
Open

const decor4 = createPropertyDecorator(spy4);

Rule: typedef

Requires type definitions to exist.

Notes
  • TypeScript Only

Config

Several arguments may be optionally provided:

  • "call-signature" checks return type of functions.
  • "arrow-call-signature" checks return type of arrow functions.
  • "parameter" checks type specifier of function parameters for non-arrow functions.
  • "arrow-parameter" checks type specifier of function parameters for arrow functions.
  • "property-declaration" checks return types of interface properties.
  • "variable-declaration" checks non-binding variable declarations.
  • "variable-declaration-ignore-function" ignore variable declarations for non-arrow and arrow functions.
  • "member-variable-declaration" checks member variable declarations.
  • "object-destructuring" checks object destructuring declarations.
  • "array-destructuring" checks array destructuring declarations.
Examples
"typedef": true,call-signature,parameter,member-variable-declaration
Schema
{
  "type": "array",
  "items": {
    "type": "string",
    "enum": [
      "call-signature",
      "arrow-call-signature",
      "parameter",
      "arrow-parameter",
      "property-declaration",
      "variable-declaration",
      "variable-declaration-ignore-function",
      "member-variable-declaration",
      "object-destructuring",
      "array-destructuring"
    ]
  },
  "minLength": 0,
  "maxLength": 10
}

For more information see this page.

Missing trailing comma
Open

      expected: [DecoratorType.Property]
Severity: Minor
Found in test/utils.spec.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.

interface name must start with a capitalized I
Open

export interface ParameterDecorator {
Severity: Minor
Found in src/utils.ts by tslint

Rule: interface-name

Requires interface names to begin with a capital 'I'

Rationale

Makes it easy to differentiate interfaces from regular classes at a glance.

Notes
  • TypeScript Only

Config

One of the following two options must be provided:

  • "always-prefix" requires interface names to start with an "I"
  • "never-prefix" requires interface names to not have an "I" prefix
Examples
"interface-name": true,always-prefix
"interface-name": true,never-prefix
Schema
{
  "type": "string",
  "enum": [
    "always-prefix",
    "never-prefix"
  ]
}

For more information see this page.

The class method 'decoratableMethod' must be marked either 'private', 'public', or 'protected'
Open

  decoratableMethod(name: string) {

Rule: member-access

Requires explicit visibility declarations for class members.

Rationale

Explicit visibility declarations can make code more readable and accessible for those new to TS.

Other languages such as C# default to private, unlike TypeScript's default of public. Members lacking a visibility declaration may be an indication of an accidental leak of class internals.

Notes
  • TypeScript Only
  • Has Fix

Config

These arguments may be optionally provided:

  • "no-public" forbids public accessibility to be specified, because this is the default.
  • "check-accessor" enforces explicit visibility on get/set accessors
  • "check-constructor" enforces explicit visibility on constructors
  • "check-parameter-property" enforces explicit visibility on parameter properties
Examples
"member-access": true
"member-access": true,no-public
"member-access": true,check-accessor
Schema
{
  "type": "array",
  "items": {
    "type": "string",
    "enum": [
      "no-public",
      "check-accessor",
      "check-constructor",
      "check-parameter-property"
    ]
  },
  "minLength": 0,
  "maxLength": 4
}

For more information see this page.

expected variable-declaration: 'instanceMethodSpy2' to have a typedef
Open

const instanceMethodSpy2 = sinon.spy();

Rule: typedef

Requires type definitions to exist.

Notes
  • TypeScript Only

Config

Several arguments may be optionally provided:

  • "call-signature" checks return type of functions.
  • "arrow-call-signature" checks return type of arrow functions.
  • "parameter" checks type specifier of function parameters for non-arrow functions.
  • "arrow-parameter" checks type specifier of function parameters for arrow functions.
  • "property-declaration" checks return types of interface properties.
  • "variable-declaration" checks non-binding variable declarations.
  • "variable-declaration-ignore-function" ignore variable declarations for non-arrow and arrow functions.
  • "member-variable-declaration" checks member variable declarations.
  • "object-destructuring" checks object destructuring declarations.
  • "array-destructuring" checks array destructuring declarations.
Examples
"typedef": true,call-signature,parameter,member-variable-declaration
Schema
{
  "type": "array",
  "items": {
    "type": "string",
    "enum": [
      "call-signature",
      "arrow-call-signature",
      "parameter",
      "arrow-parameter",
      "property-declaration",
      "variable-declaration",
      "variable-declaration-ignore-function",
      "member-variable-declaration",
      "object-destructuring",
      "array-destructuring"
    ]
  },
  "minLength": 0,
  "maxLength": 10
}

For more information see this page.

Severity
Category
Status
Source
Language