Update babel parser options #4688

Merged
merged 2 commits into from Oct 7, 2016

Projects

None yet

4 participants

@existentialism
Member
Q A
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
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

@danez

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
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
danez Oct 7, 2016 Member

Same also applies for the strictMode I think.

@existentialism
existentialism Oct 7, 2016 Member

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

@hzoo
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
cbb25a7
@danez
danez approved these changes Oct 7, 2016 View changes
lib/parser.js
sourceType?: "module" | "script";
- filename?: string;
- features?: Object;
plugins?: Object;
@hzoo
hzoo Oct 7, 2016 Member

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

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

1 check was pending

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

I think it is Array String>

Member
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

Member
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
c559c0f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment