fbredius/storybook

View on GitHub
lib/ui/src/containers/sidebar.tsx

Summary

Maintainability
A
1 hr
Test Coverage

Function Sidebar has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Sidebar: FunctionComponent<{}> = React.memo(() => {
  const mapper = ({ state, api }: Combo) => {
    const {
      ui: { name, url, enableShortcuts },
      viewMode,
Severity: Minor
Found in lib/ui/src/containers/sidebar.tsx - About 1 hr to fix

    unused expression, expected an assignment or function call
    Open

    import type { Combo, StoriesHash } from '@storybook/api';
    Severity: Minor
    Found in lib/ui/src/containers/sidebar.tsx by tslint

    Rule: no-unused-expression

    Disallows unused expression statements.

    Unused expressions are expression statements which are not assignments or function calls (and thus usually no-ops).

    Rationale

    Detects potential errors where an assignment or function call was intended.

    Config

    Three arguments may be optionally provided:

    • allow-fast-null-checks allows to use logical operators to perform fast null checks and perform method or function calls for side effects (e.g. e && e.preventDefault()).
    • allow-new allows 'new' expressions for side effects (e.g. new ModifyGlobalState();.
    • allow-tagged-template allows tagged templates for side effects (e.g. this.add\foo`;`.
    Examples
    "no-unused-expression": true
    "no-unused-expression": true,allow-fast-null-checks
    Schema
    {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "allow-fast-null-checks",
          "allow-new",
          "allow-tagged-template"
        ]
      },
      "minLength": 0,
      "maxLength": 3
    }

    For more information see this page.

    Missing semicolon
    Open

    import type { Combo, StoriesHash } from '@storybook/api';
    Severity: Minor
    Found in lib/ui/src/containers/sidebar.tsx by tslint

    Rule: semicolon

    Enforces consistent semicolon usage at the end of every statement.

    Notes
    • Has Fix

    Config

    One of the following arguments must be provided:

    • "always" enforces semicolons at the end of every statement.
    • "never" disallows semicolons at the end of every statement except for when they are necessary.

    The following arguments may be optionally provided:

    • "ignore-interfaces" skips checking semicolons at the end of interface members.
    • "ignore-bound-class-methods" skips checking semicolons at the end of bound class methods.
    • "strict-bound-class-methods" disables any special handling of bound class methods and treats them as any other assignment. This option overrides "ignore-bound-class-methods".
    Examples
    "semicolon": true,always
    "semicolon": true,never
    "semicolon": true,always,ignore-interfaces
    "semicolon": true,always,ignore-bound-class-methods
    Schema
    {
      "type": "array",
      "items": [
        {
          "type": "string",
          "enum": [
            "always",
            "never"
          ]
        },
        {
          "type": "string",
          "enum": [
            "ignore-interfaces"
          ]
        }
      ],
      "additionalItems": false
    }

    For more information see this page.

    Missing semicolon
    Open

    import type { Combo, StoriesHash } from '@storybook/api';
    Severity: Minor
    Found in lib/ui/src/containers/sidebar.tsx by tslint

    Rule: semicolon

    Enforces consistent semicolon usage at the end of every statement.

    Notes
    • Has Fix

    Config

    One of the following arguments must be provided:

    • "always" enforces semicolons at the end of every statement.
    • "never" disallows semicolons at the end of every statement except for when they are necessary.

    The following arguments may be optionally provided:

    • "ignore-interfaces" skips checking semicolons at the end of interface members.
    • "ignore-bound-class-methods" skips checking semicolons at the end of bound class methods.
    • "strict-bound-class-methods" disables any special handling of bound class methods and treats them as any other assignment. This option overrides "ignore-bound-class-methods".
    Examples
    "semicolon": true,always
    "semicolon": true,never
    "semicolon": true,always,ignore-interfaces
    "semicolon": true,always,ignore-bound-class-methods
    Schema
    {
      "type": "array",
      "items": [
        {
          "type": "string",
          "enum": [
            "always",
            "never"
          ]
        },
        {
          "type": "string",
          "enum": [
            "ignore-interfaces"
          ]
        }
      ],
      "additionalItems": false
    }

    For more information see this page.

    Missing semicolon
    Open

    import type { Combo, StoriesHash } from '@storybook/api';
    Severity: Minor
    Found in lib/ui/src/containers/sidebar.tsx by tslint

    Rule: semicolon

    Enforces consistent semicolon usage at the end of every statement.

    Notes
    • Has Fix

    Config

    One of the following arguments must be provided:

    • "always" enforces semicolons at the end of every statement.
    • "never" disallows semicolons at the end of every statement except for when they are necessary.

    The following arguments may be optionally provided:

    • "ignore-interfaces" skips checking semicolons at the end of interface members.
    • "ignore-bound-class-methods" skips checking semicolons at the end of bound class methods.
    • "strict-bound-class-methods" disables any special handling of bound class methods and treats them as any other assignment. This option overrides "ignore-bound-class-methods".
    Examples
    "semicolon": true,always
    "semicolon": true,never
    "semicolon": true,always,ignore-interfaces
    "semicolon": true,always,ignore-bound-class-methods
    Schema
    {
      "type": "array",
      "items": [
        {
          "type": "string",
          "enum": [
            "always",
            "never"
          ]
        },
        {
          "type": "string",
          "enum": [
            "ignore-interfaces"
          ]
        }
      ],
      "additionalItems": false
    }

    For more information see this page.

    unused expression, expected an assignment or function call
    Open

    import type { Combo, StoriesHash } from '@storybook/api';
    Severity: Minor
    Found in lib/ui/src/containers/sidebar.tsx by tslint

    Rule: no-unused-expression

    Disallows unused expression statements.

    Unused expressions are expression statements which are not assignments or function calls (and thus usually no-ops).

    Rationale

    Detects potential errors where an assignment or function call was intended.

    Config

    Three arguments may be optionally provided:

    • allow-fast-null-checks allows to use logical operators to perform fast null checks and perform method or function calls for side effects (e.g. e && e.preventDefault()).
    • allow-new allows 'new' expressions for side effects (e.g. new ModifyGlobalState();.
    • allow-tagged-template allows tagged templates for side effects (e.g. this.add\foo`;`.
    Examples
    "no-unused-expression": true
    "no-unused-expression": true,allow-fast-null-checks
    Schema
    {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "allow-fast-null-checks",
          "allow-new",
          "allow-tagged-template"
        ]
      },
      "minLength": 0,
      "maxLength": 3
    }

    For more information see this page.

    unused expression, expected an assignment or function call
    Open

    import type { Combo, StoriesHash } from '@storybook/api';
    Severity: Minor
    Found in lib/ui/src/containers/sidebar.tsx by tslint

    Rule: no-unused-expression

    Disallows unused expression statements.

    Unused expressions are expression statements which are not assignments or function calls (and thus usually no-ops).

    Rationale

    Detects potential errors where an assignment or function call was intended.

    Config

    Three arguments may be optionally provided:

    • allow-fast-null-checks allows to use logical operators to perform fast null checks and perform method or function calls for side effects (e.g. e && e.preventDefault()).
    • allow-new allows 'new' expressions for side effects (e.g. new ModifyGlobalState();.
    • allow-tagged-template allows tagged templates for side effects (e.g. this.add\foo`;`.
    Examples
    "no-unused-expression": true
    "no-unused-expression": true,allow-fast-null-checks
    Schema
    {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "allow-fast-null-checks",
          "allow-new",
          "allow-tagged-template"
        ]
      },
      "minLength": 0,
      "maxLength": 3
    }

    For more information see this page.

    Do not use comma operator here because it can be easily misunderstood or lead to unintended bugs.
    Open

    import type { Combo, StoriesHash } from '@storybook/api';
    Severity: Minor
    Found in lib/ui/src/containers/sidebar.tsx by tslint

    Rule: ban-comma-operator

    Disallows the comma operator to be used.

    Read more about the comma operator here.

    Rationale

    Using the comma operator can create a potential for many non-obvious bugs or lead to misunderstanding of code.

    Examples

    foo((bar, baz)); // evaluates to 'foo(baz)' because of the extra parens - confusing and not obvious
    switch (foo) {
        case 1, 2: // equals 'case 2' - probably intended 'case 1: case2:'
            return true;
        case 3:
            return false;
    }
    let x = (y = 1, z = 2); // x is equal to 2 - this may not be immediately obvious.
    Examples
    "ban-comma-operator": true

    For more information see this page.

    There are no issues that match your filters.

    Category
    Status