danger / danger/danger-js

Add ability to disable one of Babel or TypeScript transpilation, but not the other

Open
#874 1 comment 1 reaction 0 assignees View on GitHub
You Can Do This
Dominant language
TypeScript
Stars
5.5k
Forks
381
Avg merge
2h 8m
Merged PRs (30d)
6

Description

I'm working on a project that uses both Babel and TypeScript. It has a dangerfile written in TypeScript that imports a JavaScript file. That JS file in turn imports a JS file from a package in `node_modules`. The issue is that the JS file uses the `new` keyword to instantiate an ES6 class defined in the JS file from the package. Danger uses Babel to transpile the file to ES5. The transpiled code doesn't use `new` to instantiate the ES6 class (which isn't transpiled because it's in `node_modules`), leading to a `Class constructor ClassName cannot be invoked without 'new'` error.

I know that there's a way to disable all transpilation. However, I want to keep transpiling TypeScript so that I can write the dangerfile in TypeScript. It would be useful to just be able to disable Babel transpilation while continuing to transpile TypeScript (or maybe vice versa for a different use case).

Contributor guide

Open the contributing guide

Research direction

No file or test is named. Start by locating the transpilation configuration and the code paths that invoke Babel and TypeScript; done means users can independently disable either transformer while the other remains active, including the reported JavaScript/TypeScript import case.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
build-system, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.