Skip to content

Unexpected newline before "=>" #119

@nogenem

Description

@nogenem

Wayfinder Version

0.1.12

Laravel Version

12.39.0

PHP Version

8.4.1

Description

After creating a new laravel project with the vue starter kit and formatting all files with vscode extensions, when i execute npm run build i keep getting this error and the build fails:

ERROR: Unexpected newline before "=>"
file: /home/gilney/projects/multitenancy3/resources/js/routes/index.ts:28:0

Unexpected newline before "=>"
26 |  (options?: RouteQueryOptions
27 |  )
28 |  => {
   |  ^
29 |      return login.definition.url + queryParams(options)
30 |  }
Image

This happens with all functions like this one generated by wayfinder inside routes/ and actions/.

Copilot, on vscode, suggested the following change inside the file vendor/laravel/wayfinder/src/TypeScript.php:

Image

And this fixes the problem.

PS: I'm on Windows with the project inside the WSL2, dunno if that matters, but...

Steps To Reproduce

  • Create a new laravel project;
  • Open it with vscode (v1.106.1);
  • Use the extension Format Files to fix all files in the workplace. I have the PHP by DEVSENSE to format php/blade files, Vue oficial for vue files and Prettier for the rest;
  • Run npm run build;
  • Watch the error happening;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions