GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Biome step empties files when the file is ignored since biome 1.5.0 · Issue #1987 · diffplug/spotless

Biome step empties files when the file is ignored since biome 1.5.0  #1987

New issue
Copy link
New issue
Copy link
Closed
#1989
Closed
Biome step empties files when the file is ignored since biome 1.5.0 #1987
#1989
Copy link

Description

@blutorange
blutorange
opened on Jan 9, 2024
Issue body actions

Please feel free to assign this issue to me.

The biome step uses the following command to format files via biome:

biome format --stdin-file-path [fileName] --config-path [PathToBiomeConfig] < [InputFile]

The biome.json config file can contain an ignore field with files that should not be processed. When the given file name matches that ignore list, biome won't format the file. In biome versions <1.5.0, it would still output the input file unchanged to stdout, and log a warning to stderr.

Since version 1.5.0, biome does not output anything to stdout, and only print a warning to stderr

⚠ The file localization.ts was ignored.

As a result, when trying to format a file via the biome step that is ignored, the file will be emptied, without the user noticing.


I would consider this a misconfiguration, as the includes/excludes defined for the spotless plugin conflict with the includes from the biome configuration. Still, it's not good to destroy data without the user being aware that something went wrong (I accidentally committed something, only to realize this later).

Ideally, we would just ignore the include/exclude list from the biome configuration. Since the biome CLI doesn't have such a flag, my suggestion is to check whether the biome output is empty; and if it is, use the original file content instead. In addition, we could either output a warning on our own, or forward the warning from the stderr stream from biome (if that's not already being done).

Activity

  1. blutorange commented on Jan 9, 2024

    @blutorange
    blutorange
    on Jan 9, 2024
    ContributorAuthor
    More actions

    There's also a different scenario where biome refuses to format certain files, such as tsconfig.json. Since version 1.5.0, this results in the same issue that stdout is empty, resulting in the formatter emptying the file

    ℹ The file tsconfig.json is protected because is handled by another tool. Biome won't process it.

  2. blutorange
    added a commit that references this issue on Jan 9, 2024

    Fixes diffplug#1987, no empty files with biome when formatting ignore…

    This issue will close once commit d73d05e is merged into the 'main' branch.
    d73d05e
  3. nedtwigg
    closed this as completedin #1989on Jan 15, 2024
  4. nedtwigg
    added a commit that references this issue on Jan 15, 2024

    no empty files with biome when formatting ignored files (#1989 fixes #…

    This issue will close once commit 350cf2e is merged into the 'main' branch.
    350cf2e
  5. nedtwigg commented on Jan 15, 2024

    @nedtwigg
    nedtwigg
    on Jan 15, 2024
    Member
    More actions

    Published in plugin-maven 2.42.0 and plugin-gradle 6.24.0.

  6. benkard
    added a commit that references this issue on Jul 4, 2025

    chore(deps): update all non-major dependencies (mulk/mulkcms2!58)

    4680b8c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.