New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request: `babel --settings` for bug reports #2960

Open
kzc opened this Issue Nov 10, 2015 · 17 comments

Comments

Projects
None yet
@kzc

kzc commented Nov 10, 2015

Having a command line option to dump all the presets and plugins (with versions) being used by babel would be useful.

This would help to avoid the bug report back and forth: "provide your .babelrc or what plugins/presets you are using", and would be less error prone. Also would be a good way to verify your own babel set up.

The format of the settings dump would be canonical and unambiguous whether .babelrc or command line flags are used. Perhaps some basic sanity checking could be done for the presets and plugins specified as well.

@jamiebuilds

This comment has been minimized.

Show comment
Hide comment
@jamiebuilds

jamiebuilds Nov 11, 2015

Contributor

I would argue that there should be more information in the error output with instructions on what to do.

node v0.12.7
npm v3.3.10
babel 6.1.2 (babel-core 6.1.2)
{ "presets": ["..."], "plugins": ["..."], "options": "go", "here": "so", "we": "can", "debug": "them" }

Syntax Error: A short message about the error itself

  1 | class Foo {
> 2 |   constructor()
    |                ^
  3 | }

Some instructions on what to do next about this error. (Either open an issue, or definitely don't open an issue)
Explain that you should include this text in the issue.

npm does something very similar:

npm ERR! Darwin 15.0.0
npm ERR! argv "node" "/usr/local/bin/npm" "run" "foo"
npm ERR! node v0.12.7
npm ERR! npm  v3.3.10
npm ERR! file /Users/thejameskyle/Projects/CloudFlare/cf-www-next/package.json
npm ERR! code EJSONPARSE

npm ERR! Failed to parse json
npm ERR! Unexpected token '\\' at 1:1
npm ERR! \{
npm ERR! ^
npm ERR! File: /Users/thejameskyle/Projects/CloudFlare/cf-www-next/package.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR!
npm ERR! This is not a bug in npm.
npm ERR! Tell the package author to fix their package.json file. JSON.parse

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/thejameskyle/Projects/CloudFlare/cf-www-next/npm-debug.log
Contributor

jamiebuilds commented Nov 11, 2015

I would argue that there should be more information in the error output with instructions on what to do.

node v0.12.7
npm v3.3.10
babel 6.1.2 (babel-core 6.1.2)
{ "presets": ["..."], "plugins": ["..."], "options": "go", "here": "so", "we": "can", "debug": "them" }

Syntax Error: A short message about the error itself

  1 | class Foo {
> 2 |   constructor()
    |                ^
  3 | }

Some instructions on what to do next about this error. (Either open an issue, or definitely don't open an issue)
Explain that you should include this text in the issue.

npm does something very similar:

npm ERR! Darwin 15.0.0
npm ERR! argv "node" "/usr/local/bin/npm" "run" "foo"
npm ERR! node v0.12.7
npm ERR! npm  v3.3.10
npm ERR! file /Users/thejameskyle/Projects/CloudFlare/cf-www-next/package.json
npm ERR! code EJSONPARSE

npm ERR! Failed to parse json
npm ERR! Unexpected token '\\' at 1:1
npm ERR! \{
npm ERR! ^
npm ERR! File: /Users/thejameskyle/Projects/CloudFlare/cf-www-next/package.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR!
npm ERR! This is not a bug in npm.
npm ERR! Tell the package author to fix their package.json file. JSON.parse

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/thejameskyle/Projects/CloudFlare/cf-www-next/npm-debug.log
@kzc

This comment has been minimized.

Show comment
Hide comment
@kzc

kzc Nov 11, 2015

there should be more information in the error output with instructions on what to do

That would also be good. I'd just suggest it be enabled as an opt-in in conjunction with a verbose flag.

Keep in mind that showing the settings is something that would be useful even when there is no error - or no source code for that matter.

$ babel --settings
node v0.12.7
babel 6.1.2 (babel-core 6.1.2)
{ "presets": ["..."], "plugins": ["..."], "options": "go", "here": "so", "we": "can", "debug": "them" }

It could verify that your babel environment is what you think it is.

kzc commented Nov 11, 2015

there should be more information in the error output with instructions on what to do

That would also be good. I'd just suggest it be enabled as an opt-in in conjunction with a verbose flag.

Keep in mind that showing the settings is something that would be useful even when there is no error - or no source code for that matter.

$ babel --settings
node v0.12.7
babel 6.1.2 (babel-core 6.1.2)
{ "presets": ["..."], "plugins": ["..."], "options": "go", "here": "so", "we": "can", "debug": "them" }

It could verify that your babel environment is what you think it is.

@clintwood

This comment has been minimized.

Show comment
Hide comment
@clintwood

clintwood Nov 11, 2015

Contributor

+1, @kzc - this would have saved some head scratching and as you mentioned looking at the babeljs slack channel and issues here if --settings was implemented and mentioned right up front in the readme this would reduce the high percentage of questions related to people just not setting correct plugins (or any at all in many cases)...

Contributor

clintwood commented Nov 11, 2015

+1, @kzc - this would have saved some head scratching and as you mentioned looking at the babeljs slack channel and issues here if --settings was implemented and mentioned right up front in the readme this would reduce the high percentage of questions related to people just not setting correct plugins (or any at all in many cases)...

@hzoo hzoo added the enhancement label Nov 11, 2015

@loganfsmyth

This comment has been minimized.

Show comment
Hide comment
@loganfsmyth

loganfsmyth Nov 15, 2015

Member

I also had something like this kicking around in my head, seems like it would be handy. Not sure it should be part of the babel command though. Keep in mind it would need to take a specific filename as an argument, since a project may have multiple .babelrc files in subdirectories.

Member

loganfsmyth commented Nov 15, 2015

I also had something like this kicking around in my head, seems like it would be handy. Not sure it should be part of the babel command though. Keep in mind it would need to take a specific filename as an argument, since a project may have multiple .babelrc files in subdirectories.

@kzc

This comment has been minimized.

Show comment
Hide comment
@kzc

kzc Nov 15, 2015

The advantage of being part of the babel command itself would be that it would show you exactly how babel resolves all options, configuration file(s) and command line arguments without performing the actual transpile. It's the most convenient place for it.

babel [optionally any flags and filenames] --settings

I don't know if there's already a babel verbose flag that shows the order of the stages and plugin passes, but perhaps it could show that too.

kzc commented Nov 15, 2015

The advantage of being part of the babel command itself would be that it would show you exactly how babel resolves all options, configuration file(s) and command line arguments without performing the actual transpile. It's the most convenient place for it.

babel [optionally any flags and filenames] --settings

I don't know if there's already a babel verbose flag that shows the order of the stages and plugin passes, but perhaps it could show that too.

@hzoo hzoo removed the enhancement label Jan 23, 2016

@aleclarson

This comment has been minimized.

Show comment
Hide comment
@aleclarson

aleclarson Sep 21, 2016

Are there any plans to implement this? 😄

aleclarson commented Sep 21, 2016

Are there any plans to implement this? 😄

@hzoo

This comment has been minimized.

Show comment
Hide comment
@hzoo

hzoo Sep 21, 2016

Member

yep definitely, would only make maintainers lives easier anyway (easier/faster/better quality bug reports)

Member

hzoo commented Sep 21, 2016

yep definitely, would only make maintainers lives easier anyway (easier/faster/better quality bug reports)

@kaicataldo

This comment has been minimized.

Show comment
Hide comment
@kaicataldo

kaicataldo Sep 21, 2016

Member

I have a few other open source commitments right now, but this seems like something interesting to work on - might be interested in trying my hand at this :) If someone else is ready to take this on now though, please feel free!

Member

kaicataldo commented Sep 21, 2016

I have a few other open source commitments right now, but this seems like something interesting to work on - might be interested in trying my hand at this :) If someone else is ready to take this on now though, please feel free!

@sstern6

This comment has been minimized.

Show comment
Hide comment
@sstern6

sstern6 Nov 1, 2016

Contributor

I have some time to tackle this, this will be my first PR to Babel, so ill give it a shot. Will hop in the slack channel if I have any qs.

Thanks!

Contributor

sstern6 commented Nov 1, 2016

I have some time to tackle this, this will be my first PR to Babel, so ill give it a shot. Will hop in the slack channel if I have any qs.

Thanks!

@kaicataldo

This comment has been minimized.

Show comment
Hide comment
@kaicataldo

kaicataldo Nov 1, 2016

Member

Go for it!

Member

kaicataldo commented Nov 1, 2016

Go for it!

@hzoo

This comment has been minimized.

Show comment
Hide comment
@hzoo

hzoo Nov 1, 2016

Member

Can check what yarn does on error https://github.com/yarnpkg/yarn/blob/5fec1fc00c07e47f939712906d48df49394afc64/src/cli/index.js#L309-L339 although it also outputs a yarn-error.log similar to npm-debug.log

We'll probably want similar things (args, path, babel version(s), node version) - we'll probably need to figure out how get all preset/plugin locations (external presets), babelrc locations, plugin opts, etc

We can take it one at a time though

Member

hzoo commented Nov 1, 2016

Can check what yarn does on error https://github.com/yarnpkg/yarn/blob/5fec1fc00c07e47f939712906d48df49394afc64/src/cli/index.js#L309-L339 although it also outputs a yarn-error.log similar to npm-debug.log

We'll probably want similar things (args, path, babel version(s), node version) - we'll probably need to figure out how get all preset/plugin locations (external presets), babelrc locations, plugin opts, etc

We can take it one at a time though

@STRML

This comment has been minimized.

Show comment
Hide comment
@STRML

STRML Nov 17, 2016

Contributor

This could be really useful in combination with something that automatically opens up a ticket or provides a link to do so, with the format https://github.com/babel/babel/issues/new?title=foo&body=bar

Contributor

STRML commented Nov 17, 2016

This could be really useful in combination with something that automatically opens up a ticket or provides a link to do so, with the format https://github.com/babel/babel/issues/new?title=foo&body=bar

@apsdehal

This comment has been minimized.

Show comment
Hide comment
@apsdehal

apsdehal Dec 8, 2016

@hzoo Is someone working on this?

apsdehal commented Dec 8, 2016

@hzoo Is someone working on this?

@hzoo

This comment has been minimized.

Show comment
Hide comment
@hzoo

hzoo Dec 8, 2016

Member

Current wip pr is #4806, we can start with that or work on it from there

Member

hzoo commented Dec 8, 2016

Current wip pr is #4806, we can start with that or work on it from there

@stephenthecurt

This comment has been minimized.

Show comment
Hide comment
@stephenthecurt

stephenthecurt Jul 29, 2017

How do I get into the slack? Don't have a login.

stephenthecurt commented Jul 29, 2017

How do I get into the slack? Don't have a login.

@kaicataldo

This comment has been minimized.

Show comment
Hide comment
@kaicataldo

kaicataldo Jul 30, 2017

Member

@stephenlcurtis You can sign up here: https://slack.babeljs.io/

Member

kaicataldo commented Jul 30, 2017

@stephenlcurtis You can sign up here: https://slack.babeljs.io/

@jridgewell jridgewell closed this Aug 26, 2017

@jridgewell

This comment has been minimized.

Show comment
Hide comment
@jridgewell

jridgewell Aug 26, 2017

Member

Whoops.

Member

jridgewell commented Aug 26, 2017

Whoops.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment