fbredius/storybook

View on GitHub
lib/api/src/modules/stories.ts

Summary

Maintainability
F
5 days
Test Coverage

Function init has a Cognitive Complexity of 159 (exceeds 5 allowed). Consider refactoring.
Open

export const init: ModuleFn = ({
  fullAPI,
  store,
  navigate,
  provider,
Severity: Minor
Found in lib/api/src/modules/stories.ts - About 3 days 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 stories.ts has 460 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import global from 'global';
import { toId, sanitize } from '@storybook/csf';
import {
  STORY_PREPARED,
  UPDATE_STORY_ARGS,
Severity: Minor
Found in lib/api/src/modules/stories.ts - About 7 hrs to fix

    Function initModule has 97 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      const initModule = async () => {
        // On initial load, the local iframe will select the first story (or other "selection specifier")
        // and emit STORY_SPECIFIED with the id. We need to ensure we respond to this change.
        fullAPI.on(
          STORY_SPECIFIED,
    Severity: Major
    Found in lib/api/src/modules/stories.ts - About 3 hrs to fix

      Function selectStory has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          selectStory: (kindOrId = undefined, story = undefined, options = {}) => {
            const { ref, viewMode: viewModeFromArgs } = options;
            const {
              viewMode: viewModeFromState = 'story',
              storyId,
      Severity: Minor
      Found in lib/api/src/modules/stories.ts - About 1 hr to fix

        Avoid deeply nested control flow statements.
        Open

                    if (foundId) {
                      api.selectStory(foundId, undefined, options);
                    }
        Severity: Major
        Found in lib/api/src/modules/stories.ts - About 45 mins to fix

          Consider simplifying this complex logical expression.
          Open

                if (!story) {
                  const s = kindOrId ? hash[kindOrId] || hash[sanitize(kindOrId)] : hash[kindSlug];
                  // eslint-disable-next-line no-nested-ternary
                  const id = s ? (s.children ? s.children[0] : s.id) : kindOrId;
                  let viewMode =
          Severity: Major
          Found in lib/api/src/modules/stories.ts - About 40 mins to fix

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                resetStoryArgs: (story, argNames?: [string]) => {
                  const { id: storyId, refId } = story;
                  fullAPI.emit(RESET_STORY_ARGS, {
                    storyId,
                    argNames,
            Severity: Major
            Found in lib/api/src/modules/stories.ts and 1 other location - About 1 hr to fix
            lib/api/src/modules/stories.ts on lines 335..344

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 71.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                updateStoryArgs: (story, updatedArgs) => {
                  const { id: storyId, refId } = story;
                  fullAPI.emit(UPDATE_STORY_ARGS, {
                    storyId,
                    updatedArgs,
            Severity: Major
            Found in lib/api/src/modules/stories.ts and 1 other location - About 1 hr to fix
            lib/api/src/modules/stories.ts on lines 345..354

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 71.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

            interface Meta {
              ref?: ComposedRef;
              source?: string;
              sourceType?: 'local' | 'external';
              sourceLocation?: string;
            Severity: Major
            Found in lib/api/src/modules/stories.ts and 1 other location - About 1 hr to fix
            lib/api/src/lib/events.ts on lines 6..14

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 64.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                  const firstStory = Object.keys(storiesHash).find(
                    (k) => !(storiesHash[k].children || Array.isArray(storiesHash[k]))
                  );
            Severity: Minor
            Found in lib/api/src/modules/stories.ts and 1 other location - About 55 mins to fix
            lib/api/src/modules/stories.ts on lines 231..233

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 53.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                  const lookupList = Object.keys(hash).filter(
                    (k) => !(hash[k].children || Array.isArray(hash[k]))
                  );
            Severity: Minor
            Found in lib/api/src/modules/stories.ts and 1 other location - About 55 mins to fix
            lib/api/src/modules/stories.ts on lines 264..266

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 53.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            missing whitespace
            Open

              StoryIndex,
            } from '../lib/stories';
            Severity: Minor
            Found in lib/api/src/modules/stories.ts by tslint

            Rule: whitespace

            Enforces whitespace style conventions.

            Rationale

            Helps maintain a readable, consistent style in your codebase.

            Notes
            • Has Fix

            Config

            Several arguments may be optionally provided:

            • "check-branch" checks branching statements (if/else/for/while) are followed by whitespace.
            • "check-decl"checks that variable declarations have whitespace around the equals token.
            • "check-operator" checks for whitespace around operator tokens.
            • "check-module" checks for whitespace in import & export statements.
            • "check-separator" checks for whitespace after separator tokens (,/;).
            • "check-rest-spread" checks that there is no whitespace after rest/spread operator (...).
            • "check-type" checks for whitespace before a variable type specification.
            • "check-typecast" checks for whitespace between a typecast and its target.
            • "check-type-operator" checks for whitespace between type operators | and &.
            • "check-preblock" checks for whitespace before the opening brace of a block.
            • "check-postbrace" checks for whitespace after an opening brace.
            Examples
            "whitespace": true,check-branch,check-operator,check-typecast
            Schema
            {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "check-branch",
                  "check-decl",
                  "check-operator",
                  "check-module",
                  "check-separator",
                  "check-rest-spread",
                  "check-type",
                  "check-typecast",
                  "check-type-operator",
                  "check-preblock",
                  "check-postbrace"
                ]
              },
              "minLength": 0,
              "maxLength": 11
            }

            For more information see this page.

            Type assertion on object literals is forbidden, use a type annotation instead.
            Open

            }, {} as Record<string, () => void>);
            Severity: Minor
            Found in lib/api/src/modules/stories.ts by tslint

            Rule: no-object-literal-type-assertion

            Forbids an object literal to appear in a type assertion expression. Casting to any or to unknown is still allowed.

            Rationale

            Always prefer const x: T = { ... }; to const x = { ... } as T;. The type assertion in the latter case is either unnecessary or hides an error. The compiler will warn for excess properties with this syntax, but not missing required fields. For example: const x: { foo: number } = {} will fail to compile, but const x = {} as { foo: number } will succeed. Additionally, the const assertion const x = { foo: 1 } as const, introduced in TypeScript 3.4, is considered beneficial and is ignored by this rule.

            Notes
            • TypeScript Only

            Config

            One option may be configured:

            • allow-arguments allows type assertions to be used on object literals inside call expressions.
            Examples
            "no-object-literal-type-assertion": true
            "no-object-literal-type-assertion": true,[object Object]
            Schema
            {
              "type": "object",
              "properties": {
                "allow-arguments": {
                  "type": "boolean"
                }
              },
              "additionalProperties": false
            }

            For more information see this page.

            unused expression, expected an assignment or function call
            Open

            } from '../lib/stories';
            Severity: Minor
            Found in lib/api/src/modules/stories.ts 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

              StoriesHash,
              Story,
              Group,
              StoryId,
              Root,
            Severity: Minor
            Found in lib/api/src/modules/stories.ts 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.

            Type assertion on object literals is forbidden, use a type annotation instead.
            Open

                    stories[storyId] = {
                      ...stories[storyId],
                      ...update,
                    } as Story;
            Severity: Minor
            Found in lib/api/src/modules/stories.ts by tslint

            Rule: no-object-literal-type-assertion

            Forbids an object literal to appear in a type assertion expression. Casting to any or to unknown is still allowed.

            Rationale

            Always prefer const x: T = { ... }; to const x = { ... } as T;. The type assertion in the latter case is either unnecessary or hides an error. The compiler will warn for excess properties with this syntax, but not missing required fields. For example: const x: { foo: number } = {} will fail to compile, but const x = {} as { foo: number } will succeed. Additionally, the const assertion const x = { foo: 1 } as const, introduced in TypeScript 3.4, is considered beneficial and is ignored by this rule.

            Notes
            • TypeScript Only

            Config

            One option may be configured:

            • allow-arguments allows type assertions to be used on object literals inside call expressions.
            Examples
            "no-object-literal-type-assertion": true
            "no-object-literal-type-assertion": true,[object Object]
            Schema
            {
              "type": "object",
              "properties": {
                "allow-arguments": {
                  "type": "boolean"
                }
              },
              "additionalProperties": false
            }

            For more information see this page.

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

              StoriesHash,
              Story,
              Group,
              StoryId,
              Root,
            Severity: Minor
            Found in lib/api/src/modules/stories.ts 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.

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

              StoriesHash,
              Story,
              Group,
              StoryId,
              Root,
            Severity: Minor
            Found in lib/api/src/modules/stories.ts 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.

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

              StoriesHash,
              Story,
            Severity: Minor
            Found in lib/api/src/modules/stories.ts 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.

            unused expression, expected an assignment or function call
            Open

              StoriesHash,
              Story,
              Group,
              StoryId,
              Root,
            Severity: Minor
            Found in lib/api/src/modules/stories.ts 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

            } from '../lib/stories';
            Severity: Minor
            Found in lib/api/src/modules/stories.ts 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

              StoriesHash,
              Story,
              Group,
            Severity: Minor
            Found in lib/api/src/modules/stories.ts 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.

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

              StoriesHash,
              Story,
              Group,
              StoryId,
              Root,
            Severity: Minor
            Found in lib/api/src/modules/stories.ts 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.

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

              StoriesHash,
              Story,
              Group,
              StoryId,
            Severity: Minor
            Found in lib/api/src/modules/stories.ts 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.

            statements are not aligned
            Open

            } from '../lib/stories';
            Severity: Minor
            Found in lib/api/src/modules/stories.ts by tslint

            Rule: align

            Enforces vertical alignment.

            Rationale

            Helps maintain a readable, consistent style in your codebase.

            Consistent alignment for code statements helps keep code readable and clear. Statements misaligned from the standard can be harder to read and understand.

            Notes
            • Has Fix

            Config

            Five arguments may be optionally provided:

            • "parameters" checks alignment of function parameters.
            • "arguments" checks alignment of function call arguments.
            • "statements" checks alignment of statements.
            • "members" checks alignment of members of classes, interfaces, type literal, object literals and object destructuring.
            • "elements" checks alignment of elements of array literals, array destructuring and tuple types.
            Examples
            "align": true,parameters,statements
            Schema
            {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "arguments",
                  "elements",
                  "members",
                  "parameters",
                  "statements"
                ]
              },
              "minLength": 1,
              "maxLength": 5
            }

            For more information see this page.

            Type assertion on object literals is forbidden, use a type annotation instead.
            Open

                    storiesHash[storyId] = {
                      ...storiesHash[storyId],
                      ...update,
                    } as Story;
            Severity: Minor
            Found in lib/api/src/modules/stories.ts by tslint

            Rule: no-object-literal-type-assertion

            Forbids an object literal to appear in a type assertion expression. Casting to any or to unknown is still allowed.

            Rationale

            Always prefer const x: T = { ... }; to const x = { ... } as T;. The type assertion in the latter case is either unnecessary or hides an error. The compiler will warn for excess properties with this syntax, but not missing required fields. For example: const x: { foo: number } = {} will fail to compile, but const x = {} as { foo: number } will succeed. Additionally, the const assertion const x = { foo: 1 } as const, introduced in TypeScript 3.4, is considered beneficial and is ignored by this rule.

            Notes
            • TypeScript Only

            Config

            One option may be configured:

            • allow-arguments allows type assertions to be used on object literals inside call expressions.
            Examples
            "no-object-literal-type-assertion": true
            "no-object-literal-type-assertion": true,[object Object]
            Schema
            {
              "type": "object",
              "properties": {
                "allow-arguments": {
                  "type": "boolean"
                }
              },
              "additionalProperties": false
            }

            For more information see this page.

            block is empty
            Open

                () => {},
            Severity: Minor
            Found in lib/api/src/modules/stories.ts by tslint

            Rule: no-empty

            Disallows empty blocks.

            Blocks with a comment inside are not considered empty.

            Rationale

            Empty blocks are often indicators of missing code.

            Config

            If allow-empty-catch is specified, then catch blocks are allowed to be empty. If allow-empty-functions is specified, then function definitions are allowed to be empty.

            Examples
            "no-empty": true
            "no-empty": true,allow-empty-catch
            "no-empty": true,allow-empty-functions
            "no-empty": true,allow-empty-catch,allow-empty-functions
            Schema
            {
              "type": "array",
              "items": {
                "anyOf": [
                  {
                    "type": "string",
                    "enum": [
                      "allow-empty-catch"
                    ]
                  },
                  {
                    "type": "string",
                    "enum": [
                      "allow-empty-functions"
                    ]
                  }
                ]
              }
            }

            For more information see this page.

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

              StoriesHash,
              Story,
              Group,
              StoryId,
              Root,
            Severity: Minor
            Found in lib/api/src/modules/stories.ts 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.

            Missing semicolon
            Open

            } from '../lib/stories';
            Severity: Minor
            Found in lib/api/src/modules/stories.ts 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

              StoryIndex,
            Severity: Minor
            Found in lib/api/src/modules/stories.ts 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 {
            Severity: Minor
            Found in lib/api/src/modules/stories.ts 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.

            There are no issues that match your filters.

            Category
            Status