aws / aws-appsync-community

The AWS AppSync community
https://aws.amazon.com/appsync
Apache License 2.0
506 stars 32 forks source link

@aws-appsync/eslint-plugin does allow functions returning function for arrow functions #304

Closed WolfWalter closed 1 year ago

WolfWalter commented 1 year ago

The APPSYNC_JS runtime sadly does not support returning function from functions: https://docs.aws.amazon.com/appsync/latest/devguide/resolver-reference-overview-js.html#:~:text=cannot%20be%20reassigned.-,no%2Dfunction%2Dreturn,-Functions%20cannot%20be

The esllint rule should give an error when the no-function-return is active (set by @aws-appsync/recommended). That does work fine for normal functions:

function test() {
  return () => {
    return null;
  };
}

But does not trigger for arrow functions:

const test = () => () => {
  return null;
};
onlybakam commented 1 year ago

This issue has been fixed in the latest version of the plugin