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

Complex Async Arrow Throws Parser Error #1028

Closed
Swivelgames opened this issue Dec 13, 2017 · 1 comment

Comments

@Swivelgames
Copy link

commented Dec 13, 2017

const reducer = async (state = initialState, action) => {
  const { payload } = action;
  switch (action.type) {
  // ...
};

Specifically, the errors that are thrown are via the import module; rules no-named-as-default and no-named-as-default-member introduce Parse errors when attempting to validate.

   8:63  error    Parse errors in imported module './Path/pathReducer': Unexpected token => (18:54)  import/no-named-as-default
   8:63  error    Parse errors in imported module './Path/pathReducer': Unexpected token => (18:54)  import/no-named-as-default-member

Unfortunately this is entirely valid syntax. I'm not quite sure why this isn't working.

After further investigation, it seems as though the eslint's parser is interpreting async ( //... as a function call, not as a function declaration modifier construct; it's as if it's favoring the following code (which is entirely invalid):

const reducer = async(state = initialState, action); // => {
@Swivelgames

This comment has been minimized.

Copy link
Author

commented Dec 13, 2017

I sincerely apologize. I swear I was on the eslint/eslint repo, and it wasn't until after I submitted this issue that it appears I've some how transported over to this repo.

@lock lock bot locked as resolved and limited conversation to collaborators May 25, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
1 participant
You can’t perform that action at this time.