Uploaded image for project: 'Alloy'
  1. Alloy
  2. ALOY-1597

Use babel-code-frame to provide context when failing to parse code

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: CLI Release 7.0.2
    • Component/s: Tooling
    • Labels:
      None
    • Story Points:
      5
    • Sprint:
      2017 Sprint 26 Tooling, 2018 Sprint 01 Tooling

      Description

      Description

      Currently when we are parsing files if we hit a parser error then we output an error that isn't super helpful, it contains an line/column numbers but it would be a much better dev experience if we could show the code using babel-code-frame. We could also expand this to xml/tss parsing errors if the modules we use give us the locations in an easily consumable way

      current

      [ERROR] Error generating AST for "/Users/eharris/Documents/projects/repotest/apps/hyperloop-examples/app/controllers/index.js"
      [ERROR] Unexpected token (1:5)
      [ERROR] position 5
      

      babel-code-frame

      [INFO]   controller: "index.js"
      > 1 | x ==== foo
          |     ^
        2 | /**
        3 |  * I wrap code that executes on creation in a self-executing function just to
        4 |  * keep it organised, not to protect global scope like it would in alloy.js
      [ERROR] Error generating AST for "/Users/eharris/Documents/projects/repotest/apps/hyperloop-examples/app/controllers/index.js"
      

        Attachments

          Activity

            People

            • Assignee:
              eharris Ewan Harris
              Reporter:
              eharris Ewan Harris
              Reviewer:
              Feon Sua Xin Miao
            • Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                  Git Source Code