Ikagaka/ghost-kernel.js

View on GitHub

Showing 118 of 118 total issues

Function perform has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  async perform() {
    const kernelStartOperation = this.kernelStartOperation;
    const nanikaGhostMasterDirectory = this.nanikaGhostMasterDirectory;
    const profile = await nanikaGhostMasterDirectory.readProfile();
    const bootCount = profile.bootCount as number || 0;
Severity: Minor
Found in lib/services/BootService.ts - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

File name must be camelCase
Open

import { EventRoutingDefiner } from "lazy-event-router";
Severity: Minor
Found in lib/controllers/NotifyInformation.ts by tslint

Rule: file-name-casing

Enforces a consistent file naming convention

Rationale

Helps maintain a consistent style across a file hierarchy

Config

One of the following arguments must be provided:

  • camel-case: File names must be camel-cased: fileName.ts.
  • pascal-case: File names must be Pascal-cased: FileName.ts.
  • kebab-case: File names must be kebab-cased: file-name.ts.
  • snake-case: File names must be snake-cased: file_name.ts.
  • ignore: File names are ignored (useful for the object configuration).

Or an object, where the key represents a regular expression that matches the file name, and the value is the file name rule from the previous list.

  • { ".tsx": "pascal-case", ".ts": "camel-case" }
Examples
"file-name-casing": true,camel-case
"file-name-casing": true,pascal-case
"file-name-casing": true,kebab-case
"file-name-casing": true,snake-case
"file-name-casing": true,[object Object]
"file-name-casing": true,[object Object]
"file-name-casing": true,[object Object]
Schema
{
  "type": "array",
  "items": {
    "anyOf": [
      {
        "type": "array",
        "items": [
          {
            "type": "string",
            "enum": [
              "camel-case",
              "ignore",
              "pascal-case",
              "kebab-case",
              "snake-case"
            ]
          }
        ]
      },
      {
        "type": "object",
        "additionalProperties": {
          "type": "string",
          "enum": [
            "camel-case",
            "ignore",
            "pascal-case",
            "kebab-case",
            "snake-case"
          ]
        },
        "minProperties": 1
      }
    ]
  }
}

For more information see this page.

Imports from this module are not allowed in this group. The expected groups (in order) are: libraries, parent directories, current directory.
Open

import { KernelPhase, KernelStartOperation } from "../components";
Severity: Minor
Found in lib/controllers/Version.ts by tslint

Rule: ordered-imports

Requires that import statements be alphabetized and grouped.

Enforce a consistent ordering for ES6 imports: - Named imports must be alphabetized (i.e. "import {A, B, C} from "foo";") - The exact ordering can be controlled by the named-imports-order option. - "longName as name" imports are ordered by "longName". - Import sources must be alphabetized within groups, i.e.: import * as foo from "a"; import * as bar from "b"; - Groups of imports are delineated by blank lines. You can use this rule to group imports however you like, e.g. by first- vs. third-party or thematically or you can define groups based upon patterns in import path names.

Notes
  • Has Fix

Config

You may set the "import-sources-order" option to control the ordering of source imports (the "foo" in import {A, B, C} from "foo").

Possible values for "import-sources-order" are:

  • "case-insensitive': Correct order is "Bar", "baz", "Foo". (This is the default.)
  • "case-insensitive-legacy': Correct order is "Bar", "baz", "Foo".
  • "lowercase-first": Correct order is "baz", "Bar", "Foo".
  • "lowercase-last": Correct order is "Bar", "Foo", "baz".
  • "any": Allow any order.

You may set the "grouped-imports" option to control the grouping of source imports (the "foo" in import {A, B, C} from "foo"). The grouping used is controlled by the "groups" option.

Possible values for "grouped-imports" are:

  • false: Do not enforce grouping. (This is the default.)
  • true: Group source imports using default grouping or groups setting.

The value of "groups" is a list of group rules of the form:

[{
    "name": "optional rule name",
    "match": "regex string",
    "order": 10
}, {
    "name": "pkga imports",
    "match": "^@pkga",
    "order": 20
}]

there is also a simplified form where you only pass a list of patterns and the order is given by the position in the list

["^@pkga", "^\.\."]

The first rule in the list to match a given import is the group that is used. If no rule in matched then the import will be put in an unmatched group at the end of all groups. The groups must be ordered based upon the sequential value of the order value. (ie. order 0 is first)

If no "groups" options is set, a default grouping is used of third-party, parent directories and the current directory. ("bar", "../baz", "./foo".)

You may set the "named-imports-order" option to control the ordering of named imports (the {A, B, C} in import {A, B, C} from "foo").

Possible values for "named-imports-order" are:

  • "case-insensitive': Correct order is {A, b, C}. (This is the default.)
  • "case-insensitive-legacy': Correct order is "Bar", "baz", "Foo".
  • "lowercase-first": Correct order is {b, A, C}.
  • "lowercase-last": Correct order is {A, C, b}.
  • "any": Allow any order.

You may set the "module-source-path" option to control the ordering of imports based full path or just the module name

Possible values for "module-source-path" are:

  • "full': Correct order is "./a/Foo", "./b/baz", "./c/Bar". (This is the default.)
  • "basename": Correct order is "./c/Bar", "./b/baz", "./a/Foo".
Examples
"ordered-imports": true
"ordered-imports": true,[object Object]
Schema
{
  "type": "object",
  "properties": {
    "grouped-imports": {
      "type": "boolean"
    },
    "groups": {
      "type": "list",
      "listType": {
        "oneOf": [
          {
            "type": "string"
          },
          {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "match": {
                "type": "string"
              },
              "order": {
                "type": "number"
              }
            },
            "required": [
              "match",
              "order"
            ]
          }
        ]
      }
    },
    "import-sources-order": {
      "type": "string",
      "enum": [
        "case-insensitive",
        "case-insensitive-legacy",
        "lowercase-first",
        "lowercase-last",
        "any"
      ]
    },
    "named-imports-order": {
      "type": "string",
      "enum": [
        "case-insensitive",
        "case-insensitive-legacy",
        "lowercase-first",
        "lowercase-last",
        "any"
      ]
    },
    "module-source-path": {
      "type": "string",
      "enum": [
        "full",
        "basename"
      ]
    }
  },
  "additionalProperties": false
}

For more information see this page.

File name must be camelCase
Open

export class TimerEventState {
Severity: Minor
Found in lib/components/TimerEventState.ts by tslint

Rule: file-name-casing

Enforces a consistent file naming convention

Rationale

Helps maintain a consistent style across a file hierarchy

Config

One of the following arguments must be provided:

  • camel-case: File names must be camel-cased: fileName.ts.
  • pascal-case: File names must be Pascal-cased: FileName.ts.
  • kebab-case: File names must be kebab-cased: file-name.ts.
  • snake-case: File names must be snake-cased: file_name.ts.
  • ignore: File names are ignored (useful for the object configuration).

Or an object, where the key represents a regular expression that matches the file name, and the value is the file name rule from the previous list.

  • { ".tsx": "pascal-case", ".ts": "camel-case" }
Examples
"file-name-casing": true,camel-case
"file-name-casing": true,pascal-case
"file-name-casing": true,kebab-case
"file-name-casing": true,snake-case
"file-name-casing": true,[object Object]
"file-name-casing": true,[object Object]
"file-name-casing": true,[object Object]
Schema
{
  "type": "array",
  "items": {
    "anyOf": [
      {
        "type": "array",
        "items": [
          {
            "type": "string",
            "enum": [
              "camel-case",
              "ignore",
              "pascal-case",
              "kebab-case",
              "snake-case"
            ]
          }
        ]
      },
      {
        "type": "object",
        "additionalProperties": {
          "type": "string",
          "enum": [
            "camel-case",
            "ignore",
            "pascal-case",
            "kebab-case",
            "snake-case"
          ]
        },
        "minProperties": 1
      }
    ]
  }
}

For more information see this page.

Functions marked async must contain an await or return statement.
Open

  private async vanish(_event: KernelCloseOperation.VanishEvent) {
Severity: Minor
Found in lib/services/CloseService.ts by tslint

Rule: no-async-without-await

Functions marked async must contain an await or return statement.

Rationale

Marking a function as async without using await or returning a value inside it can lead to an unintended promise return and a larger transpiled output. Often the function can be synchronous and the async keyword is there by mistake. Return statements are allowed as sometimes it is desirable to wrap the returned value in a Promise.

Config

Not configurable.

Examples
"no-async-without-await": true

For more information see this page.

The preceding if block ends with a return statement. This else is unnecessary.
Open

    } else {
Severity: Minor
Found in lib/services/VersionService.ts by tslint

Rule: unnecessary-else

Disallows else blocks following if blocks ending with a break, continue, return, or throw statement.

Rationale

When an if block is guaranteed to exit control flow when entered, it is unnecessary to add an else statement. The contents that would be in the else block can be placed after the end of the if block.

Config

You can optionally specify the option "allow-else-if" to allow "else if" statements.

Examples
"unnecessary-else": true
"unnecessary-else": true,[object Object]
Schema
{
  "type": "object",
  "properties": {
    "allow-else-if": {
      "type": "boolean"
    }
  }
}

For more information see this page.

File name must be camelCase
Open

import { EventController } from "lazy-event-router";

Rule: file-name-casing

Enforces a consistent file naming convention

Rationale

Helps maintain a consistent style across a file hierarchy

Config

One of the following arguments must be provided:

  • camel-case: File names must be camel-cased: fileName.ts.
  • pascal-case: File names must be Pascal-cased: FileName.ts.
  • kebab-case: File names must be kebab-cased: file-name.ts.
  • snake-case: File names must be snake-cased: file_name.ts.
  • ignore: File names are ignored (useful for the object configuration).

Or an object, where the key represents a regular expression that matches the file name, and the value is the file name rule from the previous list.

  • { ".tsx": "pascal-case", ".ts": "camel-case" }
Examples
"file-name-casing": true,camel-case
"file-name-casing": true,pascal-case
"file-name-casing": true,kebab-case
"file-name-casing": true,snake-case
"file-name-casing": true,[object Object]
"file-name-casing": true,[object Object]
"file-name-casing": true,[object Object]
Schema
{
  "type": "array",
  "items": {
    "anyOf": [
      {
        "type": "array",
        "items": [
          {
            "type": "string",
            "enum": [
              "camel-case",
              "ignore",
              "pascal-case",
              "kebab-case",
              "snake-case"
            ]
          }
        ]
      },
      {
        "type": "object",
        "additionalProperties": {
          "type": "string",
          "enum": [
            "camel-case",
            "ignore",
            "pascal-case",
            "kebab-case",
            "snake-case"
          ]
        },
        "minProperties": 1
      }
    ]
  }
}

For more information see this page.

The preceding if block ends with a return statement. This else is unnecessary.
Open

    } else if (token instanceof SakuraScriptToken.ToggleQuick) {
Severity: Minor
Found in lib/controllers/SakuraScript.ts by tslint

Rule: unnecessary-else

Disallows else blocks following if blocks ending with a break, continue, return, or throw statement.

Rationale

When an if block is guaranteed to exit control flow when entered, it is unnecessary to add an else statement. The contents that would be in the else block can be placed after the end of the if block.

Config

You can optionally specify the option "allow-else-if" to allow "else if" statements.

Examples
"unnecessary-else": true
"unnecessary-else": true,[object Object]
Schema
{
  "type": "object",
  "properties": {
    "allow-else-if": {
      "type": "boolean"
    }
  }
}

For more information see this page.

File name must be camelCase
Open

import { EventRoutingDefiner } from "lazy-event-router";
Severity: Minor
Found in lib/controllers/TimeEvent.ts by tslint

Rule: file-name-casing

Enforces a consistent file naming convention

Rationale

Helps maintain a consistent style across a file hierarchy

Config

One of the following arguments must be provided:

  • camel-case: File names must be camel-cased: fileName.ts.
  • pascal-case: File names must be Pascal-cased: FileName.ts.
  • kebab-case: File names must be kebab-cased: file-name.ts.
  • snake-case: File names must be snake-cased: file_name.ts.
  • ignore: File names are ignored (useful for the object configuration).

Or an object, where the key represents a regular expression that matches the file name, and the value is the file name rule from the previous list.

  • { ".tsx": "pascal-case", ".ts": "camel-case" }
Examples
"file-name-casing": true,camel-case
"file-name-casing": true,pascal-case
"file-name-casing": true,kebab-case
"file-name-casing": true,snake-case
"file-name-casing": true,[object Object]
"file-name-casing": true,[object Object]
"file-name-casing": true,[object Object]
Schema
{
  "type": "array",
  "items": {
    "anyOf": [
      {
        "type": "array",
        "items": [
          {
            "type": "string",
            "enum": [
              "camel-case",
              "ignore",
              "pascal-case",
              "kebab-case",
              "snake-case"
            ]
          }
        ]
      },
      {
        "type": "object",
        "additionalProperties": {
          "type": "string",
          "enum": [
            "camel-case",
            "ignore",
            "pascal-case",
            "kebab-case",
            "snake-case"
          ]
        },
        "minProperties": 1
      }
    ]
  }
}

For more information see this page.

Functions marked async must contain an await or return statement.
Open

  async ghostpathlist() {

Rule: no-async-without-await

Functions marked async must contain an await or return statement.

Rationale

Marking a function as async without using await or returning a value inside it can lead to an unintended promise return and a larger transpiled output. Often the function can be synchronous and the async keyword is there by mistake. Return statements are allowed as sometimes it is desirable to wrap the returned value in a Promise.

Config

Not configurable.

Examples
"no-async-without-await": true

For more information see this page.

File name must be camelCase
Open

import { SakuraScriptExecuter } from "sakurascript-executer";

Rule: file-name-casing

Enforces a consistent file naming convention

Rationale

Helps maintain a consistent style across a file hierarchy

Config

One of the following arguments must be provided:

  • camel-case: File names must be camel-cased: fileName.ts.
  • pascal-case: File names must be Pascal-cased: FileName.ts.
  • kebab-case: File names must be kebab-cased: file-name.ts.
  • snake-case: File names must be snake-cased: file_name.ts.
  • ignore: File names are ignored (useful for the object configuration).

Or an object, where the key represents a regular expression that matches the file name, and the value is the file name rule from the previous list.

  • { ".tsx": "pascal-case", ".ts": "camel-case" }
Examples
"file-name-casing": true,camel-case
"file-name-casing": true,pascal-case
"file-name-casing": true,kebab-case
"file-name-casing": true,snake-case
"file-name-casing": true,[object Object]
"file-name-casing": true,[object Object]
"file-name-casing": true,[object Object]
Schema
{
  "type": "array",
  "items": {
    "anyOf": [
      {
        "type": "array",
        "items": [
          {
            "type": "string",
            "enum": [
              "camel-case",
              "ignore",
              "pascal-case",
              "kebab-case",
              "snake-case"
            ]
          }
        ]
      },
      {
        "type": "object",
        "additionalProperties": {
          "type": "string",
          "enum": [
            "camel-case",
            "ignore",
            "pascal-case",
            "kebab-case",
            "snake-case"
          ]
        },
        "minProperties": 1
      }
    ]
  }
}

For more information see this page.

File name must be camelCase
Open

// tslint:disable max-classes-per-file
Severity: Minor
Found in lib/controllers/Menu.ts by tslint

Rule: file-name-casing

Enforces a consistent file naming convention

Rationale

Helps maintain a consistent style across a file hierarchy

Config

One of the following arguments must be provided:

  • camel-case: File names must be camel-cased: fileName.ts.
  • pascal-case: File names must be Pascal-cased: FileName.ts.
  • kebab-case: File names must be kebab-cased: file-name.ts.
  • snake-case: File names must be snake-cased: file_name.ts.
  • ignore: File names are ignored (useful for the object configuration).

Or an object, where the key represents a regular expression that matches the file name, and the value is the file name rule from the previous list.

  • { ".tsx": "pascal-case", ".ts": "camel-case" }
Examples
"file-name-casing": true,camel-case
"file-name-casing": true,pascal-case
"file-name-casing": true,kebab-case
"file-name-casing": true,snake-case
"file-name-casing": true,[object Object]
"file-name-casing": true,[object Object]
"file-name-casing": true,[object Object]
Schema
{
  "type": "array",
  "items": {
    "anyOf": [
      {
        "type": "array",
        "items": [
          {
            "type": "string",
            "enum": [
              "camel-case",
              "ignore",
              "pascal-case",
              "kebab-case",
              "snake-case"
            ]
          }
        ]
      },
      {
        "type": "object",
        "additionalProperties": {
          "type": "string",
          "enum": [
            "camel-case",
            "ignore",
            "pascal-case",
            "kebab-case",
            "snake-case"
          ]
        },
        "minProperties": 1
      }
    ]
  }
}

For more information see this page.

Imports from this module are not allowed in this group. The expected groups (in order) are: libraries, parent directories, current directory.
Open

import { ShellState } from "../components";
Severity: Minor
Found in lib/controllers/SakuraScript.ts by tslint

Rule: ordered-imports

Requires that import statements be alphabetized and grouped.

Enforce a consistent ordering for ES6 imports: - Named imports must be alphabetized (i.e. "import {A, B, C} from "foo";") - The exact ordering can be controlled by the named-imports-order option. - "longName as name" imports are ordered by "longName". - Import sources must be alphabetized within groups, i.e.: import * as foo from "a"; import * as bar from "b"; - Groups of imports are delineated by blank lines. You can use this rule to group imports however you like, e.g. by first- vs. third-party or thematically or you can define groups based upon patterns in import path names.

Notes
  • Has Fix

Config

You may set the "import-sources-order" option to control the ordering of source imports (the "foo" in import {A, B, C} from "foo").

Possible values for "import-sources-order" are:

  • "case-insensitive': Correct order is "Bar", "baz", "Foo". (This is the default.)
  • "case-insensitive-legacy': Correct order is "Bar", "baz", "Foo".
  • "lowercase-first": Correct order is "baz", "Bar", "Foo".
  • "lowercase-last": Correct order is "Bar", "Foo", "baz".
  • "any": Allow any order.

You may set the "grouped-imports" option to control the grouping of source imports (the "foo" in import {A, B, C} from "foo"). The grouping used is controlled by the "groups" option.

Possible values for "grouped-imports" are:

  • false: Do not enforce grouping. (This is the default.)
  • true: Group source imports using default grouping or groups setting.

The value of "groups" is a list of group rules of the form:

[{
    "name": "optional rule name",
    "match": "regex string",
    "order": 10
}, {
    "name": "pkga imports",
    "match": "^@pkga",
    "order": 20
}]

there is also a simplified form where you only pass a list of patterns and the order is given by the position in the list

["^@pkga", "^\.\."]

The first rule in the list to match a given import is the group that is used. If no rule in matched then the import will be put in an unmatched group at the end of all groups. The groups must be ordered based upon the sequential value of the order value. (ie. order 0 is first)

If no "groups" options is set, a default grouping is used of third-party, parent directories and the current directory. ("bar", "../baz", "./foo".)

You may set the "named-imports-order" option to control the ordering of named imports (the {A, B, C} in import {A, B, C} from "foo").

Possible values for "named-imports-order" are:

  • "case-insensitive': Correct order is {A, b, C}. (This is the default.)
  • "case-insensitive-legacy': Correct order is "Bar", "baz", "Foo".
  • "lowercase-first": Correct order is {b, A, C}.
  • "lowercase-last": Correct order is {A, C, b}.
  • "any": Allow any order.

You may set the "module-source-path" option to control the ordering of imports based full path or just the module name

Possible values for "module-source-path" are:

  • "full': Correct order is "./a/Foo", "./b/baz", "./c/Bar". (This is the default.)
  • "basename": Correct order is "./c/Bar", "./b/baz", "./a/Foo".
Examples
"ordered-imports": true
"ordered-imports": true,[object Object]
Schema
{
  "type": "object",
  "properties": {
    "grouped-imports": {
      "type": "boolean"
    },
    "groups": {
      "type": "list",
      "listType": {
        "oneOf": [
          {
            "type": "string"
          },
          {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "match": {
                "type": "string"
              },
              "order": {
                "type": "number"
              }
            },
            "required": [
              "match",
              "order"
            ]
          }
        ]
      }
    },
    "import-sources-order": {
      "type": "string",
      "enum": [
        "case-insensitive",
        "case-insensitive-legacy",
        "lowercase-first",
        "lowercase-last",
        "any"
      ]
    },
    "named-imports-order": {
      "type": "string",
      "enum": [
        "case-insensitive",
        "case-insensitive-legacy",
        "lowercase-first",
        "lowercase-last",
        "any"
      ]
    },
    "module-source-path": {
      "type": "string",
      "enum": [
        "full",
        "basename"
      ]
    }
  },
  "additionalProperties": false
}

For more information see this page.

Imports from this module are not allowed in this group. The expected groups (in order) are: libraries, parent directories, current directory.
Open

import { KernelPhase } from "../components";
Severity: Minor
Found in lib/controllers/TimeEvent.ts by tslint

Rule: ordered-imports

Requires that import statements be alphabetized and grouped.

Enforce a consistent ordering for ES6 imports: - Named imports must be alphabetized (i.e. "import {A, B, C} from "foo";") - The exact ordering can be controlled by the named-imports-order option. - "longName as name" imports are ordered by "longName". - Import sources must be alphabetized within groups, i.e.: import * as foo from "a"; import * as bar from "b"; - Groups of imports are delineated by blank lines. You can use this rule to group imports however you like, e.g. by first- vs. third-party or thematically or you can define groups based upon patterns in import path names.

Notes
  • Has Fix

Config

You may set the "import-sources-order" option to control the ordering of source imports (the "foo" in import {A, B, C} from "foo").

Possible values for "import-sources-order" are:

  • "case-insensitive': Correct order is "Bar", "baz", "Foo". (This is the default.)
  • "case-insensitive-legacy': Correct order is "Bar", "baz", "Foo".
  • "lowercase-first": Correct order is "baz", "Bar", "Foo".
  • "lowercase-last": Correct order is "Bar", "Foo", "baz".
  • "any": Allow any order.

You may set the "grouped-imports" option to control the grouping of source imports (the "foo" in import {A, B, C} from "foo"). The grouping used is controlled by the "groups" option.

Possible values for "grouped-imports" are:

  • false: Do not enforce grouping. (This is the default.)
  • true: Group source imports using default grouping or groups setting.

The value of "groups" is a list of group rules of the form:

[{
    "name": "optional rule name",
    "match": "regex string",
    "order": 10
}, {
    "name": "pkga imports",
    "match": "^@pkga",
    "order": 20
}]

there is also a simplified form where you only pass a list of patterns and the order is given by the position in the list

["^@pkga", "^\.\."]

The first rule in the list to match a given import is the group that is used. If no rule in matched then the import will be put in an unmatched group at the end of all groups. The groups must be ordered based upon the sequential value of the order value. (ie. order 0 is first)

If no "groups" options is set, a default grouping is used of third-party, parent directories and the current directory. ("bar", "../baz", "./foo".)

You may set the "named-imports-order" option to control the ordering of named imports (the {A, B, C} in import {A, B, C} from "foo").

Possible values for "named-imports-order" are:

  • "case-insensitive': Correct order is {A, b, C}. (This is the default.)
  • "case-insensitive-legacy': Correct order is "Bar", "baz", "Foo".
  • "lowercase-first": Correct order is {b, A, C}.
  • "lowercase-last": Correct order is {A, C, b}.
  • "any": Allow any order.

You may set the "module-source-path" option to control the ordering of imports based full path or just the module name

Possible values for "module-source-path" are:

  • "full': Correct order is "./a/Foo", "./b/baz", "./c/Bar". (This is the default.)
  • "basename": Correct order is "./c/Bar", "./b/baz", "./a/Foo".
Examples
"ordered-imports": true
"ordered-imports": true,[object Object]
Schema
{
  "type": "object",
  "properties": {
    "grouped-imports": {
      "type": "boolean"
    },
    "groups": {
      "type": "list",
      "listType": {
        "oneOf": [
          {
            "type": "string"
          },
          {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "match": {
                "type": "string"
              },
              "order": {
                "type": "number"
              }
            },
            "required": [
              "match",
              "order"
            ]
          }
        ]
      }
    },
    "import-sources-order": {
      "type": "string",
      "enum": [
        "case-insensitive",
        "case-insensitive-legacy",
        "lowercase-first",
        "lowercase-last",
        "any"
      ]
    },
    "named-imports-order": {
      "type": "string",
      "enum": [
        "case-insensitive",
        "case-insensitive-legacy",
        "lowercase-first",
        "lowercase-last",
        "any"
      ]
    },
    "module-source-path": {
      "type": "string",
      "enum": [
        "full",
        "basename"
      ]
    }
  },
  "additionalProperties": false
}

For more information see this page.

File name must be camelCase
Open

import { EventRoutingDefiner } from "lazy-event-router";
Severity: Minor
Found in lib/controllers/Visiblity.ts by tslint

Rule: file-name-casing

Enforces a consistent file naming convention

Rationale

Helps maintain a consistent style across a file hierarchy

Config

One of the following arguments must be provided:

  • camel-case: File names must be camel-cased: fileName.ts.
  • pascal-case: File names must be Pascal-cased: FileName.ts.
  • kebab-case: File names must be kebab-cased: file-name.ts.
  • snake-case: File names must be snake-cased: file_name.ts.
  • ignore: File names are ignored (useful for the object configuration).

Or an object, where the key represents a regular expression that matches the file name, and the value is the file name rule from the previous list.

  • { ".tsx": "pascal-case", ".ts": "camel-case" }
Examples
"file-name-casing": true,camel-case
"file-name-casing": true,pascal-case
"file-name-casing": true,kebab-case
"file-name-casing": true,snake-case
"file-name-casing": true,[object Object]
"file-name-casing": true,[object Object]
"file-name-casing": true,[object Object]
Schema
{
  "type": "array",
  "items": {
    "anyOf": [
      {
        "type": "array",
        "items": [
          {
            "type": "string",
            "enum": [
              "camel-case",
              "ignore",
              "pascal-case",
              "kebab-case",
              "snake-case"
            ]
          }
        ]
      },
      {
        "type": "object",
        "additionalProperties": {
          "type": "string",
          "enum": [
            "camel-case",
            "ignore",
            "pascal-case",
            "kebab-case",
            "snake-case"
          ]
        },
        "minProperties": 1
      }
    ]
  }
}

For more information see this page.

Imports from this module are not allowed in this group. The expected groups (in order) are: libraries, parent directories, current directory.
Open

import { ChangeTransactionInfo } from "./ChangeTransactionInfo";

Rule: ordered-imports

Requires that import statements be alphabetized and grouped.

Enforce a consistent ordering for ES6 imports: - Named imports must be alphabetized (i.e. "import {A, B, C} from "foo";") - The exact ordering can be controlled by the named-imports-order option. - "longName as name" imports are ordered by "longName". - Import sources must be alphabetized within groups, i.e.: import * as foo from "a"; import * as bar from "b"; - Groups of imports are delineated by blank lines. You can use this rule to group imports however you like, e.g. by first- vs. third-party or thematically or you can define groups based upon patterns in import path names.

Notes
  • Has Fix

Config

You may set the "import-sources-order" option to control the ordering of source imports (the "foo" in import {A, B, C} from "foo").

Possible values for "import-sources-order" are:

  • "case-insensitive': Correct order is "Bar", "baz", "Foo". (This is the default.)
  • "case-insensitive-legacy': Correct order is "Bar", "baz", "Foo".
  • "lowercase-first": Correct order is "baz", "Bar", "Foo".
  • "lowercase-last": Correct order is "Bar", "Foo", "baz".
  • "any": Allow any order.

You may set the "grouped-imports" option to control the grouping of source imports (the "foo" in import {A, B, C} from "foo"). The grouping used is controlled by the "groups" option.

Possible values for "grouped-imports" are:

  • false: Do not enforce grouping. (This is the default.)
  • true: Group source imports using default grouping or groups setting.

The value of "groups" is a list of group rules of the form:

[{
    "name": "optional rule name",
    "match": "regex string",
    "order": 10
}, {
    "name": "pkga imports",
    "match": "^@pkga",
    "order": 20
}]

there is also a simplified form where you only pass a list of patterns and the order is given by the position in the list

["^@pkga", "^\.\."]

The first rule in the list to match a given import is the group that is used. If no rule in matched then the import will be put in an unmatched group at the end of all groups. The groups must be ordered based upon the sequential value of the order value. (ie. order 0 is first)

If no "groups" options is set, a default grouping is used of third-party, parent directories and the current directory. ("bar", "../baz", "./foo".)

You may set the "named-imports-order" option to control the ordering of named imports (the {A, B, C} in import {A, B, C} from "foo").

Possible values for "named-imports-order" are:

  • "case-insensitive': Correct order is {A, b, C}. (This is the default.)
  • "case-insensitive-legacy': Correct order is "Bar", "baz", "Foo".
  • "lowercase-first": Correct order is {b, A, C}.
  • "lowercase-last": Correct order is {A, C, b}.
  • "any": Allow any order.

You may set the "module-source-path" option to control the ordering of imports based full path or just the module name

Possible values for "module-source-path" are:

  • "full': Correct order is "./a/Foo", "./b/baz", "./c/Bar". (This is the default.)
  • "basename": Correct order is "./c/Bar", "./b/baz", "./a/Foo".
Examples
"ordered-imports": true
"ordered-imports": true,[object Object]
Schema
{
  "type": "object",
  "properties": {
    "grouped-imports": {
      "type": "boolean"
    },
    "groups": {
      "type": "list",
      "listType": {
        "oneOf": [
          {
            "type": "string"
          },
          {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "match": {
                "type": "string"
              },
              "order": {
                "type": "number"
              }
            },
            "required": [
              "match",
              "order"
            ]
          }
        ]
      }
    },
    "import-sources-order": {
      "type": "string",
      "enum": [
        "case-insensitive",
        "case-insensitive-legacy",
        "lowercase-first",
        "lowercase-last",
        "any"
      ]
    },
    "named-imports-order": {
      "type": "string",
      "enum": [
        "case-insensitive",
        "case-insensitive-legacy",
        "lowercase-first",
        "lowercase-last",
        "any"
      ]
    },
    "module-source-path": {
      "type": "string",
      "enum": [
        "full",
        "basename"
      ]
    }
  },
  "additionalProperties": false
}

For more information see this page.

File name must be camelCase
Open

import { Shiorif } from "shiorif";
Severity: Minor
Found in lib/services/CloseService.ts by tslint

Rule: file-name-casing

Enforces a consistent file naming convention

Rationale

Helps maintain a consistent style across a file hierarchy

Config

One of the following arguments must be provided:

  • camel-case: File names must be camel-cased: fileName.ts.
  • pascal-case: File names must be Pascal-cased: FileName.ts.
  • kebab-case: File names must be kebab-cased: file-name.ts.
  • snake-case: File names must be snake-cased: file_name.ts.
  • ignore: File names are ignored (useful for the object configuration).

Or an object, where the key represents a regular expression that matches the file name, and the value is the file name rule from the previous list.

  • { ".tsx": "pascal-case", ".ts": "camel-case" }
Examples
"file-name-casing": true,camel-case
"file-name-casing": true,pascal-case
"file-name-casing": true,kebab-case
"file-name-casing": true,snake-case
"file-name-casing": true,[object Object]
"file-name-casing": true,[object Object]
"file-name-casing": true,[object Object]
Schema
{
  "type": "array",
  "items": {
    "anyOf": [
      {
        "type": "array",
        "items": [
          {
            "type": "string",
            "enum": [
              "camel-case",
              "ignore",
              "pascal-case",
              "kebab-case",
              "snake-case"
            ]
          }
        ]
      },
      {
        "type": "object",
        "additionalProperties": {
          "type": "string",
          "enum": [
            "camel-case",
            "ignore",
            "pascal-case",
            "kebab-case",
            "snake-case"
          ]
        },
        "minProperties": 1
      }
    ]
  }
}

For more information see this page.

The preceding if block ends with a return statement. This else is unnecessary.
Open

    } else if (/3\.\d/.test(version)) {
Severity: Minor
Found in lib/services/VersionService.ts by tslint

Rule: unnecessary-else

Disallows else blocks following if blocks ending with a break, continue, return, or throw statement.

Rationale

When an if block is guaranteed to exit control flow when entered, it is unnecessary to add an else statement. The contents that would be in the else block can be placed after the end of the if block.

Config

You can optionally specify the option "allow-else-if" to allow "else if" statements.

Examples
"unnecessary-else": true
"unnecessary-else": true,[object Object]
Schema
{
  "type": "object",
  "properties": {
    "allow-else-if": {
      "type": "boolean"
    }
  }
}

For more information see this page.

Use the parent class name instead of this when in a static context.
Open

      const shellState = this.kernel.component(ShellState);
Severity: Minor
Found in lib/controllers/SakuraScript.ts by tslint

Rule: static-this

Ban the use of this in static methods.

Rationale

Static this usage can be confusing for newcomers. It can also become imprecise when used with extended classes when a static this of a parent class no longer specifically refers to the parent class.

Notes
  • Has Fix
Examples
"static-this": true

For more information see this page.

Use an explicit -= 1 operator.
Open

          if (repeatCount > 0) repeatCount--;
Severity: Minor
Found in lib/controllers/SakuraScript.ts by tslint

Rule: increment-decrement

Enforces using explicit += 1 or -= 1 operators.

Rationale

It's easy to type +i or -i instead of --i or ++i, and won't always result in invalid code. Prefer standardizing small arithmetic operations with the explicit += and -= operators.

Config

If no arguments are provided, both pre- and post-unary operators are banned. If "allow-post" is provided, post-unary operators will be allowed.

Examples
"increment-decrement": true
"increment-decrement": true,allow-post
Schema
{
  "items": {
    "enum": [
      "allow-post"
    ],
    "type": "string"
  },
  "maxLength": 1,
  "minLength": 0,
  "type": "array"
}

For more information see this page.

Severity
Category
Status
Source
Language