fbredius/storybook

View on GitHub
app/angular/src/server/framework-preset-angular-ivy.ts

Summary

Maintainability
A
1 hr
Test Coverage

Function webpack has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const webpack = async (webpackConfig: Configuration, options: PresetOptions) => {
  const angularOptions = await options.presets.apply(
    'angularOptions',
    {} as {
      enableIvy?: boolean;
Severity: Minor
Found in app/angular/src/server/framework-preset-angular-ivy.ts - About 1 hr to fix

    Do not use the Function constructor to create functions.
    Open

      return new Function('modulePath', `return import(modulePath);`)(modulePath) as Promise<T>;

    Rule: function-constructor

    Prevents using the built-in Function constructor.

    Rationale

    Calling the constructor directly is similar to eval, which is a symptom of design issues. String inputs don't receive type checking and can cause performance issues, particularly when dynamically created.

    If you need to dynamically create functions, use "factory" functions that themselves return functions.

    Config

    Not configurable.

    Examples
    "function-constructor": true

    For more information see this page.

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

        {} as {
          enableIvy?: boolean;
        },

    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.

    There are no issues that match your filters.

    Category
    Status