Skip to content
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

2.0.0-beta.1: lint in subdirectory not using root .gitignore #5440

Closed
1 task done
ValentinGurkov opened this issue Mar 24, 2025 · 8 comments
Closed
1 task done

2.0.0-beta.1: lint in subdirectory not using root .gitignore #5440

ValentinGurkov opened this issue Mar 24, 2025 · 8 comments

Comments

@ValentinGurkov
Copy link

ValentinGurkov commented Mar 24, 2025

Environment information

CLI:
  Version:                      2.0.0-beta.1
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           windows

Environment:
  BIOME_LOG_PATH:               unset
  BIOME_LOG_PREFIX_NAME:        unset
  BIOME_CONFIG_PATH:            unset
  NO_COLOR:                     unset
  TERM:                         xterm-256color
  JS_RUNTIME_VERSION:           v22.14.0
  JS_RUNTIME_NAME:              node
  NODE_PACKAGE_MANAGER:         pnpm/10.6.5

Biome Configuration:
  Status:                       Loaded successfully
  Path:                         <redacted>\biome.jsonc
  Formatter enabled:            true
  Linter enabled:               true
  Assist enabled:               true
  VCS enabled:                  true

Workspace:
  Open Documents:               0

What happened?

Running biome check for a subdirectory/package in a monorepo does not use the .gitingore file from the project root. I noticed the command taking forever and figured it was due to it formatting my Next.js output folder .next.
I created a .gitignore for the subdirectory and the process took 109ms.

The output folder is ignored this way in the root .gitignore:

.next

Expected result

While I am not 100% everyone would consider this a bug, ESLint in a monorepo scenario can work with a single .gitingore file at the project root, so I expected the same here.

Version 1.9.4 also uses the root .gitignore correctly.

Reproduction

https://github.com/ValentinGurkov/biome-repro-1742925348856

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@ValentinGurkov ValentinGurkov added the S-Needs triage Status: this issue needs to be triaged label Mar 24, 2025
@ematipico
Copy link
Member

Yeah, this isn't a bug. Full monorepo support hasn't been completed yet: #2228

@ValentinGurkov
Copy link
Author

I just tested this with 1.9.4 and it used the root .gitignore, so this version might be more favorable for the time being. I want to thank you for all your effort towards supporting monorepos, I imagine how complicated things can get!

@ematipico
Copy link
Member

@ValentinGurkov can you please provide a reproduction?

@ematipico ematipico added the S-Needs repro Status: needs a reproduction label Mar 25, 2025
Copy link
Contributor

Hello @ValentinGurkov, please provide a minimal reproduction. You can use one of the following options:

  • Provide a link to our playground, if it's applicable.
  • Provide a link to GitHub repository. To easily create a reproduction, you can use our interactive CLI via npm create @biomejs/biome-reproduction

Issues marked with S-Needs repro will be closed if they have no activity within 3 days.

@github-actions github-actions bot removed the S-Needs triage Status: this issue needs to be triaged label Mar 25, 2025
@depsimon
Copy link

Yeah, this isn't a bug. Full monorepo support hasn't been completed yet: #2228

Any workaround that could work with the beta version?

@ematipico
Copy link
Member

Yeah, this isn't a bug. Full monorepo support hasn't been completed yet: #2228

Any workaround that could work with the beta version?

Use a top-level command to lint the whole monorepo.

@ValentinGurkov
Copy link
Author

ValentinGurkov commented Mar 26, 2025

I have managed to create a minimal reproduction that can be found at https://github.com/ValentinGurkov/biome-repro-1742925348856.

I have enabled one correctness rule noUnusedVariables. The default rules configuration did not reproduce this.

How to reproduce with the repository:

  1. On the master branch run:
pnpm i
cd packages/package-a/
pnpm build
pnpm check

The report should only include errors for src/index.ts.

  1. Then checkout the branch 2.0.0-beta.1.
    Run (without switching folders):
pnpm i
pnpm check

The diagnostics also report errors for build/src/index.js related to the rule noUnusedVariables.

This regression could be related to how the .gitignore file is handled, the rule noUnusedVariables, or the new multi-file analysis feature, I am only guessing.

Оr it could be that setup (root config and ignore file but package-specific command) worked by sheer chance on older versions and was never intended.

I hope I managed to be of some help, this is my first time opening an issue here.

@ematipico ematipico added S-Needs triage Status: this issue needs to be triaged workaround and removed S-Needs repro Status: needs a reproduction labels Mar 26, 2025
@ematipico
Copy link
Member

I checked your reproduction, and it's possible that it worked by chance. It has a monorepo setting, which isn't supported at the moment. See #2228

As a workaround, lint the entire project from the root, and use overrides to tweak rules/etc. based on the project. Biome is fast, it shouldn't make too much of a difference.

@ematipico ematipico removed the S-Needs triage Status: this issue needs to be triaged label Mar 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants