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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 after running check --apply, vue files become empty #50

Closed
1 task done
Jungzl opened this issue Apr 15, 2024 · 8 comments 路 Fixed by biomejs/biome#2686
Closed
1 task done

馃悰 after running check --apply, vue files become empty #50

Jungzl opened this issue Apr 15, 2024 · 8 comments 路 Fixed by biomejs/biome#2686

Comments

@Jungzl
Copy link

Jungzl commented Apr 15, 2024

Environment information

CLI:
  Version:                      1.7.0
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           windows

Environment:
  BIOME_LOG_DIR:                unset
  NO_COLOR:                     unset
  TERM:                         unset
  JS_RUNTIME_VERSION:           "v20.12.1"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         unset

Biome Configuration:
  Status:                       Loaded successfully
  Formatter disabled:           false
  Linter disabled:              false
  Organize imports disabled:    false
  VCS disabled:                 true

Workspace:
  Open Documents:               0

What happened?

image

2024-04-15.23-41-53.mp4

Expected result

It should works as usual

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@ematipico
Copy link
Member

Any chance we could have a reproduction?

@Jungzl
Copy link
Author

Jungzl commented Apr 15, 2024

It's just vite start template with biome

@Jungzl
Copy link
Author

Jungzl commented Apr 15, 2024

BTW I'm using biome plugin in WebStorm, if I don't check this option, the error won't occur.
image
And running script like pnpm biome check --apply . is just ok, maybe related to plugin?

@Jungzl
Copy link
Author

Jungzl commented Apr 15, 2024

Can confirm that in VSCode, it's fine.

@ematipico
Copy link
Member

Yeah I think it's related to plugin

@ematipico ematipico transferred this issue from biomejs/biome Apr 15, 2024
@kujtimiihoxha
Copy link

Seeing the same issue also

@tasshi-me
Copy link

Hello, there!
I see the same issue with Astro files.

This issue seems to be caused by biomejs/biome#2225.
For Vue or Astro files, the biome CLI with the --stdin-file-path option will output nothing with a zero status code.
This plugin writes the output of the CLI command, so the src file is overwritten by empty string.

Reproduction

I enabled only the "Run safe fixes on save" option.

This plugin runs biome CLI inside, so I tried a command that is generated by this plugin on my local shell.
The result of this command is written to the src file.

$ [node path] [biome path] check --stdin-file-path [src path] --formatter-enabled=false --apply --config-path [config path]

This plugin passes the source code to the stdin of the above command.

$ cat [src path] | [node path] [biome path] check --stdin-file-path [src path] --formatter-enabled=false --apply --config-path [config path]

For a TypeScript (.ts) file

It prints formatted code. The status code is zero.

$ cat /path/to/project/src/consts.ts |\
    /Users/user/.nodenv/shims/node \
    /path/to/project/node_modules/@biomejs/biome/bin/biome check \
    --stdin-file-path /path/to/project/src/consts.ts \
    --formatter-enabled=false --apply \
    --config-path /path/to/project
... # (The formatted code is printed)

$ echo $?
0

For a Astro (.astro) file

It prints nothing. The status code is zero.

$ cat /path/to/project/src/pages/index.astro |\
    /Users/user/.nodenv/shims/node \
    /path/to/project/node_modules/@biomejs/biome/bin/biome check \
    --stdin-file-path /path/to/project/src/pages/index.astro \
    --formatter-enabled=false --apply \
    --config-path /path/to/project
# (Nothing printed)

$ echo $?
0

@tasshi-me
Copy link

In the VSCode plugin, this issue does not happen because the architecture seems to be different.
(Sorry, I don't know well.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants