packages/babel-plugin-transform-typescript/src/index.js

Summary

Maintainability
C
1 day
Test Coverage

File index.js has 363 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { declare } from "@babel/helper-plugin-utils";
import syntaxTypeScript from "@babel/plugin-syntax-typescript";
import { types as t, template } from "@babel/core";
import { injectInitialization } from "@babel/helper-create-class-features-plugin";

Severity: Minor
Found in packages/babel-plugin-transform-typescript/src/index.js - About 4 hrs to fix

    Function Program has 73 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            Program(path, state) {
              const { file } = state;
              let fileJsxPragma = null;
    
              if (!GLOBAL_TYPES.has(path.node)) {
    Severity: Major
    Found in packages/babel-plugin-transform-typescript/src/index.js - About 2 hrs to fix

      Function field has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            field(path) {
              const { node } = path;
      
              if (!allowDeclareFields && node.declare) {
                throw path.buildCodeFrameError(
      Severity: Minor
      Found in packages/babel-plugin-transform-typescript/src/index.js - About 1 hr to fix

        Function constructor has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              constructor(path, classPath) {
                if (path.node.accessibility) path.node.accessibility = null;
                // Collects parameter properties so that we can add an assignment
                // for each of them in the constructor body
                //
        Severity: Minor
        Found in packages/babel-plugin-transform-typescript/src/index.js - About 1 hr to fix

          Consider simplifying this complex logical expression.
          Open

                      } else if (
                        stmt.isTSTypeAliasDeclaration() ||
                        stmt.isTSDeclareFunction() ||
                        stmt.isTSInterfaceDeclaration() ||
                        stmt.isClassDeclaration({ declare: true }) ||
          Severity: Major
          Found in packages/babel-plugin-transform-typescript/src/index.js - About 1 hr to fix

            Avoid deeply nested control flow statements.
            Open

                              for (const importPath of importsToRemove) {
                                importPath.remove();
                              }
            Severity: Major
            Found in packages/babel-plugin-transform-typescript/src/index.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                if (
                                  binding &&
                                  isImportTypeOnly({
                                    binding,
                                    programPath: path,
              Severity: Major
              Found in packages/babel-plugin-transform-typescript/src/index.js - About 45 mins to fix

                There are no issues that match your filters.

                Category
                Status