danger / danger/danger-js

Automatic Babel Transformation problematic

Open
#557 20 comments 2 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
5.5k
Forks
381
Avg merge
2h 8m
Merged PRs (30d)
6

Description

Hey Orta!

Thanks for all your hard work on Danger. Fantastic tool 😃.

I'm running into an issue with the automatic Babel transformation that I wanted to discuss with you and any other collaborators before submitting a Pull Request.

My project is a pretty standard webpack/babel compiled front-end application. I'm running Danger on node 8.x, so I really do _not_ need Babel transformation of my `dangerfile`.

Right now, because of my `babel-preset-env` config for builds targeting web browsers, template literals in my `dangerfile` are being compiled to ES5. This would be fine, except my `.babelrc` is setup to use `transform-runtime`. This is problematic because Babel 6 has a bug where `transform-runtime` injects import declarations rather than `require` calls. After this happens, Danger fails on calls to node's `module._compile`.

I can work around this issue by moving everything in my Babel config to use the `env` feature temporarily, and have no "default" babel config. However, I'm concerned that the automatic Babel transformation in Danger without an opt-out is a bit heavy-handed.

Would you be willing to accept a PR that disables Babel/TypeScript transformation?

Contributor guide

Open the contributing guide

Research direction

Start by tracing Danger's automatic Babel/TypeScript transformation path and its interaction with Node's module._compile; the issue does not name a source file or test. Done means the transformation behavior can be disabled or opted out of without breaking supported dangerfiles, with coverage for the reported transform-runtime scenario.

Written by the indexing model from the issue text.

Assessment

Tech stack
babel, node.js, typescript
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.