Skip to content
This repository has been archived by the owner on Aug 18, 2021. It is now read-only.

Expose allowImportExportEverywhere #327

Closed
rhettlivingston opened this issue Jun 20, 2016 · 3 comments
Closed

Expose allowImportExportEverywhere #327

rhettlivingston opened this issue Jun 20, 2016 · 3 comments

Comments

@rhettlivingston
Copy link
Contributor

The Meteor framework recently recommended ESLint as the goto lint tool for all of their users. Then, this past week, they added support for imports to be placed below the top-level in conditionals and nested contexts. The change works well and is implemented through the NPM module "reify".

My problem is that whenever either Espree or babel-eslint encounter this, they throw a syntax error that stops all other analysis.

I am looking for a means that I can specify in the Meteor Guide that all users can use to get around this problem.

Both Espree and babel-eslint are using parsers that have an option to "allowImportExportEverywhere". I have created issue #6472 on eslint requesting that they make a change to Espree to pass the option through if specified in .eslintrc.json. They are hesitant to make the change due to their policies against supporting experimental features.

Babel-eslint seems to be the ESLint place for "experimental" changes. But, I don't see how to enable this flag without making a code change in the parseNoPatch routine to set allowImportExportEverywhere to options.allowImportExportEverywhere (when specified).

Is there a way for me to enable allowImportExportEverywhere without changing code?

If not, would you consider a PR to add this option to the above code? I'm thinking it would involve adding the line

eslintOptions.allowImportExportEverywhere = options.allowImportExportEverywhere = options.allowImportExportEverywhere || false;

to the parse function, changing the existing line that sets allowImportExportEverywhere to false to

allowImportExportEverywhere: options.allowImportExportEverywhere,

and test and documentation changes.

@hzoo
Copy link
Member

hzoo commented Jun 20, 2016

We do a similar thing for other options https://github.com/babel/babel-eslint/blob/master/index.js#L366-L367, sounds fine. We can support more than that just that too

rhettlivingston added a commit to rhettlivingston/babel-eslint that referenced this issue Jun 22, 2016
rhettlivingston added a commit to rhettlivingston/babel-eslint that referenced this issue Jun 22, 2016
hzoo pushed a commit that referenced this issue Jun 22, 2016
* Add allowImportExportEverywhere parserOption (#327)

* Added "allowImportExportEverywhere option (#327)" test.
@hzoo hzoo closed this as completed Jun 22, 2016
@benjamn
Copy link

benjamn commented Jun 29, 2016

When I saw this was closed, I was sure it met with the same YAGNI reply @rhettlivingston got from the ESLint folks—but no! Glad to see this enabled! 🔥 🚒 💃

@hzoo
Copy link
Member

hzoo commented Jun 29, 2016

Heh 😄 in babel-eslint 6.1.0 - and maybe i'l have time later for reify..

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants