biomejs / biome

A toolchain for web projects, aimed to provide functionalities to maintain them. Biome offers formatter and linter, usable via CLI and LSP.
https://biomejs.dev
Apache License 2.0
14.28k stars 442 forks source link

@biomejs/js-api #3623

Open AlemTuzlak opened 1 month ago

AlemTuzlak commented 1 month ago

Environment information

Not important for this issue

What happened?

I was using the @biomejs/js-api package to format file content before writing it to disc. I wanted to format an SVG file and after running the below code (I wasn't sure if it supported svgs, but now I know it doesn't) I got the stacktrace at the bottom of this issue.

biome.formatContent(fileContent, {
  filePath: "temp.svg",
})

image

Expected result

It should tell me something along the lines of "Hey, this file type is not supported yet, maybe even link to: https://biomejs.dev/internals/language-support/" Just to have it nicely output instead of the scary non-js stack trace above. Not a big deal but would go a long way in knowing I'm doing something wrong right away

Code of Conduct

ematipico commented 3 weeks ago

Feel free to help us. We don't have the bandwidth to look after this but unfortunately

AlemTuzlak commented 3 weeks ago

@ematipico where would I have to start looking at to improve this exactly?

ematipico commented 3 weeks ago

You could start from here

https://github.com/biomejs/biome/tree/main/packages%2F%40biomejs%2Fjs-api

ematipico commented 3 weeks ago

I will be back to you once I have more time. Drop here any questions you have