Update babel parser options #4688

merged 2 commits into from Oct 7, 2016


None yet

4 participants

Bug fix? yes
Breaking change? no
New feature? no
Deprecations? no
Spec compliancy? no
Tests added/pass? yes
Fixed tickets #4571
License MIT
Doc PR --

Should we also support strictMode (noted as TODO in https://github.com/babel/babylon/blob/master/src/options.js#L27)?

codecov-io commented Oct 6, 2016 edited

Current coverage is 88.83% (diff: 100%)

Merging #4688 into master will not change coverage

@@             master      #4688   diff @@
  Files           195        195          
  Lines         13794      13794          
  Methods        1427       1427          
  Messages          0          0          
  Branches       3176       3176          
  Hits          12254      12254          
  Misses         1540       1540          
  Partials          0          0          

Powered by Codecov. Last update 33eb56a...cbb25a7


Thanks. I added one comment that I'm not sure about

- plugins: []
+ allowImportExportEverywhere: this.opts.allowImportExportEverywhere,
+ allowReturnOutsideFunction: this.opts.allowReturnOutsideFunction,
+ allowSuperOutsideMethod: this.opts.allowSuperOutsideMethod,
danez Oct 7, 2016 edited Member

did you try if you can set this options? I think that the OptionsManager would throw an Error when trying to set these options in e.g babel.transform(code, { allowImportExportEverywhere: true }) because it does not know the options. So maybe we should only set sourceType, sourceFilename and plugins here because the rest of the options could now be set via the new parserOpts option anyway. https://github.com/babel/babel/blob/master/CHANGELOG.md#rocket-new-feature-1

danez Oct 7, 2016 Member

Same also applies for the strictMode I think.

existentialism Oct 7, 2016 Member

You're right, not sure why I thought it worked before. Updated!

hzoo Oct 7, 2016 Member

Yep I was going to mention that too - if there are invalid might as well not use them and get everyone to use parserOpts instead

@danez danez added the tag: polish label Oct 7, 2016
@existentialism existentialism Update babel parser options
danez approved these changes Oct 7, 2016 View changes
sourceType?: "module" | "script";
- filename?: string;
- features?: Object;
plugins?: Object;
hzoo Oct 7, 2016 Member

I guess plugins is an Array here - Array<Object>?

@hzoo hzoo update [skip ci]
@hzoo hzoo merged commit 0aa3ac2 into babel:master Oct 7, 2016

1 check was pending

ci/circleci CircleCI is running your tests
danez commented on lib/parser.js in 45e98b5 Oct 7, 2016 edited

I think it is Array String>

hzoo replied Oct 7, 2016

Oh your right, funny thing is we aren't using flow atm https://github.com/babel/babel/blob/master/Makefile#L49 - we can do the same thing we did for eslint though and turn it back on and fix all our errors

danez replied Oct 7, 2016

yeah good idea. we could also set it to be allowed to fail for as long we haven't fixed it.

@existentialism existentialism deleted the existentialism:babylon-parser-opts branch Dec 3, 2016
@panagosg7 panagosg7 added a commit to panagosg7/babel that referenced this pull request Jan 17, 2017
@existentialism @panagosg7 existentialism + panagosg7 Update babel parser options (#4688)
* Update babel parser options
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment