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

auto fix not working #4218

Closed
1 task done
yigalirani opened this issue Oct 9, 2024 · 2 comments
Closed
1 task done

auto fix not working #4218

yigalirani opened this issue Oct 9, 2024 · 2 comments
Labels
S-Needs triage Status: this issue needs to be triaged

Comments

@yigalirani
Copy link

Environment information

CLI:
  Version:                      1.9.3
  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:                         unset
  JS_RUNTIME_VERSION:           "v20.15.1"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "npm/10.7.0"

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

Workspace:
  Open Documents:               0

What happened?

running npx biome lint --write . has no effect

C:\yigal\nitro\main\src\nitro_widgets.ts:105:7 lint/style/noVar  FIXABLE  ━━━━━━━━━━━━━━━━━━━

  ! Use let or const instead of var.

    103 │   const ctl={
    104 │     onchange(evt:Event){
  > 105 │       var target=evt.target
        │       ^^^^^^^^^^^^^^^^^^^^^
    106 │       if (isHTMLInputElement(target)){
    107 │         const target_value=target.checked

  i A variable declared with var is accessible in the whole body of the function. Thus, the variable can be accessed before its initialization and outside the block where it is declared.

  i See MDN web docs for more details.

  i Unsafe fix: Use 'const' instead.

    103 103 │     const ctl={
    104 104 │       onchange(evt:Event){
    105     │ - ······var·target=evt.target
        105 │ + ······const·target=evt.target
    106 106 │         if (isHTMLInputElement(target)){
    107 107 │           const target_value=target.checked


The number of diagnostics exceeds the number allowed by Biome.
Diagnostics not shown: 23.
Checked 81 files in 134ms. No fixes applied.
Found 42 warnings.

Expected result

fixed fixxable errors

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@yigalirani yigalirani added the S-Needs triage Status: this issue needs to be triaged label Oct 9, 2024
@ematipico
Copy link
Member

I suggest you get acquainted with the documentation and understanding how Biome linter works.

Biome has safe and unsafe fixes. As you can read, that diagnostic provides an unsafe fix, so you need --unsafe

https://biomejs.dev/linter/#unsafe-fixes

@ematipico ematipico closed this as not planned Won't fix, can't repro, duplicate, stale Oct 9, 2024
@yigalirani
Copy link
Author

following you suggestion i did run it with --unsafe and it worked perfectly. thank you for doing this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-Needs triage Status: this issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

2 participants