Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Support Biome as formatter #21045

Closed
1 task
jase88 opened this issue Jan 8, 2024 · 12 comments
Closed
1 task

Support Biome as formatter #21045

jase88 opened this issue Jan 8, 2024 · 12 comments
Labels
community: plugin-request This would be a good candidate for a community plugin scope: misc Misc issues type: feature

Comments

@jase88
Copy link

jase88 commented Jan 8, 2024

Description

Biome (previously Rome) made some news by reaching 97% compatibility with Prettier.
A lot of rules from major plugins are already supported.

Motivation

It would be beneficial performance-wise.
And by making the formatter plugable it would make nx even more future-proof.

Suggested Implementation

official biome support with:

  • migration from prettier configuration to biome config
  • generator to provide configuration per project
  • executor for running nx format with biome formatter

Alternate Implementations

  • provide an API to make formatting via plugin possible
@AgentEnder AgentEnder added community: plugin-request This would be a good candidate for a community plugin scope: misc Misc issues labels Jan 9, 2024
@vaibhavdugar
Copy link

How to use biome in nx monorepo?

@guillempuche
Copy link

guillempuche commented Feb 13, 2024

@vaibhavdugar, I have a repo for this https://github.com/guillempuche/nx-expo-next-tamagui/blob/main/biome.json

I still need to run lint for all the files (as @JamesHenry pointed guillempuche/nx-expo-next-tamagui#1), but when coding a file on VSCode, it works.

@vaibhavdugar
Copy link

vaibhavdugar commented Feb 14, 2024

@guillempuche in your repo as well biome is not configured with nx, I see that you are also using ESLint with nx, do you have any idea how can we use biome instead of ESLint in nx.json?

@guillempuche
Copy link

guillempuche commented Feb 14, 2024

There aren't Eslint nor Prettier dependencies in the root package.json.

It's all Biome.

I don't use Nx target lint (I should delete this). Instead, you can format the code via the script in package.json. There's also a pre-commit Husky script.

@vaibhavdugar
Copy link

Thanks, can you tell me how to run the biome command for linting to catch all the errors?

@guillempuche
Copy link

Two ways:

a) yarn lint and it alerts you for errors
b) commit a change, auto lint and it alerts you for errors. How? Husky runs yarn pre-commit that triggers dependency lint-staged https://github.com/guillempuche/nx-expo-next-tamagui/blob/main/.lintstagedrc

@MrChrisRodriguez
Copy link
Contributor

We just updated our lint target as follows:

"lint": {
      "executor": "nx:run-commands",
      "options": {
          "command": "yarn dlx @biomejs/biome check --apply {projectRoot}"
      }
    },

@shinebayar-g
Copy link

We use https://nx.dev/features/enforce-module-boundaries. I guess we'll wait until nx officially supports biome.

@jase88
Copy link
Author

jase88 commented Apr 9, 2024

Biome has also a issue about monorepos: biomejs/biome#2228 aiming to support a root configuration that is extendable per project.

@mcfdez
Copy link

mcfdez commented Apr 11, 2024

Hello friends,

I am working on this project https://github.com/GitOpsLovers/nx-biome to create a plugin to implement Biome as linter, executor and generator in NX. Who wants to participate is welcome!

@guillempuche
Copy link

@mcfdez , how does it support child biome.json files https://biomejs.dev/guides/big-projects/?

@mcfdez
Copy link

mcfdez commented Apr 13, 2024

@mcfdez , how does it support child biome.json files https://biomejs.dev/guides/big-projects/?

Hi @guillempuche

The idea is that the plugin configuration generator will create a biome.json in the project that you tell it and also creates a biome.json in the workspace root. In the biome.js of the project, an extend will be made.

@nrwl nrwl locked and limited conversation to collaborators May 13, 2024
@FrozenPandaz FrozenPandaz converted this issue into discussion #23347 May 13, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
community: plugin-request This would be a good candidate for a community plugin scope: misc Misc issues type: feature
Projects
None yet
Development

No branches or pull requests

7 participants