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

🐛 --apply / --write broken for vue files on stdin #2225

Closed
1 task done
Superpat opened this issue Mar 27, 2024 · 4 comments · Fixed by #2686 · May be fixed by TechByChoice/tbc-members-core-ui#228
Closed
1 task done

🐛 --apply / --write broken for vue files on stdin #2225

Superpat opened this issue Mar 27, 2024 · 4 comments · Fixed by #2686 · May be fixed by TechByChoice/tbc-members-core-ui#228
Labels
A-CLI Area: CLI S-Bug-confirmed Status: report has been confirmed as a valid bug S-Help-wanted Status: you're familiar with the code base and want to help the project

Comments

@Superpat
Copy link

Environment information

CLI:
  Version:                      1.6.3
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           linux

Environment:
  BIOME_LOG_DIR:                unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           "v20.11.0"
  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:                 false

Workspace:
  Open Documents:               0

What happened?

When I use biome lint --apply or biome format --write with a piped file and --stdin-file-path I get the formatted / linted code on stdout, but when I use biome check --apply nothing comes out. If I remove the --apply flag it outputs a list of what it would change.

Heres the actual command I use, $path is the absolute path to my project root and $target is the absolute file path for the file I want to lint
.
${path}node_modules/.bin/biome check --apply --config-path=${path} --colors=off --stdin-file-path=$target < $target

Expected result

I expect content piped to biome check --apply --stdin-file-path=xx to output the formatted, linted and sorted file to std out.

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@Superpat
Copy link
Author

Another weird thing is that if I pipe a file to biome format --write or biome lint --apply individually they both output the formatted / linted content, but if I pipe a file into biome format --write then pipe it's output to biome lint --apply, I get nothing. If I remove the --apply on the biome lint, then it outputs the code just fine.

@Superpat
Copy link
Author

Superpat commented Mar 27, 2024

After testing this with other file formats, I think this is only a problem with vue files. Piping a ts file into biome check --apply works like intended.

So when I pipe a vue file into biome check --apply nothing is outputted back, if I dont use --apply, it does output what it would of done to the whole file. Piping a vue file to biome format outputs what it would of done to the whole file, but if I add the --write flag then it only outputs the script part, not the template part, thus breaking the rest of the pipe chain.

@Superpat Superpat changed the title 🐛 check --apply doenst pipe out linted code 🐛 --apply / --write broken for vue files on stdin Mar 27, 2024
@ematipico ematipico added A-CLI Area: CLI S-Bug-confirmed Status: report has been confirmed as a valid bug labels Apr 2, 2024
@ematipico
Copy link
Member

@ematipico ematipico added the S-Help-wanted Status: you're familiar with the code base and want to help the project label Apr 2, 2024
@tasshi-me
Copy link
Contributor

Hello there!
I come here from biomejs/biome-intellij#50.

Perhaps I may have found the point.
When fixing a file on the filesystem, the linted output seems to be merged with the original input.

match workspace_file.as_extension() {

However, for stdin, that process is missing.

if fix_file_result.code != new_content {

I am working on a PR #2686 right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-CLI Area: CLI S-Bug-confirmed Status: report has been confirmed as a valid bug S-Help-wanted Status: you're familiar with the code base and want to help the project
Projects
None yet
3 participants