Showing 1,982 of 1,982 total issues

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

      StringLiteral({ node }) {
        // unicode escape
        if (node.extra && /\\[u]/gi.test(node.extra.raw)) {
          node.extra = undefined;
        }
Severity: Major
Found in packages/babel-plugin-transform-literals/src/index.js and 1 other location - About 1 hr to fix
packages/babel-plugin-transform-literals/src/index.js on lines 10..15

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

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

      NumericLiteral({ node }) {
        // number octal like 0b10 or 0o70
        if (node.extra && /^0[ob]/i.test(node.extra.raw)) {
          node.extra = undefined;
        }
Severity: Major
Found in packages/babel-plugin-transform-literals/src/index.js and 1 other location - About 1 hr to fix
packages/babel-plugin-transform-literals/src/index.js on lines 17..22

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

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

export function loadPlugin(
  name: string,
  dirname: string,
): { filepath: string, value: mixed } {
  throw new Error(
Severity: Major
Found in packages/babel-core/src/config/files/index-browser.js and 1 other location - About 1 hr to fix
packages/babel-core/src/config/files/index-browser.js on lines 82..89

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

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

export function loadPreset(
  name: string,
  dirname: string,
): { filepath: string, value: mixed } {
  throw new Error(
Severity: Major
Found in packages/babel-core/src/config/files/index-browser.js and 1 other location - About 1 hr to fix
packages/babel-core/src/config/files/index-browser.js on lines 73..80

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

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.string)) {
        node.id = this.parseExprAtom();
      } else {
        node.id = this.parseIdentifier();
      }
Severity: Major
Found in packages/babel-parser/src/plugins/flow.js and 1 other location - About 1 hr to fix
packages/babel-parser/src/plugins/jsx/index.js on lines 341..345

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

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.braceR)) {
        node.expression = this.jsxParseEmptyExpression();
      } else {
        node.expression = this.parseExpression();
      }
Severity: Major
Found in packages/babel-parser/src/plugins/jsx/index.js and 1 other location - About 1 hr to fix
packages/babel-parser/src/plugins/flow.js on lines 376..380

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

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

defineType("RecordExpression", {
  visitor: ["properties"],
  aliases: ["Expression"],
  fields: {
    properties: {
Severity: Major
Found in packages/babel-types/src/definitions/experimental.js and 1 other location - About 1 hr to fix
packages/babel-types/src/definitions/core.js on lines 713..726

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

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

defineType("ObjectExpression", {
  visitor: ["properties"],
  aliases: ["Expression"],
  fields: {
    properties: {
Severity: Major
Found in packages/babel-types/src/definitions/core.js and 1 other location - About 1 hr to fix
packages/babel-types/src/definitions/experimental.js on lines 314..327

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

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

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

      LogicalExpression(path) {
        const { node, scope } = path;
        if (node.operator !== "??") {
          return;
        }

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

        getTokenFromCode(code: number): void {
          if (this.state.inPropertyName) return super.getTokenFromCode(code);
    
          const context = this.curContext();
    
    
    Severity: Minor
    Found in packages/babel-parser/src/plugins/jsx/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 parseExportDeclaration has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            parseExportDeclaration(node: N.ExportNamedDeclaration): ?N.Declaration {
              if (this.isContextual("type")) {
                node.exportKind = "type";
        
                const declarationNode = this.startNode();
        Severity: Minor
        Found in packages/babel-parser/src/plugins/flow.js - About 1 hr to fix

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

            parseTryStatement(node: N.TryStatement): N.TryStatement {
              this.next();
          
              node.block = this.parseBlock();
              node.handler = null;
          Severity: Minor
          Found in packages/babel-parser/src/parser/statement.js - About 1 hr to fix

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

              parseBindingList(
                close: TokenType,
                closeCharCode: $Values<typeof charCodes>,
                allowEmpty?: boolean,
                allowModifiers?: boolean,
            Severity: Minor
            Found in packages/babel-parser/src/parser/lval.js - About 1 hr to fix

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

                  pushArrayPattern(pattern, arrayRef) {
                    if (!pattern.elements) return;
              
                    // optimise basic array destructuring of an array expression
                    //
              Severity: Minor
              Found in packages/babel-plugin-transform-destructuring/src/index.js - About 1 hr to fix

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

                export default function getModuleName(
                  rootOpts: Object,
                  pluginOpts: Object,
                ): ?string {
                  const {
                Severity: Minor
                Found in packages/babel-helper-module-transforms/src/get-module-name.js - About 1 hr to fix

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

                  export function isBlockParent(node: ?Object, opts?: Object): boolean {
                    if (!node) return false;
                  
                    const nodeType = node.type;
                    if (
                  Severity: Minor
                  Found in packages/babel-types/src/validators/generated/index.js - About 1 hr to fix

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

                      function unwrapArguments(node, scope) {
                        const init = [];
                        for (let i = 0; i < node.arguments.length; i++) {
                          if (
                            !t.isArgumentPlaceholder(node.arguments[i]) &&
                    Severity: Minor
                    Found in packages/babel-plugin-proposal-partial-application/src/index.js - About 1 hr to fix

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

                        _maybeAddParen(str: string): void {
                          // see startTerminatorless() instance method
                          const parenPushNewlineState = this._parenPushNewlineState;
                          if (!parenPushNewlineState) return;
                      
                      
                      Severity: Minor
                      Found in packages/babel-generator/src/printer.js - About 1 hr to fix

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

                        function dedupDescriptors(
                          items: Array<UnloadedDescriptor>,
                        ): Array<UnloadedDescriptor> {
                          const map: Map<
                            Function,
                        Severity: Minor
                        Found in packages/babel-core/src/config/config-chain.js - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language