lambda-packages icon indicating copy to clipboard operation
lambda-packages copied to clipboard

getStaticPaths doesn't support Allman style braces

Open swift502 opened this issue 3 years ago • 4 comments

What version of astro are you using?

1.1.7

Are you using an SSR adapter? If so, which one?

None

What package manager are you using?

npm

What operating system are you using?

Windows

Describe the Bug

The following syntax of the getStaticPaths function causes an error:

export async function getStaticPaths()
{  // <-- Note that the opening brace is on a new line
  return [
    { params: { id: '1' } },
    { params: { id: '2' } },
    { params: { id: '3' } }
  ];
}

Putting the opening brace on a new line causes the following error:

image

This error message is suggesting that the function doesn't exist, but it does exist under valid JS syntax. Regardless of people's coding style preference, I think that any valid JS syntax should be supported, and that this error doesn't make much sense in this case.

Let me know what you think! Jan

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-aatmky?file=src/pages/fruits/[fruit].astro

Participation

  • [ ] I am willing to submit a pull request for this issue.

swift502 avatar Sep 08 '22 20:09 swift502