packages/babel-parser/src/plugins/typescript/index.js

Summary

Maintainability
F
1 wk
Test Coverage

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

// @flow

/*:: declare var invariant; */

import type { TokenType } from "../../tokenizer/types";
Severity: Major
Found in packages/babel-parser/src/plugins/typescript/index.js - About 5 days to fix

    Function parseMaybeAssign has 56 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        parseMaybeAssign(...args): N.Expression {
          // Note: When the JSX plugin is on, type assertions (`<T> x`) aren't valid syntax.
    
          let state: ?State;
          let jsx;
    Severity: Major
    Found in packages/babel-parser/src/plugins/typescript/index.js - About 2 hrs to fix

      Function tsParseNonArrayType has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          tsParseNonArrayType(): N.TsType {
            switch (this.state.type) {
              case tt.name:
              case tt._void:
              case tt._null: {
      Severity: Major
      Found in packages/babel-parser/src/plugins/typescript/index.js - About 2 hrs to fix

        Function tsParseDeclaration has 48 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            tsParseDeclaration(
              node: any,
              value: string,
              next: boolean,
            ): ?N.Declaration {
        Severity: Minor
        Found in packages/babel-parser/src/plugins/typescript/index.js - About 1 hr to fix

          Function parseSubscript has 46 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              parseSubscript(
                base: N.Expression,
                startPos: number,
                startLoc: Position,
                noCalls: ?boolean,
          Severity: Minor
          Found in packages/babel-parser/src/plugins/typescript/index.js - About 1 hr to fix

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

                tsParseTypeOrTypePredicateAnnotation(
                  returnToken: TokenType,
                ): N.TsTypeAnnotation {
                  return this.tsInType(() => {
                    const t: N.TsTypeAnnotation = this.startNode();
            Severity: Minor
            Found in packages/babel-parser/src/plugins/typescript/index.js - About 1 hr to fix

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

                  tsTryParseDeclare(nany: any): ?N.Declaration {
                    if (this.isLineTerminator()) {
                      return;
                    }
                    let starttype = this.state.type;
              Severity: Minor
              Found in packages/babel-parser/src/plugins/typescript/index.js - About 1 hr to fix

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

                    tsSkipParameterStart(): boolean {
                      if (this.match(tt.name) || this.match(tt._this)) {
                        this.next();
                        return true;
                      }
                Severity: Minor
                Found in packages/babel-parser/src/plugins/typescript/index.js - About 1 hr to fix

                  Function result has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          const result = this.tsTryParseAndCatch(() => {
                            if (!noCalls && this.atPossibleAsyncArrow(base)) {
                              // Almost certainly this is a generic async function `async <T>() => ...
                              // But it might be a call with a type argument `async<T>();`
                              const asyncArrowFn = this.tsTryParseGenericAsyncArrowFunction(
                  Severity: Minor
                  Found in packages/babel-parser/src/plugins/typescript/index.js - About 1 hr to fix

                    Function tsTryParseGenericAsyncArrowFunction has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        tsTryParseGenericAsyncArrowFunction(
                          startPos: number,
                          startLoc: Position,
                        ): ?N.ArrowFunctionExpression {
                          if (!this.isRelational("<")) {
                    Severity: Minor
                    Found in packages/babel-parser/src/plugins/typescript/index.js - About 1 hr to fix

                      Function parseAssignableListItem has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          parseAssignableListItem(
                            allowModifiers: ?boolean,
                            decorators: N.Decorator[],
                          ): N.Pattern | N.TSParameterProperty {
                            // Store original location/position to include modifiers in range
                      Severity: Minor
                      Found in packages/babel-parser/src/plugins/typescript/index.js - About 1 hr to fix

                        Function parseImport has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            parseImport(node: N.Node): N.AnyImport {
                              if (this.match(tt.name) || this.match(tt.star) || this.match(tt.braceL)) {
                                const ahead = this.lookahead();
                        
                                if (this.match(tt.name) && ahead.type === tt.eq) {
                        Severity: Minor
                        Found in packages/babel-parser/src/plugins/typescript/index.js - About 1 hr to fix

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

                              parseExprOp(
                                left: N.Expression,
                                leftStartPos: number,
                                leftStartLoc: Position,
                                minPrec: number,
                          Severity: Minor
                          Found in packages/babel-parser/src/plugins/typescript/index.js - About 1 hr to fix

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

                                parseClassMemberWithIsStatic(
                                  classBody: N.ClassBody,
                                  member: N.ClassMember | N.TsIndexSignature,
                                  state: { hadConstructor: boolean },
                                  isStatic: boolean,
                            Severity: Minor
                            Found in packages/babel-parser/src/plugins/typescript/index.js - About 1 hr to fix

                              Avoid too many return statements within this function.
                              Open

                                          return this.tsParseAmbientExternalModuleDeclaration(nany);
                              Severity: Major
                              Found in packages/babel-parser/src/plugins/typescript/index.js - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                            return this.tsParseModuleOrNamespaceDeclaration(node);
                                Severity: Major
                                Found in packages/babel-parser/src/plugins/typescript/index.js - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                              return this.tsParseDeclaration(nany, value, /* next */ true);
                                  Severity: Major
                                  Found in packages/babel-parser/src/plugins/typescript/index.js - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                                return this.tsParseModuleOrNamespaceDeclaration(node);
                                    Severity: Major
                                    Found in packages/babel-parser/src/plugins/typescript/index.js - About 30 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                              return arrow.node;
                                      Severity: Major
                                      Found in packages/babel-parser/src/plugins/typescript/index.js - About 30 mins to fix

                                        Avoid too many return statements within this function.
                                        Open

                                                return typeCast.node;
                                        Severity: Major
                                        Found in packages/babel-parser/src/plugins/typescript/index.js - About 30 mins to fix

                                          Avoid too many return statements within this function.
                                          Open

                                                      return this.tsParseTypeAliasDeclaration(node);
                                          Severity: Major
                                          Found in packages/babel-parser/src/plugins/typescript/index.js - About 30 mins to fix

                                            Avoid too many return statements within this function.
                                            Open

                                                    return jsx.node;
                                            Severity: Major
                                            Found in packages/babel-parser/src/plugins/typescript/index.js - About 30 mins to fix

                                              Avoid too many return statements within this function.
                                              Open

                                                    return this.tsParsePropertyOrMethodSignature(node, readonly);
                                              Severity: Major
                                              Found in packages/babel-parser/src/plugins/typescript/index.js - About 30 mins to fix

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

                                                      if (this.match(tt.braceL)) {
                                                        let braceStackCounter = 1;
                                                        this.next();
                                                
                                                        while (braceStackCounter > 0) {
                                                Severity: Major
                                                Found in packages/babel-parser/src/plugins/typescript/index.js and 1 other location - About 3 hrs to fix
                                                packages/babel-parser/src/plugins/typescript/index.js on lines 919..932

                                                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 109.

                                                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

                                                      if (this.match(tt.bracketL)) {
                                                        let braceStackCounter = 1;
                                                        this.next();
                                                
                                                        while (braceStackCounter > 0) {
                                                Severity: Major
                                                Found in packages/babel-parser/src/plugins/typescript/index.js and 1 other location - About 3 hrs to fix
                                                packages/babel-parser/src/plugins/typescript/index.js on lines 904..917

                                                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 109.

                                                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

                                                    typeCastToParameter(node: N.TsTypeCastExpression): N.Node {
                                                      node.expression.typeAnnotation = node.typeAnnotation;
                                                
                                                      this.resetEndLocation(
                                                        node.expression,
                                                Severity: Major
                                                Found in packages/babel-parser/src/plugins/typescript/index.js and 1 other location - About 2 hrs to fix
                                                packages/babel-parser/src/plugins/flow.js on lines 1656..1666

                                                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 92.

                                                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

                                                      if (this.eat(tt.question)) {
                                                        if (param.type !== "Identifier") {
                                                          this.raise(param.start, TSErrors.PatternIsOptional);
                                                        }
                                                
                                                
                                                Severity: Major
                                                Found in packages/babel-parser/src/plugins/typescript/index.js and 1 other location - About 2 hrs to fix
                                                packages/babel-parser/src/plugins/flow.js on lines 2395..2401

                                                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 83.

                                                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

                                                      } else {
                                                        this.scope.enter(SCOPE_TS_MODULE);
                                                        this.prodParam.enter(PARAM);
                                                        node.body = this.tsParseModuleBlock();
                                                        this.prodParam.exit();
                                                Severity: Major
                                                Found in packages/babel-parser/src/plugins/typescript/index.js and 1 other location - About 2 hrs to fix
                                                packages/babel-parser/src/plugins/typescript/index.js on lines 1317..1323

                                                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 79.

                                                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

                                                      if (this.match(tt.braceL)) {
                                                        this.scope.enter(SCOPE_TS_MODULE);
                                                        this.prodParam.enter(PARAM);
                                                        node.body = this.tsParseModuleBlock();
                                                        this.prodParam.exit();
                                                Severity: Major
                                                Found in packages/babel-parser/src/plugins/typescript/index.js and 1 other location - About 2 hrs to fix
                                                packages/babel-parser/src/plugins/typescript/index.js on lines 1296..1302

                                                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 79.

                                                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

                                                        if (context[context.length - 1] === ct.j_oTag) {
                                                          context.length -= 2;
                                                        } else if (context[context.length - 1] === ct.j_expr) {
                                                          context.length -= 1;
                                                        }
                                                Severity: Major
                                                Found in packages/babel-parser/src/plugins/typescript/index.js and 1 other location - About 2 hrs to fix
                                                packages/babel-parser/src/plugins/flow.js on lines 2661..2665

                                                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 77.

                                                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

                                                      if (
                                                        node.type === "AssignmentPattern" &&
                                                        node.typeAnnotation &&
                                                        node.right.start < node.typeAnnotation.start
                                                      ) {
                                                Severity: Major
                                                Found in packages/babel-parser/src/plugins/typescript/index.js and 1 other location - About 1 hr to fix
                                                packages/babel-parser/src/plugins/flow.js on lines 2416..2422

                                                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

                                                    tsInType<T>(cb: () => T): T {
                                                      const oldInType = this.state.inType;
                                                      this.state.inType = true;
                                                      try {
                                                        return cb();
                                                Severity: Major
                                                Found in packages/babel-parser/src/plugins/typescript/index.js and 1 other location - About 1 hr to fix
                                                packages/babel-parser/src/parser/expression.js on lines 2462..2471

                                                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 65.

                                                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 3 locations. Consider refactoring.
                                                Open

                                                          this.match(tt.colon) ||
                                                          this.match(tt.comma) ||
                                                          this.match(tt.question) ||
                                                          this.match(tt.eq)
                                                Severity: Major
                                                Found in packages/babel-parser/src/plugins/typescript/index.js and 2 other locations - About 1 hr to fix
                                                packages/babel-parser/src/plugins/flow.js on lines 1101..1104
                                                packages/babel-parser/src/plugins/flow.js on lines 1757..1760

                                                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 61.

                                                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

                                                      if ((methodOrProp: any).readonly && this.match(tt.parenL)) {
                                                        this.raise(methodOrProp.start, TSErrors.ClassMethodHasReadonly);
                                                      }
                                                Severity: Minor
                                                Found in packages/babel-parser/src/plugins/typescript/index.js and 1 other location - About 55 mins to fix
                                                packages/babel-parser/src/plugins/typescript/index.js on lines 2051..2053

                                                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

                                                      if ((methodOrProp: any).declare && this.match(tt.parenL)) {
                                                        this.raise(methodOrProp.start, TSErrors.ClassMethodHasDeclare);
                                                      }
                                                Severity: Minor
                                                Found in packages/babel-parser/src/plugins/typescript/index.js and 1 other location - About 55 mins to fix
                                                packages/babel-parser/src/plugins/typescript/index.js on lines 2047..2049

                                                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 3 locations. Consider refactoring.
                                                Open

                                                        case "type":
                                                          if (this.tsCheckLineTerminatorAndMatch(tt.name, next)) {
                                                            if (next) this.next();
                                                            return this.tsParseTypeAliasDeclaration(node);
                                                          }
                                                Severity: Major
                                                Found in packages/babel-parser/src/plugins/typescript/index.js and 2 other locations - About 45 mins to fix
                                                packages/babel-parser/src/plugins/typescript/index.js on lines 1524..1529
                                                packages/babel-parser/src/plugins/typescript/index.js on lines 1540..1545

                                                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 50.

                                                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 3 locations. Consider refactoring.
                                                Open

                                                        case "namespace":
                                                          if (this.tsCheckLineTerminatorAndMatch(tt.name, next)) {
                                                            if (next) this.next();
                                                            return this.tsParseModuleOrNamespaceDeclaration(node);
                                                          }
                                                Severity: Major
                                                Found in packages/babel-parser/src/plugins/typescript/index.js and 2 other locations - About 45 mins to fix
                                                packages/babel-parser/src/plugins/typescript/index.js on lines 1524..1529
                                                packages/babel-parser/src/plugins/typescript/index.js on lines 1547..1552

                                                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 50.

                                                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 3 locations. Consider refactoring.
                                                Open

                                                        case "interface":
                                                          if (this.tsCheckLineTerminatorAndMatch(tt.name, next)) {
                                                            if (next) this.next();
                                                            return this.tsParseInterfaceDeclaration(node);
                                                          }
                                                Severity: Major
                                                Found in packages/babel-parser/src/plugins/typescript/index.js and 2 other locations - About 45 mins to fix
                                                packages/babel-parser/src/plugins/typescript/index.js on lines 1540..1545
                                                packages/babel-parser/src/plugins/typescript/index.js on lines 1547..1552

                                                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 50.

                                                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

                                                      if (this.eat(tt.question)) {
                                                        node.optional = true;
                                                        // Include questionmark in location of node
                                                        // Don't use this.finishNode() as otherwise we might process comments twice and
                                                        // include already consumed parens
                                                Severity: Minor
                                                Found in packages/babel-parser/src/plugins/typescript/index.js and 1 other location - About 40 mins to fix
                                                packages/babel-parser/src/plugins/flow.js on lines 1978..1984

                                                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 49.

                                                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

                                                      if (!result.node) {
                                                        // $FlowIgnore
                                                        refNeedsArrowPos.start = result.error.pos || this.state.start;
                                                        return expr;
                                                      }
                                                Severity: Minor
                                                Found in packages/babel-parser/src/plugins/typescript/index.js and 1 other location - About 40 mins to fix
                                                packages/babel-parser/src/plugins/flow.js on lines 1829..1833

                                                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 49.

                                                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

                                                        if (elt.type !== "Identifier" && elt.type !== "AssignmentPattern") {
                                                          this.raise(pp.start, TSErrors.UnsupportedParameterPropertyKind);
                                                        }
                                                Severity: Minor
                                                Found in packages/babel-parser/src/plugins/typescript/index.js and 1 other location - About 35 mins to fix
                                                packages/babel-parser/src/parser/lval.js on lines 64..69

                                                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 47.

                                                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

                                                    checkLVal(
                                                      expr: N.Expression,
                                                      bindingType: BindingTypes = BIND_NONE,
                                                      checkClashes: ?{ [key: string]: boolean },
                                                      contextDescription: string,
                                                Severity: Minor
                                                Found in packages/babel-parser/src/plugins/typescript/index.js and 1 other location - About 35 mins to fix
                                                packages/babel-parser/src/plugins/flow.js on lines 2229..2243

                                                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 46.

                                                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

                                                          if (
                                                            pattern.type !== "Identifier" &&
                                                            pattern.type !== "RestElement" &&
                                                            pattern.type !== "ObjectPattern" &&
                                                            pattern.type !== "ArrayPattern"
                                                Severity: Minor
                                                Found in packages/babel-parser/src/plugins/typescript/index.js and 1 other location - About 35 mins to fix
                                                packages/babel-parser/src/parser/lval.js on lines 169..176

                                                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 46.

                                                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 3 locations. Consider refactoring.
                                                Open

                                                      if (this.match(tt.name) || this.match(tt.star) || this.match(tt.braceL)) {
                                                        const ahead = this.lookahead();
                                                
                                                        if (this.match(tt.name) && ahead.type === tt.eq) {
                                                          return this.tsParseImportEqualsDeclaration(node);
                                                Severity: Minor
                                                Found in packages/babel-parser/src/plugins/typescript/index.js and 2 other locations - About 35 mins to fix
                                                packages/babel-parser/src/parser/expression.js on lines 1831..1833
                                                packages/babel-parser/src/plugins/placeholders.js on lines 209..221

                                                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 46.

                                                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

                                                      if (
                                                        importNode.importKind === "type" &&
                                                        importNode.specifiers.length > 1 &&
                                                        importNode.specifiers[0].type === "ImportDefaultSpecifier"
                                                      ) {
                                                Severity: Minor
                                                Found in packages/babel-parser/src/plugins/typescript/index.js and 1 other location - About 35 mins to fix
                                                eslint/babel-eslint-plugin/src/rules/object-curly-spacing.js on lines 11..17

                                                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 46.

                                                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

                                                There are no issues that match your filters.

                                                Category
                                                Status