GitOpsLovers / nx-biome

NX plugin to integrate the Biome toolchain.
MIT License
20 stars 1 forks source link

[bug] error when `biome.json` included files do not exist or are not processed #2

Open FranciscoKloganB opened 4 months ago

FranciscoKloganB commented 4 months ago

Bug Report (unverified)

Description

I am running some scripts on git pre-commit hooks. Which output the error below when a file does not seem to exist within a project. This should be solvable by using --no-errors-on-unmatched. You might also want to allow --files-ignore-unknown=true as a configuration flag.

References

Output

For the issue I am referring to in description here is the output.

 NX   Affected criteria defaulted to --base=main --head=HEAD
 NX   Successfully ran target biome-lint for 0 projects (62ms)

View logs and run details at ****

eslint.config.mjs internalError/io  INTERNAL  
  ✖ No such file or directory (os error 2)
  ⚠ This diagnostic was derived from an internal Biome error. Potential bug, please report it if necessary.

This is probably the same issue that happens when biome-lint executes and does not find some of the specified matchers.

   ✖  nx run mobile:biome-lint apps/mobile/**/*.js apps/mobile/ **/*.json apps/mobile/**/*.ts internalError/io  INTERNAL  
        × No such file or directory (os error 2) 
        ⚠ This diagnostic was derived from an internal Biome error. Potential bug, please report it if necessary.

      internalError/io 
      Checked 0 files in 46µs. No fixes needed.
        × No files were processed in the specified paths.

Pre-commit Sample

Here is an exact sample of my pre-commit hook. Check added comments.

#!/bin/sh

. "$(dirname "$0")/_/husky.sh"
. "$(dirname "$0")/common.sh"

pnpm nx affected --target=lint ;

# biome-lint fails because it does not find `eslint.config.mjs`.
pnpm nx affected --target=biome-lint ; 

# explicit biome check command passes even if `eslint.config.mjs` does not exist.
pnpm biome check \
    --apply-unsafe \
    --formatter-enabled=true \
    --linter-enabled=true \
    --organize-imports-enabled=true \
    --no-errors-on-unmatched \
        .vscode \
        .infisical.json \
        biome.json \
        nx.json \
        package.json \
        commitlint.config.mjs \
        eslint.config.mjs \
        postcss.config.mjs \
        taze.config.mjs \
        global.d.ts ;

Context

You may be wondering why do I do a second pnpm biome check after running biome-lint. The reason is that I also want root configuration files to be linted and properly formatted. Which is something this plugin currently does not do.

mcfdez commented 1 month ago

Hello @FranciscoKloganB

If I have not misunderstood you, you are proposing to add some flag or configuration to the plugin so that if at the time of lint the files does not find any of these, it does not throw error?

FranciscoKloganB commented 3 weeks ago

Hey @mcfdez. That is correct.