Skip to content
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

Allow override of edition choice through environment variable #10

Closed
damonmaria opened this issue Jun 28, 2016 · 6 comments
Closed

Allow override of edition choice through environment variable #10

damonmaria opened this issue Jun 28, 2016 · 6 comments
Assignees
Labels
enhancement Improvement or suggestion
Milestone

Comments

@damonmaria
Copy link

It would be useful to be able to blacklist syntaxes through environment variables. For example:

SYNTAX_BLACKLIST=esnext,let

I am having trouble with the Bevry sortobject package when run inside Wallaby. It is an intermittent problem and I can't create a useful test case. The problem arises when the source directory / esnext edition is used and while the require must have worked first time, later on it fails. I suspect Wallaby is doing some require tricks that Bevry editions can't cope with. I would like to force the es2015 edition in this environment.

@balupton
Copy link
Member

balupton commented Jun 29, 2016

@damonmaria this is a good idea, however I have reservations for anything that could change behaviour for other packages that aren't problematic

To best address this, is there any error messages that you are getting? Maybe I can improve other parts of the editions code. Alternatively, as a last workaround, perhaps it can be something like EDITIONS_SYNTAX_BLACKLIST_SORTOBJECT=esnext

For the meantime, you can probably get by with editing the package.json main property inside node_modules/sortobject/package.json

@damonmaria
Copy link
Author

Agree that it's a bit kludgey, and hides rather than solves the base problem.

All I see is a compilation error at a let variable definition in sortobject.

So are you suggesting with EDITIONS_SYNTAX_BLACKLIST_SORTOBJECT that the sortobject package would consume this environment variable, or that editions would scan for any environment variables prefixed by EDITIONS_SYNTAX_BLACKLIST_*? My thought is the later would be the way to go, but scoped packages might be tricky with the @ in the package name.

@balupton
Copy link
Member

All I see is a compilation error at a let variable definition in sortobject.

Would you be able to provide the full error log, or as much as possible?

My thought is the later would be the way to go, but scoped packages might be tricky with the @ in the package name.

The latter. Good point, will need to do a regex replace.

@damonmaria
Copy link
Author

Sorry for the delay. Error log from Wallaby with debug: true in Wallaby config:

Runtime error: 

Runtime error: /Users/damon/development/mindhive/inspector-gadget/node_modules/sortobject/source/index.js:5

Runtime error:      for ( let i = 0; i < obj.length; ++i ) {
                  ^

Sun, 03 Jul 2016 04:37:43 GMT wallaby:workers Sandbox (active) [1pwem] error: 
Sun, 03 Jul 2016 04:37:43 GMT wallaby:workers Failed to map the stack to user code, entry message: , stack: 

Sun, 03 Jul 2016 04:37:43 GMT wallaby:workers Sandbox (active) [1pwem] error: /Users/damon/development/mindhive/inspector-gadget/node_modules/sortobject/source/index.js:5
Sun, 03 Jul 2016 04:37:43 GMT wallaby:workers Failed to map the stack to user code, entry message: /Users/damon/development/mindhive/inspector-gadget/node_modules/sortobject/source/index.js:5, stack: /Users/damon/development/mindhive/inspector-gadget/node_modules/sortobject/source/index.js:5

Sun, 03 Jul 2016 04:37:43 GMT wallaby:workers Sandbox (active) [1pwem] error:       for ( let i = 0; i < obj.length; ++i ) {
Sun, 03 Jul 2016 04:37:43 GMT wallaby:workers Failed to map the stack to user code, entry message:      for ( let i = 0; i < obj.length; ++i ) {, stack:        for ( let i = 0; i < obj.length; ++i ) {
                  ^

Runtime error: 

Without the Runtime error: prefix on the log line the ^ caret points to the i in let i.

@balupton balupton added the enhancement Improvement or suggestion label Sep 11, 2016
@balupton balupton self-assigned this Sep 11, 2016
@balupton balupton added this to the Upcoming milestone Sep 11, 2016
@balupton
Copy link
Member

v1.2.0 now has the foundation for accomplishing this

@balupton
Copy link
Member

Added to v1.3.0. Usage EDITIONS_SYNTAX_BLACKLIST=esnext,blah,bleh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement or suggestion
Projects
None yet
Development

No branches or pull requests

2 participants